Saturday, July 24, 2004

Where did my code go?

A few weeks ago, I was teaching a bit of modern OO design to a fellow programmer (a bit of UML, design patterns, code smells, refactor, etc), who is one of the best programmers I've ever knew (he coded so many things other people named "impossible" that one has to respect that). For a series of reasons, he never really did a whole OO design, and he needed to design this big system, with around 50 classes. One of the difficulties was that he was having a bad time, trying to understand where all the code he was originally planning to do gone. All those huge methods he was planning to do had simply disappeared! Now, he basically had a few, very small methods (the biggest was around 10 or 20 lines of code), and the logic was scattered all over the place! He could clearly see that the design was right, and that the final code would probably work, but he was with that constant feeling that "we left something out of this", "the code can't be that simple", and so on.
And why I am talking about all of this? I'm reading Fowler's "Refactoring: Improving Design of Existing Code", and here is something I'd like to quote:
The object programs that live best and longest are those with short methods. Programmers new to objects often feel that no computation ever takes place, that object programs are endless sequences of delegation. When you have lived with such a program for a few years, however, you learn just how valuable all those little methods are. - Martin Fowler

Well, at least is nice to see that other people experience the same things.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?