Slice of Life: Converting my Personal Site

Over the last few months I have been having a lot of fun converting my personal site (http://drusellers.com) from a pure static html site, to one that uses a back end server side language.

When I first started the main purpose was to learn a little more about python. So I started off using Flask, a micro framework for python. Flask is a lot like Sinatra for ruby and the comparison was a lot of fun because my good friend Ryan Rauh (RyRy) was writing a site in Sinatra at the time so we were able to compare and contrast the two approaches quite easily.

As I learned more about flask and all that it could do, I was impressed by how much I could do with so little. It served as a solid reminder that we should strive for simpler solutions.

In addition to learning python I also took the time to dive into LESS. Organizing the CSS content of applications has always been difficult for me. Finally, with LESS I had variables and the ability to nest selectors. Basically, all of the things that I have wanted CSS to do for a very long time. I started out using the runtime compilation modes of LESS, but as I learned more I eventually switched to running the watch mode on the compiler and then stripping that functionality out of the app. Right now, I really like this approach. It feels more like PROD vs DEV, but I still have the ability to iterate quickly. The real choice to use LESS, was that the popular CSS framework from Twitter called Bootstrap had just launched. By studying their approach and trying to deconstruct things I have learned a lot about CSS and its application to better CSS approaches.

But as with all things in the technical world, a change was on the horizon. That change was SASS/SCSS. RyRy read a post somewhere comparing SCSS and LESS and he came away with the impression that SCSS RULED, and LESS DROOLED. This was one of those moments, where I gave RyRy a stern look and then sat down to start converting my website from LESS to SCSS, because when the guy you ask all of your questions too, changes directions sometimes its just easier to go with the flow. Thankfully it wasn’t that hard, allowed me to revisit my CSS and improve things further.

Around the same time, I discovered semantic.gs, a SCSS friendly grid system, finally I can get rid of the BS classes like span-4 and what not that have been plaguing me since I first found blueprint.css and 960grid. Whoot! I have been able to further clean up the website’s CSS approach.

Well, of course the project can come to a close quite that simply. After improving my CSS and getting an understanding of python, I of course, had to completely rebuild it something new and shiny. Damn, my attention span.

So, yeah. Node.js the new shiny language/framework. My JavaScript skills have always suffered, so I rationalized changing my backend code to JavaScript as a means to improve my JS skillset. So, I converted my site again, learned a lot about JavaScript in the process, melted my brain trying to get things to work in this under powered language (under powered because I am used to my language providing much more to me).

So now my site is running Node.js – its a whole lot cleaner and easier to work on. I love how simple the underlying code is, and I have really learned a lot about some of the new languages and frameworks out there.

Posted in Uncategorized | 1 Comment

Sunday Thought: Patient / Fast

Some times I am such a dolt.

I open a new OSS project and my first thoughts are usually “This library is ^&*$% it doesn’t do anything right.” 

“RAGE! (╯°□°)╯︵ ┻━┻”  don’t they know that, MY WAY is better!

Its sad, but that is exactly what I am thinking. I am on such an immediate gratification high, thanks to my 8 core, 8GB RAM, SSD, super high speed internet capable machine that I forget that not everything can be measured in sub-second latency. Things like instant on-demand movies, and Amazon 2 day shipping don’t help with my attitude either. When it comes to learning, this demand for instant gratification has, many times, gotten in the way of what it is I really want to accomplish.

So, I ran into this situation again this week, and after IM’ing the maintainer – complaining about how this and that worked (ok, lets be honest – I was whining like a 4 year old) – I kinda just snapped out of it. I recalled a quote from the book The Toyota Way, where they stated that the #1 problem with new engineers is that they can’t slow down. They just want to charge into things head first and solve all of the problems. Hmm, sounds a lot like me. Except that I have 10 years underneath my belt now. So, why am I still acting like a new developer? My biggest guess, is that I haven’t really honed my process. I need more people to catch me acting this way and to call me on it. But that can be hard to find in our community, because we all tend to act this way.

We, developers, are always on the look out for the next shiny library or framework that we can “learn” and by learn I mean implement. We like libraries so simple that a new programmer could understand them. We don’t want a learning curve at all. I think that this is one of the reasons things like express.js, flask, and sinatra play so well in our community. You can see, immediately, how it works. They have almost no abstraction over the underlying concepts. Let’s not forget, that its the abstractions that bring the real power, and that not every abstraction is a poor or leaky one.

Its Sunday, which is an introspective day for me, and I want to try and improve myself. I think that if I could work on this aspect of my skills and attitude, I would become a better developer. Being a better developer is something that I want to be. Ok, so how am I going to do this. After much thought, I was reminded of a similar experience that worked well for me outside of the software development world.

Patientfast

For that last three months I have been training in Olympic Lifting. Now for those of you that have never performed olympic lifts, you need to know that while strength is a big part of it, skill also plays a huge part. You can’t just hoist 150 pounds over your head with out a level of skill. The snatch is an explosive lift, that requires an insane amount of patience and balance. My coach and teammates have a phrase that I have come to love. “Patient / Fast”, which means to me that you have to move fast, but at the same time be patient in the pull. It took me a long time to really grok that concept. It feels like a damn Zen koan at times, but I keep repeating the phrase and each day it reveals itself to me a bit more.

So there I was, at the keyboard, about to burst a vein, when I woke myself up from my emotions, calmed down – and asked myself what would “Patient / Fast” look like here? I decided that I would patiently look through the code, asks questions to myself via comments and then go answer them, and start to understand what the code was doing, on the flip side I would be very fast to start writing, running, and debugging unit tests to get ahold of the code base. Sure enough, the code started to reveal itself to me, I could see the author’s intentions much better now. I started to build up a good amount of understanding, and was able to effectively solve my problem but was also even able to make a nice pull request back to the library that I think cleaned up a very small part of the code base. :) 

