Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are better ways as given in Robert C Martin's excellent book, Clean Code. He constantly refers to code taken from the Fitnesse repo and shows how the code looked before and after refactoring and testing.

I do agree with the sentiment that real world code examples are more useful. When I was learning design patterns during my degree, we were actively discouraged from using Head First as THE reference even though it did simplify things. Our lecturer was later challenged on this view. He then took the students on a counter challenge to refactor and redesign code from real world examples (taken from students' projects). Reality hit quite hard for a lot of us as we struggled to see the patterns in less obvious situations.

An interesting point to note however, was that after gaining an understanding of the design patterns at a practical level, I could then reference simple examples as given in Head First and immediately formulate how I would use it to solve a practical scenario that I might have been stuck with. Funny how it worked one way but not the other.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: