2016-01-01 - Code Crafting Codex
At the very core of programming, there is an obvious need for a divide and conquer strategy. And that is at the personal level of reflexion. Of course it happens to be true in other domains.
This idea is also expressed as Separation of Concerns which wikipedia nails its value in the following wishful paragraph without mentioning its evil extrema:
The value of separation of concerns is simplifying development and maintenance of computer programs. When concerns are well separated, individual sections can be developed and updated independently. Of special value is the ability to later improve or modify one section of code without having to know the details of other sections, and without having to make corresponding changes to those sections.
Otherwise said two components satisfy “separation of concerns” if their implementation details don't leak.
Drawing lines is not easy, especially when you consider the infinite entangledments of human understandings.
I think that Zen of Python by Tim Peters provides useful abstract guiding principles:
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one -- and preferably only one -- obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Those quotes are also helpful:
Simple things should be simple, complex things should be possible
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
Antoine de Saint-Exupery
To design something really well, you have to get it. You have to really grok what it's all about. It takes a passionate commitment to really thoroughly understand something, chew it up, not just quickly swallow it. Most people don't take the time to do that.
Programs are meant to be read by humans and only incidentally for computers to execute
The following quote must be studied in the light of broad sens that can take the word before the last:
There are only two hard things in Computer Science: cache invalidation and naming things.
And this one provides more food for thought:
The Internet was done so well that most people think of it as a natural resource like the Pacific Ocean, rather than something that was man-made. When was the last time a technology with a scale like that was so error-free? The Web, in comparison, is a joke. The Web was done by amateurs.
If sounds, grounds, ideas and understandings are echoing, don't overestimate their infinite reflection that might be aiming an unforeseen dubious equilibrium, find you way out, escape the invisible tie knot, think on your own.