Code Craftsmanship
RE: http://hamstaa.hbhau.net/2009/10/22/clean-code-the-devils-in-the-detail/
Beauty is definitely in the eye of the beholder and, indeed, making code elegant is an art form. Software engineers naturally think they define beauty, then implement a process to achieve it every time, and then define a metric to measure how well you’ve achieved it. Engineers argue over whose technique is the best and must be used above all others. Nothing is clear-cut in this game and being rigid is an easy way to fail. There is no one-size-fits-all technique, or we would all be out of jobs.
Writing good code is about representing all of the detail and complexity in a manner that is elegant, efficient, readable and not prone to error. Achieving this is subtle and measuring your achievement is difficult.
It’s isn’t as simple as wrapping tightly in methods, nor is it putting all the detail in one method. It’s not even about just striking a balance between these two ‘extremes’. For starters, that’s just one of many dimensions of measurement, plus it’s not clear cut where on this one particular spectrum is most appropriate for the given problem. You’ve got to use all of your tools, techniques, experience and creativity to create an elegant solution for the problem at hand. You need to always be learning and constantly re-evaluating your beliefs.
Also, Engineers tend to forget that they’re modeling something of a degree of complexity – something that has actual details. That detail needs to reside somewhere. You can’t just say: oh, if I structure it so elegantly all of the complexity will go away – well, it won’t, it’s inherent… and if you think you’ve succeeded, you’ve implemented nothing but glue. It’s a matter of representing the inherent complexity of the problem domain while minimizing the overhead of accidental complexity in the solution domain. Again, not something easily defined or achieved, yet we have to do it day-in day-out, and we have to constantly improve.
We need to realise just how difficult it is to create quality code and stop thinking we have all the answers. I’d like to see fewer rules and more creativity and craftsmanship.
Filed under: Uncategorized | Leave a Comment
No Responses Yet to “Code Craftsmanship”