George Mauer is on the Net

Screencast: Keeping Features Out Your Way With Branching

Pop quiz:  What’s the software developer’s biggest enemy?  It’s not marketing.  It’s not those snot-nosed DBAs.  The rigid chair that will invariably give you arthritis?  Nah.  Your know-nothing boss?  Not even close.  No, the developer’s biggest enemy is the customer.

That’s right customers and their god d*mn feature requests and bug reports!  Life would be so much easier without them.  And acknowledging the absurdity of that statement, unless you are some kind of programmer Adonis (which unlike a regular Adonis physically implies only that your esophagus is invulnerable to lesions caused by Bawls) and write flawless code you will have to deal with feature requests that can rapidly pile up and overwhelm your development process.

I had mentioned previously on this blog that I am working with a team of Indian contractors and this is exactly what they found happening with the latest high stakes omg-fix-this-now-or-we-all-die release.  The team was behind and the release went out mere minutes before users started working with it.  Of course in the rush to finish on time bugs cropped up and features were left out.  Lots of features.

So immediately the next morning, with tickets raining down and demands for new drops every day the team got to work.  And the daily releases never came.  On the 3rd day we finally dived into their process with them to identify the problem.  

Simply speaking, they couldn’t reach a stopping point.  By the time certain features were ready to go others were half-implemented and so no release could be scheduled.  It was like some sort of real life Zeno’s paradox.  Fortunately this one has a solution.  Fully acknowledging that it is probably named differently in a dozen books and Agile pamphlets (just not any that I’ve seen), I call it branch-per-release or “how to use source control to get yourself out of a tight spot”. 

The idea is blatantly simple:

  1. Chose a release date
  2. Decide which features will fit in that release date
  3. Use your source control chops to create a branch for that release
  4. Decide what release each of the features on your plate goes in
  5. Create a branch for each of those releases
  6. Implement each feature set in the branch for its release
  7. When development on a branch is completed and tested, reintegrate into trunk.
  8. Rinse, repeate.

I have created a presentation and a series of screencasts (3 x 5 minutes thank you Jing) to demonstrate the process.  And here they all are:

Apparently embedding videos on is a pain in the *ss (as is code highlighting) so as mere links they must stay.

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

June 4, 2009 Posted by | ALT.Net, Programming | Leave a comment

The GoGaRuConf Pr0n Affair Rhinos vs Rabbits and A Challenge

Well I don’t have many (any?) readers so I’m not going to go into depth linking and summarizing something that is

Gotta have at least one picture of a Rhino

Gotta have at least one picture of a Rhino

 handled in a million different places probably best on Martin Fowler’s blog (is the terminology blog correct here? Bible? Holy Testament?).


Super short version: Ruby on Rails prides itself on being an edgy community; at a conference, a slide deck contained a prolonged analogy between a technology and porn; people got offended.  There, that hits all the high notes.  I posted my thoughts as a comment on the hanselblog but then thought hey, I really haven’t updated my own blog in a while and I actually have (what I think is) an original insight on this so here we go.

For the record, I am mostly with Martin Fowler and others who urge professionalism and think the presntation was in poor taste to begin with (as in a cheap use of a lame analogy) but I think that I have something else to add to the discussion.

Let me start with this, I am notoriously thick skinned.  Really.  Like a Rhino (see sidebar for gratuitous picture of a Rhino).  You would have to know me quite well to understand how deep it goes but suffice to say that it is a product of my life philosophy and I do not remember the last time I was truly offended.  That being said, I am hopefully not a jerk and do not expect others to hold to the same standard.  However, because I cannot use myself as a guage I have had immense difficulty walking the line between offensiveness and expressiveness.  This is something that I have been actively working on for years, and I would like to think with results (I somehow swindled a lovely girl into an engagement even).  Hence my keen interest in this current discussion of appropriateness.

All conversation of gender roles, stereotypes, and feelings aside I think the argument of really boils down to this:  

  1.  The more edgy/expressive/offensive you get the more thin-skinned people you will exclude.  
  2. If a community allows offensive behavior repeatedly then the offended parties will be excluded from that community.  
  3. Why in the world would a tech movement want to exclude people – many brilliant people even – solely on these grounds?

Logically, this argument is a check-mate.  You want your ideas to be inclusive?  Then you must work to be inclusive as well.

But there is a caveat.  Many things are offensive; why would thin-skinned people want to spend their lives in an offended state?  Seriously, a lot of this stuff is actually pretty funny, we’d for love you to join in.   

