Wednesday, March 02, 2016

Codebases for the masses

I am unhappy with the state of software these days. All the code I worked on professionally is not meant to be read by mortals. It is totally detached from both human and machine.

I believe the computer programs should be written in a way that even a person with no formal education in programming should be able to read and at least partially understand them. Using only a text editor and some means to navigate and search through files. The program flow should always be visible, expressed in easy to follow steps. The data transformed by the program should be laid out plainly, its form and size easily recognized by compiler, machine, and human. The program should have a clear entry point, clear work loop and exit/cleanup sequence. A program should receive input data, transform it, and present it back to the user in some logical way.

But we no longer work with "text editors", "source code files", "program flow", "data input/output", "program entry points" or even "functions" or "loops". All these are obliterated by "IDEs", "classes", "containers", "objects", the list goes on. Software today is not simply written in a programming language as means to communicate it to both human and machine. It is "engineered" into "design patterns", then split into illogical abstract units called "classes". Classes materialize into "objects", that receive input data at birth, then keep living and give fruit by... self-mutation. These beasts often refer other "objects" and are ultimately kept in omnipotent "controller" or "manager" god objects. There is no way for a person armed with just a text editor and a file manager to navigate through this programming mess. There is no way to guess the actual flow of the program, unless you run it (often through a debugger). Reading modern codebases is no different than reading a book whose chapters read as tiny books of their own, with the small catch that they refer other (unrelated?) chapters. There is no start of this book, there is no clear middle or end part neither.

Write your programs so I can read them. Why not write them so your non-programming friends can read them. Thanks!

No comments: