Object-Oriented Design in Ruby – Reading 1. Reusable Code
I started reading the highly-praised ruby book – Practical Object-Oriented Design in Ruby: An Agile Primer. It’s pretty much nicely organized with concise examples. Though I haven’t been able to finish it, I wanted to put some notes on it.
This book repeatedly talks about reusable code as good example. Reusable would mean that each module has clear responsibility and appopriate dependency to other modules. Also, it means stable code, and less required changes on extending the modules.
There’re a lot of metrics to the good coding, but the “reusability” would be a easier concept to think in mind when implementing a module rather than thinking about the coding techniques.
This book uses a simple bicycle topic as coding example. Through the course of the content, it gradually being enhanced. Each time the code is enhanced, it reveals the glitch in the previous implementation, and then tries to refactor it. This process is very helpful understanding the important factors maintaining a code in the actual word, rather than keep posting a ideal solution from the beginning.