At the website of the excellent Pragmatic Programmers publisher website I came across a book that’s called Practices of an Agile Developer. The book seems to be very good, not only for newbies, but also for experienced programmers in order to get insight and knowledge of good development practices and coding habits. There is a try-for-yourself chapter online with the weight of not less than 27 pages. It is about coding and debugging and I highly suggest the reading of it.

I’ll point out one of the things mentioned there: it’s a good habit in object-orientated programming to design your objects in a way that they are somehow independent from other objects. Each should only influence things inside itself, not in the other objects. Other tasks should be submitted by communicating with the other objects.

“Tell, don’t ask. Don’t take on another object’s or component’s job. Tell it what to do, and stick to your own job.”

There’s the example of the paperboy, who delivers paper and then turns around the receiver (you) to get your wallet out of your pocket, in order to take the money for the paper. That’s the unwanted way. We want objects, that clearly do for what they are intended for and nothing more. So in this case, the paperboy should deliver the paper and ask for money. The rest is up to you. If you want paper, you have to do specific tasks on yourself and once again communicate with your own objects. There’s much more like this, so best directly start reading.

Research and Theory - Date published: December 19, 2007 | Comments Off

Readers left no comments, be the first one to do so!

Comments are closed.