So here’s the proposal, how about we BOTH work on this?  Yes that means you rabbits as well as us rhinos.  I will continue learning about sensitivity, about people’s feelings, about why I shouldn’t use the N-word even though I think its constant use would strip it of its power, and all the other social norms.  I won’t compromise my expressiveness, but I will try to consciously and responsibly make an decision of who I will offend.  You in the meantime should watch George Carlin and Bill Hicks, try to see what’s funny about Family Guy, and maybe even occasionally read SomethingAwful all with an open mind.  You must try to see humor on its own terms and to distinguish an bad person from a crass one.  You should do this seriously and with commitment.

The thing is that many people will probably take even this suggestion as offensive in itself, that I am suggesting people with “refined social standards” need to change as well as us juvenile bozos.  Here your own argument for sensitivity stands against you.   You must realize that for many people being sensitive to your feelings is f*ing difficult.  Like really really really hard.  I know that checking my speech almost always leaves a bad taste in my mouth that I have to then obsess over for hours afterwards. And if you still don’t care then F you.

I don’t have a crescendo of an ending planned so let me just state that I did indeed learn some things from this whole affair and am quite happy at the ideas that it has brought to the forefront.  I doubt that someone will seriously take me up on my challenge and I will continue down my own path of social learning regardless but if you’re really going to be intellectually honest you can hopefully admit that I have a point.  And then tag, you’re it.

May 1, 2009 Posted by | Other, Programming | 8 Comments

Of Cavemen Jeff Atwood and SOLID

Jeff Jeff Jeff,

Reading your blog has always been a bit like programmer masturbation, it mostly serves to make the reader feel great about what an inquisitive and intellectual developer they are.  That’s ok though, it keeps people reading and just through the sheer volume and accessibility of your writing you’ve pounded into people’s skulls some extremely useful ideas, frequently without them even realizing it.

Heck, it was you that got me into reading programming blogs (tip of the hat to Steve Yegge as well) and that is precisely why this whole tiff with Uncle Bob is just silly and your latest defense the lamest of all.  You reach far more people than Uncle Bob does, you acknowledge that the SOLID principles are good ones, you say that the problem is with capturing the ear of the uninformed – and then you put them down?  Give me a break!

I don’t have time to rant at length like others have but consider this:

Captain Caveman!

You know who were really the original unreachables?  Cavemen.  Completely in isolation from each other they decided it a hassle constantly having to seek out rock outcropping roofs and moss mattresses and all on their own they started piling rocks on each other to make houses.

Sure when the Assyrians invented the arch the Egyptian and Aztec builders didn’t hear about it, but eventually the Romans came along and in that very Roman way searched out the best ideas and decided to apply them to their own projects.  Good thing the Assyrians didn’t have bloggers.  They might have declared the arch unfit for popularization due to the infeasability of their marketing.

We’re at the very beginning of this stuff, lets encourage the good ideas, no matter who is listening.

Update: InfoQ has a roundup of the whole debacle.

February 16, 2009 Posted by | ALT.Net, Programming | Leave a comment

Error Handling and the Message Repackaging Anti-Pattern

I currently have an interesting responsibility at work.  I am functioning as the manager and single-point-of-contact for a team in India working on imporving the codebase for one of our more important ASP.Net sites.  I know what you’re thinkin.  Did I say interesting?  I meant infuriating.  At the very least I should get a good “Lessons Learned” post out of this.

Overall the experience hasn’t been too bad though.  I’ve been managing to maintain a decent rapport with their project manager and team lead, deadlines have been missed, but no more than I secretly expected, and overall they seem like fairly competent guys.  Their work isn’t innovative, Agile, testable, or well factored, but its decent enough.

Except for the exceptions.

Browsing one of their recent commits to our SVN lately (ok, so technically speaking they couldn’t figure out Subversion so they ftp-ed and I did the commit for them) I was shocked to discover the following error-handling anti-pattern repeated 41 times!

