15 Oct 2009

My Git Workflow

Recently at work we've taken a giant leap forward in our software stack: We ditched CVS and are riding the git bandwagon.

And oh what a pretty red wagon it is. Drawn by the big Clydesdales with fancy harnesses. In this article I aim to show the workflow I've been using that I feel will help other people just getting in to git.

What's this "git" you speak of?

Just a small caveat: if you already know what git is, or if you don't care about how I got into git, skip ahead. Sometimes I'm boring and I can't help it.

Git's been coming along nicely for the last few years gaining all sorts of popularity in the face of Subversion's apparent lead, and CVS's mind-boggling IE6-like stranglehold on the Version Control Systems universe. A lot of the current fervor attributed to git is attributed to several popular open source projects changing their SCM from Subversion to Git, most notably (for me at least) Ruby on Rails and their switch to Github.

I'll admit that I had no idea who or what git was until mid-2008 when a co-worker of mine told me he wanted to get into it (no pun intended). I was in my nice cozy comfortable Subversion shell at the time and thought how could one possible want anything more than SVN? Ironically, after using git for the past year or so, I'm thinking the same thing from the git perspective. How in the world are people still using SVN (assuming they have the choice)? Ya, I don't know either.

Due to much of git's current popularity coming from the Rails switch, a lot of the git info you read online comes from people doing stuff in Ruby. This was certainly my main usage of git after I finally took the plunge late last year, using it to manage the version control of all my Rails/Sinatra projects. Of course, with any VCS, the content you are versioning need not be a specific software project at all. You could use it to version your photoshop design files if you wanted to.

How sweet it is to be loved by git

Anyways, at work we use Java. And up until about a month ago, we were using CVS to manage our software versioning. We've been doing a great round of tech discussions to improve our stack, and the CVS to Git migration was one of the first targets we moved against, due to the relatively simple nature of the change. I've got to credit Ben for randomly deciding to demo git to everybody in one meeting. I just let him run with it, though I probably know git a lot better. By the end of the meeting we were all like, "Okay, so when do we start using it?". I was floored. I thought for sure there'd be reservations and assumed that if we ever did get off of CVS it'd be to Subversion. Well, just a few short weeks later we had imported our entire repo into Git (approximately 900 mb). A few weeks after that, we were completely dependent on git for our VCS of choice. And boy does it feel sweet.

Not a day goes by when someone in dev just randomly exclaims, "How freaking sweet is Git?!", or, "Git is just so fast!". I love hearing this stuff, cause it reinforces my belief that git really is a superior VCS. It brings some passion back into what we do each day. A software developer's tools should always enhance their ability to put out great software. Git does just that.

Okay, so that was the boring back story, here's some of the meat of git that we've been working with. Most of these concepts were taken in one form or another from the Git Workflow manpage.

Topic Branches

The best thing I pulled from the git workflow article is the concept of the topic branch. In git, branching doesn't create new filesystem directories, it just magically handles it all in the cloned repository. This was a huge upgrade from CVS and even Subversion in my opinion. It's one of the biggest reasons I love git so much. Branching is cheap, therefore much more useful.

Topic branches aren't a special kind of branch, it's just a way of thinking about how to use branches for effective project development. Git creates a default branch for your trunk or mainline of development and calls it "master". Each time the project manager assigns me a project (in this case say the project is called "widget"), I follow this workflow:

# This is a simple descriptor on how I do topic development using git
# Some of the commands are java flavored (like ant),
# but that doesn't mean you can't use this with other languages.

# Step 1 - Synchronize master.
# 1.1 - Checkout master branch
# 1.2 - Get changes from origin
git checkout master
git pull

# Step 2 - Create a new branch to do all widget development.
git co -b widget

# Step 3 (recursive) - Write tests, write code, and commit.
# For every user story in the project, follow this flow:
# 1.1 - Write tests
# 1.2 - Write code to pass the tests
# 1.3 - When the story is completed and the tests pass, commit the code.
# Lather, rinse, repeat until code complete on the project
git add .
git commit -m "Some message about your commit"

# Step 4 - Synchronize master
# 4.1 - Fix any conflicts and commit
git checkout master
git pull
# Do 4.1 if you need to

# Step 5 - Merge the topic branch into master
# 5.1 - Fix any conflicts and commit
git merge widget
# Do 5.1 if you need to

# Step 6 - Fix conflicts, run compiles, run tests
# If tests or compilation fail, go back to step 3
ant compile
ant test # or whatever testing procedure you use

# Step 7 - Push code to origin
# Only perform this step once you have resolved
# all conflicts and all automated tests pass
git push origin master

