Corporate frameworks and corporate standards

Posted on August 19th, 2011 in Agile by Jon Kruger

Most IT departments manage multiple projects and applications. As you go from project to project, you inevitably will find better ways to do things. Then at some point, someone might decide to get the smartest people together and come up with the one corporate framework to rule them all. All future projects will use the new framework, which makes sense because we’ve taken all of our good ideas and combined them so that other developers don’t have to go down the wrong path. I’ve had this idea before, it’s a great idea, right? We’ll have less risk of failure and we won’t constantly reinvent the wheel.

Companies think that by doing this, they will reduce the risk of failed projects. But they are buying into two things that are fundamentally incorrect — that they won’t be able to ever come up with a better way of doing things and that all projects are the same.

Ultimately what is lost when corporate standards are mandated is innovation. Developers are smart people, and many of them are trying to find new and better ways of doing things. If you don’t encourage them to find a better way, either they’ll quit trying, feel defeated because they can’t change things for the better, or get upset that the process is hindering them from getting things done better or faster.

Also, all projects are different. I’ve been on many “agile” projects, and every one did things differently. This is good because working on a two-person team at a startup is much different than working in an enterprise IT shop. I heard of one company who was trying to do an “agile transformation” so that they could find a methodology that they could standardize across the enterprise. It’s great to see people adopt agile practices (which are generally good), but trying to “standardize” so that everyone has to do things to same is directly opposed to the agile idea of continuous improvement. (Often times, the standardization of methodologies is mainly done so that common metrics can be established by which to judge teams, which encourages teams to game the system to make their metrics look better instead of solely trying to provide business value in the best way possible.)

The Alternative

What if instead of mandating that everyone used the same corporate framework, we encouraged teams to come up with the best way of doing things and then share them with other teams so that they can adopt each others’ best ideas if they so desire?

What if instead of mandating a framework, we created a repository of random pieces of code that people could pick from to do common tasks (e.g. an authentication library that authenticate to some corporate server)?

What if we stopped being obsessed with metrics and measuring teams and just went out and got the best developers that we could find, and then gave them everything they needed to do an awesome job?

Git: you really should use it. Really.

Posted on August 15th, 2011 in Git by Jon Kruger

I’m always looking for anything that can make me more productive and help me develop software the way that I want to. I’m going to make it easy for you and give you some low-hanging fruit that can make software development easier — use Git for source control.

But you say, “It’s just source control, what’s the big deal?”

I said this once too. Most of us at some point used TFS or SVN or some other source control system that works like that. These allow you to check out, check in, branch, and merge, and I always held my breath when branching and merging. I never thought that there could be anything more than that.

Git enables you do to a lot more than that, and it doesn’t get in your way. It does what I want, and it does it fast.

Here are some ridiculous things that I or people I have worked with have been able to do with Git that I couldn’t have done with TFS or SVN:

  • Merged a release branch that we had been working on for a few weeks back into the trunk… in just a few seconds
  • Reverted a few selected files from a previous commit
  • Screwed up a big merge… and then reverted it so that I was back where I was before the merge… in about 1 second (git reflog)
  • Switched my code back to a release that we made 3 weeks ago… again, with virtually no waiting
  • Accidentally deleted a local branch that I had committed to the trunk… and then undid the delete and got the whole branch back (with all of the commits still intact) (git reflog, again)
  • Changed the commit message of something I had already committed (git commit –amend)
  • Pulled a single commit from the middle of another branch into the current branch (git cherry-pick)
  • Squished two commits that I had in a local branch into one commit (with a new commit message) before I merged it into the trunk (git rebase -i)
  • View the commit tree (with all branches and merges displayed graphically) (gitk, gitg, gitx, etc.)
  • Pull a commit from another repository into my repository, showing me as the committer but the original developer as the author (github pull requests)
  • Renamed files and directories… and git figured out on its own that I had done the rename and recorded it as such

I know some people are scared of Git because they don’t want to have to learn something new and confusing. The reason that I say that Git is low-hanging fruit is that it’s not that hard to learn (after all, it’s just a source control system, right?). If you want do the things that you do daily with TFS or SVN, all you’re really doing it checking in, checking out, looking at commit history, reverting commits, and maybe branching and merging. Those things are easy to learn, and then you can learn the advanced tricks that let you do the really awesome stuff.

Git will also change the way you work because now you can do things that you couldn’t easily do before. The biggest benefit of Git for me is that branching and merging is very easy and switching between or merging branches is almost instantaneous. As a result, I create a branch for every new feature that I work on, or every time that I want to try something that I’m not sure is going to work. I could never do this before because branching and merging was too slow and I didn’t completely trust that it wouldn’t become a merge nightmare. Also, if you’re using TFS, creating a branch means it has to copy the entire source tree into a new folder (as you could imagine, this takes awhile). Now that I can create a branch instantaneously or switch between branches very quickly, there’s no reason not to create one. So when someone comes over and wants me to try something on my machine, I can switch from the feature branch I was working on back to the trunk, do what I need to do, and then switch back to what I was working on.

Also, because I can have a local branch, I check in all the time. Then when I’m ready to go merge it into the trunk, I can squish and alter all of the commits to have nicer commit messages, combine ones that don’t need to be separate commits, and make it nice and clean. I kept it nice and clean in TFS and SVN too, but if I wanted to do that I couldn’t check in as often. I don’t like when my source control system prevents me from doing what I want to do.

If you still had an excuse, you have even less of an excuse because EdgeCase has an awesome Git tutorial up at http://gitimmersion.com. It’s broken up into a bunch of short, easy to read pages so that it’s not overwhelming, and you can look in the table of contents to go directly to something that you’re interested in.

Oh, by the way, Git is free. Setting it up is as easy as getting an account on a site like Github or Unfuddle (OK, those aren’t free if you want to have private repositories with multiple committers) or setting up a folder share on Windows. Can’t say the same for TFS.

Again, if you’re skeptical, I encourage you to invest an hour going through the Git Immersion tutorial and see what you think. I can’t think of anything else that will give you so much benefit for so little investment.

If you’re at a place when you don’t have a say in which source control system to you use, check out git-svn or git-tfs.

Done anything else awesome with Git that I didn’t touch on? Please leave a comment!