try {
  // Do Stuff
catch(Exception ex) {
  throw new Exception(ex.Message);

Do I get to name it?  Let’s call it the message repackaging anti-pattern.  And in case you’re not already reeling from this, the following is a mildly edited-down version of the letter I sent (Notice the eschewed profanity.  I believe a not insignificant achievement.)

Dear Team,

While looking through some of your committed code I noticed quite a few (a quick search shows 41) places where you have code of the following form.
try {
 // ...
catch(Exception ex) {
 throw new Exception(ex.Message);
Let me be absolutely clear: This is the worst possible way of handling exceptions!
Let’s go over why:
  1. Not doing anything inside the exception. If nothing happens within the catch block then what purpose does it serve? I have seen people prepare their code like this in anticipation of going back and adding logging at some later date. Although this is not necessarily the best logging solution, it is acceptable when you actually implement the code! However, preparing your method like this in anticipation of some future date does nothing but make the code difficult to read. It’s not like it is that hard to go back later and add a try…catch block; if you’re using a refactoring tool like CodeRush it is literally four keystrokes. 
  2. Catching the base Exception. Not every exception can have something be done about it. The canonical example is an OutOfMemoryException or one implying the database might be down. Is there anything to do in this case other than drop the user to an error page? I would even go so far as to say that most exceptions fall in this category – you just can’t do anything about them.  I strongly encourage you to read Stop Catching Exceptions for a more in depth discussion.
  3. Treating the message as if it were the most important thing. Exceptions usually carry a heck of a lot more information than just their message. They carry their type and a StackTrace and a list of any inner exceptions. Many specializations of the Exception base have even more information specific to that type of error. Out of all that information, the message is arguably the least important – for debugging I would take a StackTrace over a message any day. But by creating an exception off of the message you are effectively stripping out all this useful stuff! If for some reason, you must create a new exception, at least use the constructor overload that includes the original error as an InnerException: new Exception(“I don’t know why I’m creating this”, ex);
  4. Why create a new Exception object at all? You already have a perfectly valid exception object. It is a simple matter to do:
    try {
     // ...
    catch(Exception ex) {
     // Log or otherwise handle the exception
     throw; // Same as throw ex;
So in conclusion
  • Don’t catch an exception if you aren’t going to do anything with it.
  • Try to catch exceptions at the appropriate level and for the appropriate task. (logging inside private methods is probably unnecessary)
  • Do not create a new exception, throw the old one.
Please take this as healthy constructive criticism. I hope that you agree with me on these points and that we can take care of this issue properly from now on.


A bit harsh perhaps, but I feel like for all the reasons above the immensity of this mistake cannot be overstated.  If you are doing this in your code STOP NOW and apologize to the maintenance gods!  You might even need to sacrifice a goat to appease them.  It’s that bad.

In any case, the recent commit has only 38 instances of this error.  So at least we’re getting better!

January 16, 2009 Posted by | Programming | , , , | 2 Comments

Re: What is Unit Testing?

In a post last month Zachariah Young posts that 

… unit tests … verify that the business logic is correct.  I believe that for it to be unit testing it has to use a testing framework like nunit or junit.

I say thar be dragons!  Tying your understanding of unit testing to a specific tool allows you to neatly sidestep thinking about whatThar be dragons  testing actually does.  Additionally, you deny credit to an excellent tool like NUnit by pigeonholing its purpose.

Consider for a minute what NUnit actually is.  Yes their own website claims that they are specifically a “unit testing framework for all” but what does it actually do?  In my opinion it is a framework for setting up an application’s state, executing code, and then asserting that the resulting state is as you expected. That’s pretty broad.  Way broader than the confines of mere unit testing.  

Take the excellent WatiN or (no longer maintained) NUnitASP tools.  Both can be run using NUnit but neither is used to build a true unit test.  WatiN for example remote controls your browser to investigate how your page will react to certain stiumuli.  What unit does WatiN test?  Your Page_Load method?  Your page renderer?  Whether the viewstate persists that you had entered some text halfway up the page before submitting and the text is not cleared when your page returns with a validation error?  The localhost routing mechanism on your PC?  Or does it test the integration of all of these?

I made the same exact mistake myself when I decided to ‘see what this TDD thing’ is all about last April.  I ultimately had to delete my entire testing project after I came to the realization that each test bit off far too large a chunk making it utterly impossible to maintain once true refactoring started.  I nearly cried that day.

But out of the ashes I was reborn with what I hope (but don’t really expect) to be the final zen-like understanding of this unit testing thing.  The first aha moment was when I finally caved in and decided to learn Rhino Mocks and my understanding sharpened when I caved again and looked into the new Rhino Mocks 3.5 AAA syntax.  Overall the lesson seems to be that I’m always wrong and I will eventually give in on everything and like it.  My girlfriend will be happy to hear that.

Let me tell you how I understand unit testing now.  Imagine a room.  You are standing on the outside and can comunicate with its ouccupants through a two way loudspeaker.  This room is your unit – if it helps you can imagine the room as painted black.  Now in testing you present your unit with a problem:

Given that you are on 735 Bourbon St New Orleans, Louisiana how far is it to my grandmother’s house?

I used to think that unit testing involved merely waiting for the answer:

Your grandmother’s house is 1345 miles away and you haven’t visited in months you shmuck.

Now I realize its more about everything else that is said.  “Where does your grandmother live?” and “Can you be so kind as to  slip an atlas under the door?” should definitely be questions that you hear over that loudspeaker.  If you’ve separated your resposibilities properly the unit will also require a calculator that given two points on a map can tell you the distance (the specific calculator implementation should depend on whether you intend to fly or use the highway system).  The unit might even request that you hang a EnRouteToGrandmas = true sign on the door.  

The point is that you’re not so concerned with the final answer as much as you are with the unit asking the right questions.  Afterall, without that information know that it could not possibly be doing what you mean for it to do!

And so I define unit testing as

Verifying that given an input, a piece of code makes all the external requests that you would expect where the unit is small enough that the number of these can be enumerated with ease.

Note that this definition does not necessitate automated testing and this is something that I again think is basically correct.  After all, a framework should not do anything that you cannot do for yourself.

The beautiful part is if you’re limiting the amount of requests that you’re going to expect – let’s say no more than four – single responsibility emerges almost all on its own.  After all, how much can a piece of code do if its not communicating with the external world?

So there you go, thats my understanding of unit testing.  I look forward to being proven wrong in the future and having to refactor everything all over again.  But until that time,  Zachariah, you’ve been blogo-served!

Disclaimer:  I do not know Zachariah personally but he seems like a smart guy that is highly involved in the ALT.Net community.  I do not purport to be more knowledgeable than him in programming issues, I just disagree with him on this one point.

kick it on

January 15, 2009 Posted by | ALT.Net, Programming | , , | Leave a comment

Links For Motivated Programmers

Aggregation Sites




August 7, 2008 Posted by | Programming | Leave a comment

Stephen Bohlen Is My Savior

One of the tools that I’ve set out to learn in my quest to become a better developer is Alt.NET’s baby NHibernate.  Unfortunately, being my company’s sole developer, my manager has alotted me roughly “go fuck yourself” hours for learning this mountain of an API.  I’ve tried reading through articles on Codebetter and Codeproject, only to find articles discussing very different and nuanced things.  No step-by-step tutorial.  I’ve tried sic-ing Intern Justen on the monster only to have him thwarted by anything more complicated than a simple get and save object.  I need a very through walk through.

Enter Stephen Bolen who has created a series of beautiful screencasts called Summer of NHibernate (available on his blog) in which he builds projects from the ground up.  Not only does it show me exactly how to create, configure, and test an NHibernate project but it also is great for a poor directionless aspiring star like myself to see how a real pro structures his project, his naming schemes, and his general style.  Kudos Stephen, here’s hoping this post gives you a well deserved PageRank boost.

June 30, 2008 Posted by | Programming | Leave a comment

Oooh! I Wrote Something for Upper Management

Today I was asked to write up a short justification for a rewrite of a godawful piece of software that I have been complaining about to anyone who would listen.  Yay!  Inspired by essays I have been reading by Jim Shore I might have been a bit too agressive.  But here’s the final(?) version:

Proposal for a Rewrite of the {Program Name} Software
The purpose of software is to make our lives easier; it is a tool like a hammer or a screwdriver and far more malleable than either. This is generally a good thing as it allows us to mold it to our specific needs and particular processes. If software is a screwdriver meant to do screwdriver-type activities it should be with a minimal amount of effort that we can get it to work on a phillips or a flat-head screw. Unfortunately even screwdrivers can be poorly made, their handles can disintegrate as we apply too much torque, they can be made to poor standards so they don’t grip the screw quite right and slip frequently, and they can be made out of cheap material so that any attempts to remedy the above only compounds the problems as the shaft bends and warps in unexpected ways. Without taking the metaphor any further, it is my professional opinion that – external appearances aside – our current {Program Name} Software is this sort of unwieldy tool and in need of an urgent re-working.
Current Problems and Future Implications
The current implementation of our {Program Name} software has a multitude of problems. First and foremost, it seems to have been created as a prototype rather than a lasting project. As such, it is not meant to be extended to work in the ways that we need it to work. It is also not possible to use it with automated testing software to check the various contingencies we need it to work under and to ensure that future features do not break already existing ones. Without the ability to write automated self-tests, keeping the system operating across the conditions at the various terminals and feed company locations will continue to become more and more of a burden that will continue depleting our already low development time.
Furthermore, under the current system, when a bug is encountered, it is notoriously difficult to troubleshoot. For a problem at a site, our only recourse is to attempt to recreate it by simulating the conditions from user testimony. This is a painstaking and highly uncertain process. Take as example the multitudes of issues caused by poor network connectivity. The current system has no plan for dealing with short-term outages which, while inexistent when the software is developed in-house, are ever-present in the field. As such, it frequently ends up acting in bizarre ways that get reported infrequently and incompletely. Under these conditions they can be nearly impossible to repair. The software was simply not produced with the idea that it would require in-the-field maintenance and diagnosis; although expedient attempts to remedy this situation have been made, deep architectural flaws severely limit their possibilities.
The bottom line is that behind-the-scenes the {Program Name} is poorly designed and implemented. Much of the inner-workings are extremely confusing and no attempt has been made to consistently use established industry or even the developer’s own standards. There is no documentation anywhere. The problems are deep-rooted enough to need to be addressed immediately. In saying this I want to make it absolutely clear that in my opinion our difficulties arise not from the inescapable need to add features, but from the fact that the scope of the initial design completely omitted considerations of clarity, extensibility and in-the-field testing.
Proposed Changes
I propose a complete redesign of the {Program Name} system with an emphasis on the creation of a system that is simple, easy to maintain, extend, and troubleshoot. We will of course address all of our current needs but we will use established techniques to create software that works well with a model of continuous development. The new system would also be designed to streamline troubleshooting and include automatic self-testing to ensure that it is shipped out with as few bugs as possible. We will achieve this by sticking close to C# .NET best practices making the application truly object oriented, using Agile planning techniques and test-driven development, and optionally integrating with a dependency injection framework to ensure extensibility. While the changes experienced on the user side will be minimal, the payoff on the development and maintenance side will be almost immediate. I fully expect development time under a redesigned system to shrink by at least a factor of four, for new deployments to become seamless instead of taking days to configure properly, and for maintenance time to fall from over 5 hours per week to well under one. As a tentative schedule I would propose the following: Half a week of design (much of it has already been done), one to two weeks of implementation and a week of testing. I believe that by working on this project 80-90% of my time I should be able to finish it and have it ready to go in three to four weeks.

Thank You Very Much,
George Mauer
Software Developer

May 5, 2008 Posted by | Programming | , , | 1 Comment

Let’s try to start this nice and simple

So since I registered this blog name I have proven empirically that I am incapable of actually writing to it so I figure I’ll start simple – with a list.  And – because this is what i’ve been reading and thinking of a lot lately – its going to be programming related.  Weeee.   So here we go.

Technologies that I HAVE to learn:

  • NHibernate – The list, podcasts, and .NET blogs have been a buzz about this for so long that its barely even mentioned anymore, but yes, through argument and experience I’ve been convinced, dynamically generated SQL is the way to go.  Time to get a crackin’.
  • MbUnit – Apparently that’s what a lot of the pros use and I want to  be a pro right?  Well, I’ve got the basic [TestFixture] – [Test] – [RowTest] stuff down but guys like Phil Haack have to love it for more than just a few neat features and a nice GUI right?  How about reading the documentation?  Also, what the fuck is Gallilo and how come I can’t get it to run?
  • StructureMap or Castle Project – Inversion of Control / Dependency injection frameworks.  This is what you use if you want an extensible application.  And I do.
  • F# – A couple months ago, I realized that I kinda like programming in Javascript. Apparently, I’m not the only person that thinks so.. I guess it was because I was finally starting to get an understanding of what this functional programming thing is all about. And now that that I know, I like it!
  • And in a similar vein – JQuery. – Yeah, I’ve gotten some practice with this amazing toolbox in working with my personal site and The Roots Of Music and I think there’s something there. I want more, a lot more.
  • Git or Mercurial – Distributed Version Control Systems.  These seem to be the new thing in version control, no pressing need to switch from SVN, but I should start getting familiar with them.  It seems like for the time being, Mercurial is the shiznit.  Not sure if any of them have nice TortoiseSVN-style support though.
  • TypeMock – Commercial mocking software.  Type mocking is really just something that I need to learn about as I’ve run into the limits of non-mocking unit tests already.  I’ve heard this product is good in a few places and they have a good learning section the web-site as well as a free download version.  Could be worth trying it out.  As an alternative, we’ve also got Rhino Mocks which is free.

May 3, 2008 Posted by | Music, Programming | , , , | Leave a comment