# Step 8 - Remove your topic branch when topic development has ceased
git branch -d widget

How do you manage your projects with git?

14 Oct 2009

Techno Hurdles and Writers Block

You've patiently awaited results (don't deny it) from my previous post, and indeed I've been planning on it. Sometimes plans don't work out how we expect them to. And sometimes they do. Here is part 2 of Learning how to focus.

Approximately 6 weeks ago I deleted my Twitter and Facebook accounts. It was an impulsive move. An idea came to me, I talked to my wife about it, we agreed, and I just did it. There wasn't a lot of drama involved, I had just gotten to the point where I felt I was losing valuable time using those services. I'm not going to go into more of the "why" details, I already did that.

The positive stuff

Since purging the web-social scene from my daily life, I've noticed a lot of positive gains. For one, I'm a lot more focused while at work. We're talking orders-of-magnitude more focused. Before it was easy to spend a lot of time posting stuff on Twitter or reading people's Facebook updates. Now, those distractions are not just archived, they're completely gone.

Since "the purge" I've hit all my project deadlines at work, something that is actually fairly difficult for a developer to do in a serial environment. Well, I hate sweeping generalizations; I have a hard time hitting deadlines in a serial environment, though I'm not alone, just go read some Fowler essays on Agile Programming.

Speaking of Fowler, I've totally come to love the essays he writes about software design, agile programming, test-driven development, etc. He's just a genius, and a great writer. If you write code, you should read Fowler. I never would have had time to read any of his stuff had it not been for "the purge". As a side note, I'm using Marco's Instapaper iPhone app on any article I'd like to read, but want to "read later". It's my number one app. Go buy it.

One facet of the purge was removing a lot of RSS feeds from my daily intake. I kept around 40 or so, though most have a post frequency of less than 1 per week, so I rarely have more than 3 or 4 articles at a time in reader. This is really nice because I still can get some info I want, but my take has been that it's completely non-pressuring me. I don't feel the desire to constantly check, because I know that there probably isn't anything there. There are stretches of days where I don't even check it because it's completely off my mind. This is exactly the kind of thing I was going for.

The weird stuff

There have definitely been some weird side-effects to the purge. For example, when I read an interesting blog post or listen to a cool song, or whatever, I still (to this day) think about posting it to Twitter/Facebook. I mean, that's how addicted I was. It's kind of like my withdrawal cravings I guess. Still, very weird.

Something else weird happened: I turned into an old man. Over the past few weeks, my average bed time has gotten earlier than before. I'm now going to bed between 10 and 11, sometimes even earlier. Just a few days ago I literally fell asleep at 8:30 pm. I'm crazy like that.

The "huh?" stuff

You may have noticed that I haven't posted a ding-dang thing since I wrote about the purge. Along with the purge came a huge case of writers block. I mean, we're talking mammoth. I have had a continual desire to want to blog and write stuff that is random and annoying, but I just haven't gotten to the point of writing it. It's really weird, possibly coincidental to the time period. If you followed this blog before when it was on wordpress, you'll know that I had gotten less frequent in those postings too, so maybe it's a deeper issue. I do love how Marco talks about not caring about the frequency of posts on his blog, that he blogs whatever and whenever he wants to. This is totally the style of blog I want to cultivate. I've just not really had the drive to post at all lately. And it's bugging me.

Sure, this post is a new post on the blog. So I guess it's good that I'm getting some of it out there. I just want a bit more consistency. Not like, "I must blog every 2 days" or something stupid, just... you know, semi-regular updates. When I get an idea about a post, I want to just write it and post it. So that's something I'm working on.

Probably the biggest frustration that I've hit is the lack of motivation to work on my entrepreneurial pursuits. I have literally done nothing towards furthering my goal of being an independent business owner. Usually I reserved evenings or saturday's for times when I could push forward on my ideas, and I've just completely fallen out of that routine. This is probably the biggest head-scratcher of the whole purge process. It was when I was "addicted" to the consumption of information that I was passionate about working on my ideas. Now that the addiction is gone... so is the passion. I'm not entirely convinced the two are related, so I'm still working through a lot of that in my head. Crap... that makes me sound like a manic-depressive psychopath. Just know that I'm not. I promise.

What are some gains or shortfalls you've seen in me since the purge? What about yourself?

26 Aug 2009

Learning How to Focus

There's an interesting saying that is a golden proverb, one that has descended the ages:

[...] and yet the true creator is necessity, who is the mother of our invention.

— Plato, The Republic

