The use of ‘class’ for things that should be simple free functions (2020)
I once, a long time ago, had a similar argument (somewhere online) with a bunch of Java coders. I asked them to create a library for solving quadratic equations. Asking to create a library itself was a trap of course.<p>Everybody came up with some solver classes in Java, some stateful, some stateless. One guy presented the most monstrous solution with 100+ lines of code where you could individually assign the coefficients, individually modify them, trigger recalculation, get the number of roots, get the roots. That guy was very proud of what he did.<p>Oh, I found bugs in his code. But that was considered normal. People make mistakes, right?<p>I showed them a two-line solution with a single function (where you&#x27;d try hard to make a mistake) and nobody liked it. I was ridiculed right there, for not solving the problem &quot;properly&quot;.<p>It struck me how someone can overengineer a solution to the simplest problem <i>and be proud of it</i>. I thought at the time this industry is screwed if this is the norm.<p>In fact probably some 90% of so called library code on GitHub is overenginnered crap. 90% is arbitrary but from my experience every time I look for some solution let&#x27;s say for some GUI effect on iOS, find a library or a framework, take the source, analyze it, start simplifying it and I end up with a version that is orders of magnitude shorter and can be just copied into my project it&#x27;s so trivial.<p>You realize that it was so trivial that there was no need for a library in the first place.<p>I liked the post about minimaism the other day here on HN [1]. It still amazes me how minimalism is not the norm, is not taught as <i>the only way</i> you should solve problems in software engineering. There&#x27;s no &quot;proper&quot; way other than the most minimalist one, period.<p>However, minimalism requires some extra effort to achieve, and that&#x27;s the whole point of engineering.<p>[1] The post was about minimalism in programming languages, but the author had another, more general post: <a href="https:&#x2F;&#x2F;pointersgonewild.com&#x2F;2018&#x2F;02&#x2F;18&#x2F;minimalism-in-programming&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pointersgonewild.com&#x2F;2018&#x2F;02&#x2F;18&#x2F;minimalism-in-progra...</a><p>Edit: mandatory favorite essay: <a href="http:&#x2F;&#x2F;www.paulgraham.com&#x2F;power.html" rel="nofollow">http:&#x2F;&#x2F;www.paulgraham.com&#x2F;power.html</a>