In the end, I spent more time than the old me would have liked understanding the library. But the reality of it is, this small investment in understanding a key part of my infrastructure is going to pay dividends in the long run. And less than a day understanding how a critical part of my system works, is indeed a small investment. So, from here on out I am going to remember. Patient / Fast

Posted in Uncategorized | 1 Comment

Fine Grained Issues

One of the little things that I have noticed as a new trend for us here at Dovetail is the use of finer grained issues. Smaller and more focused issues. While this is nothing new, and has always been a helpful thing to do, it has never been easy to do (at least for me). You have to go to some website or app, type a bunch of information into the app and then start over with the next fine grained issue.

Well, I have found a command line app for creating github issues. Its called ‘ghi’ http://rubygems.org/gems/ghi

with this I can open issues with the following simple command

githubrepo> ghi -o "issue title"

or

githubrepo> ghi -o "issue title" -m "issue body"

ghi assumes that you are in a directory of a git repository, which is also nice because you don’t have to tell it which repo to send the issue to.

Take this, and combine it with http://huboard.com and you can get some amazing issue management. Lightweight enough for me to actually use it, and captures enough data that its helpful to the team. Since we all get emails of the issues, the team is alerted and then we all can start piling on comments. Then once it is done, we can simply push the commit with a ‘close #123′ and now the issues is closed.

Again, nothing amazing, just a simple tool and a simple technique that is making my life better.

-d

Posted in Small Ideas | 1 Comment

A brief overview of type system metadata in various languages

So given that a class that is nothing more than a data bag. After all, each object is just a bag of dict’s which are pointers to some byte array some place. What can we introspect about the byte array in each language?

The following is my attempt to document my metadata experiments.

Let’s start with .Net, its what I know the best and what I am ultimately comparing everything too.

.Net

public class Loan
{
    public decimal Amount { get; set; }
}

var aLoan = new Loan {Amount=5};
aLoan.GetType();
//an instance of Type filled with data about Loan
for(var prop in aLoan.GetType().GetProperties())
{
    Console.WriteLine(prop.Name);
}
aLoan.GetType().GetProperty("Amount");
//returns an instance of PropertyInfo

Links:

Type: http://msdn.microsoft.com/en-us/library/system.type.aspx
PropertyInfo: http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.aspx

Ruby

class Loan
    attr_accessor :amount
    def initialize(initialAmount)
        @amount = initialAmount
    end
end

aLoan = Loan.new 5
aLoan.class #Loan
aLoan.method(:amount) #a method object

After playing around, I couldn’t find anyway to get the type returned by the ‘amount’ function. This is exactly what I expected, but wanted to confirm. I could get the number of arguments via the ‘arity’ method. That said, I was able to extract a lot more information than I had expected. Special thanks to @jflanagan for the much need schooling in ruby.

Links:

http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Classes#Accessor_Methods

http://ruby-doc.org/core-1.9.3/Method.html

Python

class Loan(object):
    def __init__(self, initialAmount):
        self._amount = initialAmount

    @property
    def amount(self):
        return self._amount

aLoan = Loan(5)
aLoan.__class__ #Loan
aLoan.amount #nope, this returns 5
dir(aLoan) #return 'all the things'

Links

http://docs.python.org/library/functions.html#property

JavaScript

function Loan(initialAmount) {
    //as recommended by Ryan Rauh
    this.amount = initialAmount;
    return this;
}

var aLoan = new Loan(5);
typeof(aLoan); //object
Object.getPrototypeOf(aLoan).constructor.name; //Loan
for(prop in aLoan) {console.log(prop)}; //prop is a string
typeof(aLoan['amount']); //number
//this is actual a typeof(5)

I was again surprised at how much I could extract. Special thanks to @rauhryan for the JavaScript schooling.

Beyond my reach (for now)

So I wanted to do some other languages outside my comfort zone like lisp, haskell, and erlang. But my brain was exploded by the very different nature of the languages. What I do have is how I would set the structure up roughly in the various languages. I hope to come back overtime and update this as I learn or people share with me. :)

Lisp

('Loan, ('Amount, 20))

Haskell

data Loan = Loan { Amount :: Int }

http://www.cs.auckland.ac.nz/references/haskell/haskell-intro-html/moretypes.html

Erlang

-record(Loan, { Amount })

Links:

http://www.erlang.org/doc/reference_manual/records.html

 

Any feedback on how to do these kinds of things in other languages will be most appreciated.

-d

Posted in Uncategorized | 28 Comments

Another Question: Information Sources

Where are you getting your new information on software development? No matter the language or platform. Who outside of the software realm is influencing your development learning?

Please let me know in the comments what books you are reading, what magazines, what websites, who are you following on twitter/blogs.

Interested in hearing from you!

-d

Posted in Uncategorized | 28 Comments