It's been adapted over the years to read simply: "Necessity is the mother of invention". If you're unfamiliar with the phrase, or don't quite remember what it means, I'll give you my interpretation. It means that invention (or ingenuity) is spawned from a direct need or necessity. Ideas and Machines and Businesses are all created because of an attributable need of some force, be it human or otherwise.

Washing Machines & Microsoft

A few months ago I had a weird thought pop into my head when I heard that phrase during the day. I thought, "Sure, in most cases necessity is the mother of invention, or the cause of why the invention was created. But if you reversed the phrase, would it also be true? Could Invention be the mother of Necessity?" At first you may dismiss this as a mere play on words and give it no further thought. But go back and read it again:

Invention is the mother of necessity.

— My weird brain

Could it be, that a real need or necessity created these ideas and inventions and businesses, and once the ideas and inventions and businesses were created, they created and psychologically enforced a "need" to use them. Take for example the washing machine 1. It was invented because a real need existed. People doing their washing all over the world had to do it by hand, which was slow and hard and probably boring. What if someone created a turning basin that would make sure all the clothes were scrubbed together without having to do it manually? Of course, I'm sure the washing machine wasn't met with immediate overnight success like MySpace or something. Customers were probably sparse at first, but surely as you're reading this post right now, the washing machine grew in popularity and ubiquity because it fulfilled an enormous need.

And here we are 318 years after the first washing machine patent was issued. And everyone has got a freaking washing machine. Ok, I know the kids in Africa don't, and college students and other poor people, but still, it's a big market by even Microsoft's standards. But let's get back to my thought. I'll agree whole-heartedly that the washing machine was invented because of a real need. But now, because we have the washing machine we kind of have to use it, don't we? I'm not entirely convinced either, but it's a weird loop to get into if you've got some time to kill.

Bit by Bit

And so we jump from washing machines to one of the most incredible and unbelievable inventions ever created: the Computer Processor (see 1). From ENIAC to iPhone, the computer processor has absolutely transformed the world culture more completely than perhaps any other invention has ever done, certainly faster than any other. This pace of evolution was quickened significantly by the arrival of the internet nigh-on twenty years ago (thanks, Mr. Gore).

Entrepreneur's have flocked by the millions to the internet in hopes of cultivating some small corner for their prospective ideas. In this case, the invention of the internet has created a vacuum so strong that for the last 20 years the world has been frantically scrambling to catch up to the opportunities that multiply exponentially each day. As with every free market, there are giants and there are peasants. The internet giants are the household names: Google, Wikipedia, Digg, Craigslist, Facebook, Twitter, etc. They're so widespread that my grandma probably knows Google, Facebook and Wikipedia, even if she's not sure what they are or how you would use them. Anyone with a lick of sense can tell you that the ones who are making internet Empires are building them on top of some form of content aggregation. In the design, marketing, and advertising industries, the saying goes that Content is King.

The problem with having all of this information being so readily available is that it creates the need to process it. The necessity of finding and consuming information exists due to ease of acquiring it. Okay, let me back up a bit... the problem I have with the internet is my need to process as much information as possible. Programming, Business, Design, Comics, Photos, Friend Updates; all these things cry out for attention, and often I oblige. Much too often.

Why, _why?

On August 19th, 2009, one of the biggest names in the Ruby industry disappeared entirely and completely from the internet. Why the lucky stiff (who often goes simply by "why" or "_why") trashed all his sites, github projects, and any other notable web presence completely. At first people were afraid he had been hacked big time, or feared that he had been physically hurt or even killed. All of this was a bit overkill if you ask me. The final few days on his twitter account he continually posted rhetorical questions about the purpose of life and programming. _why didn't get shot or hacked, he got sick of information overload. He got tired of having to be defined by what the masses thought of him, so he bailed.

I was surprised because you just don't see that kind of thing happening to high-profile people online (unless they really did get hacked). I was sad because he's contributed in some ways to my love for the Ruby programming language (his TryRuby site was key to that), such that I feel like the Ruby community did take a substantial loss. I was intrigued because of the sheer style in which he went out. He knew what he was doing, probably had been planning it for a few months now, possibly even years. He hit a wall. A wall where the invention created a necessity he felt he could no longer support.

Operation "_why not"?

