Borg said:
For the last week, I have been cleaning up code left by a previous programmer who clearly didn't know what the
KISS principle was. I removed over 75 class files that were completely unnecessary and made the code ridiculously difficult for others to trace through. Most of this was code that could have been put in a single method but instead, he would create several interfaces, implementing classes, unnecessary Spring wiring and enums for as few as two potential options - all while mixing front-end and back-end processes such as enums with database implementations embedded. When you got to what was actually doing the work, it was the method that should have been written in the first place without all of the extra fluff. After all, why KISS your code when you can take it out back and violate it completely?
I'm wondering how many programmers have had to deal with this kind of nonsense. Do you run into code left by previous developers where they created stuff that was way more complex than it needed to be? I would be interested to hear your stories.
I've encountered similar issues in the past, with most notable one that I was asked to be almost the whole team(!) for a java mobile system by a small company, when Java Mobile was almost in its infancy and with strict deadlines(!), using a rudimentary code base that had almost to be rewritten all over itself(!). A second case was writing some extension APIs and tools in PHP. The codebase was written by a programmer involved in various projects. The first thing I noticed by some simple inspection, was the complete lack of comments and documentation and a programmer that persistently "was using his right hand to scratch his left ear", as we say in my country. It was not about trying to be more abstract for future proof code. It was just an attempt to retain his position, by effectively prohibiting other programmers to work with his code. The previous programmer in the position that I got was really an excellent one and the only thing he said was that he had told all this I did, but for very strange reasons, regarding company management, to no avail. So, after wearing the hat of the magician for a while and developing some ad hoc rabbits, I was completely convinced not to get involved to such messy things ever again. For me - as for every developer I think that respects him / her self, carefully written code, comments and documentation are not some theoretical concepts needed only when you are at the university. I cannot think of anything better than what
Donald Knuth said about writing code:
“The best programs are written so that computing machines can perform them quickly and so that human beings can understand them clearly. A programmer is ideally an essayist who works with traditional aesthetic and literary forms as well as mathematical concepts, to communicate the way that an algorithm works and to convince a reader that the results will be correct.”
Unfortunately, even in these days there are people that still think that one has to confuse / disallow other people to work on their code.
As for the KISS principle, I think that it's meaning and its application not only means many things to different people but also spans many levels, regarding many factors / parameters and I'm mostly talking about the software development world. For me, its essential meaning is absolutely correct. If someone develops a GUI then this meaning is more easily manifested, for what the user should have to interact with. On the other extreme, it may potentially mean - and it vastly does in practice, a different level of meaning for the development of code for the GUI. Even using libraries / frameworks / template systems, the complexity is there. It's just hiding. As complexity of the requirements for an application, or a software system in general, increases, so does the level of KISS with
Simple getting more complex. But in my opinion KISS is still there, waiting to award the one who finds it. From a different perspective, there is no absolute meaning of KISS among different developers with different skills. It begins like common sense for a small project but as the software grows larger and more complex the gap increases, getting eventually to the question "how simple is simple?". So, putting aside the common sense meaning in some cases, KISS is like an ever expanding tree.