Object Happiness

Iv just been making my way though The archives  of  Codding Horror by Jeff Atwood as I often do. Its one of those good places where you can learn how to program, and think about why your writing that code that way, rather than just how to write java/C/Php…..

In one of his articles he mentions a concept called object happiness. I would like to take this opportunity to say this;

Hi my name is Gwilym and im Object Happy.

Worse I am design happy, the first thing I do when I get my greasy little fingers on a new coding project is this, I design the hell out of it. Im always leaning about new ways of coding and there will be a dozen things I want to try out. I will stand in front of my white board and be thinking “yes, yes we can have a singleton here, ar yes my precious oh and we can abstract this out to here, oh my and we can can use an interface to link these together”. The result of this is that I waste coding time because, the design will now be so reusable, robust and readable that it will need about an extra 50% more code than if I had sat down and just bashed the thing out. I know this because I have seen may other peoples solutions to the same problems were they have just coded it, any they nearly all work close to or just aswell as mine, we both get 1st’s and all I get for the extra week of coding I put in is a nice comment from the Lecturer who marked it.

Rimmer: Look, I’ve got my engineering re-sit on Monday; I don’t know anything. Where’s my revision timetable?
Lister: Wait, is this the thing in a- in all different colours, with all the subjects divided into study periods and rest periods and self-testin’ times?
Rimmer: It took me seven weeks to make it. I’ve got to cram my whole revision into one night.
Lister: Hang on, this the thing with a note on it, in red, said, “Vital, valuable, urgent! Do not touch on pain of death!”?
Rimmer: Yes!
Lister: I threw it away.

Red Dwarf

This has no good points-
Make sure you don’t spend stupid amounts of time on your design, and leave you self no time to implement
Make sure you design is worth something, otherwise you work will just be thrown away.

Having thought about this I would say this-

Find a percentage call it x make it sane about 10-20% when you design something make sure that all the exciting things you thought of, never add more than this the total size/ workload of your project.

For anything that you could code in a day , design it as you go along or you will be there for a week.

If you have to design it badly, code it, hand it in. Then if you really want to you can always go back and have quite little refactor by your self until your soul is once again happy.

But most of all remember as I try to we are programmer not designers so CODE,  design is something to help you do that, but it overall less inportant than code

2 comments

  • Great post, and in certain circumstances, I absolutely agree. Some of my most successful projects, have been done in the “bang it out” fashion (I built a CMS in two weeks that sold a significant number of copies at $150 a pop, for example) – but I think it really only works when you’re working by yourself.

    Banging something out that only you’re going to work on is fine, as you will know it inside out and it’ll flow in a way that makes sense to you. The problem comes the second I come along and need to modify that code, and I find that you’ve written one method that’s 400 lines long and the only comments it has are “Step 1”, “Step 2” and so on. At that point, I’ll curse you, your family and everyone you know for having failed to design a proper system.

    Also, if someone else has given you the work to do, the bare minimum you can get away with design wise is to think about all the possible problems you’ll need to solve. We often have projects here that overrun from a one day estimate to two weeks, simply because the developer will follow the brief to the letter and not think and use their previous experience to say, hold on… that’s not going to work, or that’s not how people are going to expect this to work.

    Our most successful project to date was a £40k client project that I managed, that was thought about in depth in advance. It was one where I was strict about standards, structure and application design throughout the whole process. It was delivered early, with more features than requested.

    I guess that’s a whole different subject to uni work, though, just thought you might appreciate the alternative viewpoint on it.

    • It is good to get an alternative view point, and I thin you actually capure what I was trying to put across not that design is bad but that Over design is bad, when im sitting down to code a uni project hats not worth even 10% of a module I should be putting in nowhere near as much design time as when you code you 40k project, but for some people like me it is far to tempting to do so.

Leave a Reply

Your email address will not be published. Required fields are marked *