Since the day _why went offline (7 days ago) I've been formulating a bit of my own escape plan. Last night, I launched the first (and possibly only) phase. Time will tell if there are additional phases. You may have already noticed some of the effects of my actions. The first is that you will notice that my recent tweets no longer show at the bottom of this site. Yes, I deleted my Twitter account. Not only mine (@localshred), but OSG's as well (@onesimplegoal). Go ahead, go check, I'll wait. Right, are you back? Okay, good. I also deleted my facebook account. Not deactivated, I actually found the link to completely delete the account. It's supposed to be deleted in about 13 days, though I'm supposedly able to cancel the request at any time before it happens. I won't be. The third strike was drastically truncating the majority of my RSS feeds. I now only subscribe to family blogs and photo feeds, as well as a few key tech/programming resources like 37Signals and Jeff Attwood's blog (and yes, xkcd made the cut).

You may be perplexed by my actions. To tell you the truth, I am still a bit perplexed that I actually went through with it. Quite a few months ago I went through a similar purging excercise, but not to the extent of deleting accounts. The best answer I can give is that I feel like my need to consume and digest information is completely getting in the way of my progress as a programmer and human being. I crave it, need it, just like a drug. And some days it's all I can think about and act upon.

I'm not sure if I'll ever create a facebook account again, as much as I really did enjoy it when I had a small number of friends who mattered to me. I am fairly certain, however, that I will utilize twitter at some point in the future as owning a business becomes more a part of my day to day activity. But for now, I'm partially following _why's example and turning off the invention in order to subdue the necessity. Here's to learning how to focus. Cheers.


Notes

  1. I have never done, nor plan to do any research on the invention of the washing machine (or computer). :)
18 Aug 2009

Why You Want Me to Work for You

The day you have all been waiting for has finally arrived: rand9 Technologies is officially accepting clients for projects in Web Application Development, Graphic Design (including Logo & Site Design), and Software Project Consultation.

This article is meant to detail my desire to start building a successful client-work business.

Quite often I'm approached by friends, family, or associates about building [insert application name here], or desinging the branding for [company xyz]. Up until a few weeks ago my response is generally somewhere along the lines of, "Thanks, but no thanks." All that has changed recently as I've decided to turn rand9 into a full-fledged client-work business. I'll be focusing on three areas of my expertise, detailed below, but if you have any work that falls outside of these lines, please don't hesitate to contact me and we can discuss your project.

Web Application Development

I've been finagling web applications for the past 7 years in PHP, Java, and Ruby. On one hand, I've worked on horrible hack-job projects, often outsourced to India; "Apps" that you couldn't really call Apps at all. On the other hand, I've worked on beautifully crafted Object-oriented systems that were well thought out and cleanly implemented. In other words, I've been around the web application block a few times. I've seen enough to know what works well, what will most likely do the job, and what is doomed to failure.

My application development experience leans almost exclusively towards framework-driven object architectures. It's a fancy way of saying, "I believe in and use extensively stable and up-to-date programming software and practices." I've custom-built everything from a simple blog to a PDF-processing Web-to-Print software engine that supports private-branded portals.

Graphic Design

My software background is complemented beautifully by my design capabilities. I've been studying usability and design for over a decade, and have regularly put out logos, site designs, and print work for a variety of project scopes and mediums. I've designed posters for the Children's Miracle Network, Logos for several startup companies, and numerous site designs. I'm even available to design and build micro-layouts within an already designed site.

Software Project Consultation

It may sound incredibly nerdy, but I love talking about software. I love to discuss the theory behind the implementation, to critique the pattern-flow of an object architecture, to assess the feasibility of an object-relational mapper. In short, I love to talk about what makes a project successful for the Businesses as well as exciting for the Developers writing the code. If your project is headed off the track, you need another pair of eyes to determine what is going wrong and how to get back on the track.

Other Project Needs

If you have any other projects that might not fit the molds above, feel free to contact me and I can assist or point you in the right direction (if I can).

11 Aug 2009

Movin' on Over

As you probably can tell, I've gone quiet on the blogging front for a while. It's not you, it's me. I've been lacking creatively for quite a while, being energetically drained by numerous sources that you don't really need to worry yourselves over. Needless to say, I'm back into blogging form, or am attempting it yet again.

I'll likely be transitioning over to my new blog rand9.com. I had initially intended to only post tech-specific things on that blog, and keep more personal matters over here, but this post changed my mind. I want to focus my energy on one blog, and I feel like the rand9 name is what I want to put my energy into.

Fear not, I will continue to strive to put more content than just tech stuff over there, so you will still get the usual banter and rantings. I still plan on posting a lot about entrepreneurialism and projects that I'm engaged in. So head on over to the new blog and give the few articles a read. Oh, and if you've subscribed to this blog's RSS feed, be sure to do so over there as well. Thanks for all the feedback over this last year on these posts!