lp0 on fire

My personal blog

Rant: Fanatical programming

I'm a mostly self-taught programmer, I like concise code: as simple, minimalistic and direct, modular, performant, portable, zero or very low dependency on external code or libraries. I like solving problems and thinking of ways to improve, to program the way in the unix philosophy, to find solutions of my own and get creative. Programming is a form of art after all.

Most of this was lost with the advent of frameworks, package repositories, design patterns and object-oriented principles, unit tests, everything under "the modern way" and "best practices". Scratch that, include anything related to enterprise programming standards. None of these are bad per-se, but they became bad ideas because for some reason people are very fanatical about them.

An example

"Program to an interface, not the implementation" is a good one. The idea itself isn't bad at all, but only on small scale where you know you'll have to replace systems later on. Interfaces do have a hidden cost that no one considers because they do not know the inner workings of a language. It's stupid to bind everything to an interface, because now you don't only have double the work to maintain but now your whole application is littered with function pointer tables. Dependency Injection frameworks to me make little sense for this reason, the cost and complexity is too high for the gain.

Unit testing

Another one is unit testing. The idea itself is great; you can make sure exceptional circumstances are tested well. But to force your full application (every single function) to be tested this way? That's a waste of everyone's time. Unit tests are not a specification for your program to follow. Otherwise people will just focus on passing a test that could be wrong because the specification is wrong. That doesn't solve your program not working as intended or being slow.

Package manager

Then there is frameworks, often employed in combination of a package manager because frameworks these days are build out of hundereds of tiny packages. That's hundereds of possible vunerabilities as Mend reported over 1300 malicious packages being hosted on npm (node package manager), and the recent discoveries show how devastating it can be like with log4j in Java which was a "best pratice" to use.

In addition, if the package manager service is down you can no longer obtain these packages unless their source code is hosted somewhere else.

So far I've yet to find a real good use case for a package manager. They are there for convenience and control (of the platform). For C/C++ I just search online for the library I need and use it. This has worked for many years, so why doesn't it work anymore? I can't see why.

Frameworks

There are valid use-cases for frameworks, like for things that truly are too big to be understood by one person. A game engine and scientific frameworks are a very good example of this. Those are there out of necessity, not out of convenience. I'll specifically be adressing convenience frameworks here (eg most javascript frameworks out there like express, vue and react).

These are usually bloated in functionality you rarely ever gotta use to it's full extend but still pay the price for. It's written in a generic fashion so you can be sure it's not optimized to your use-case. The worst part is that most people don't read nor understand the inner workings of the framework's code. They rely on others telling them that everything is alright and assume the framework doesn't change.

That to me sounds like a huge security concern, creates dependency that didn't need to be there and it bred a group of programmers that can no longer write code without one nor understand what their code does exactly.

Some programmers argue that "if the framework broke then it's broken for everyone else too and thus the problem of the framework maintainer, not me" but this is not the case. If a business runs on that framework that breaks, now you have to deal with the customers and lose money over it. Worst of all, it didn't have to be this way if you rolled your own code instead.