DEV Community

Cover image for Why (almost) all production code is garbage
Thomas Hansen
Thomas Hansen

Posted on

Why (almost) all production code is garbage

This is probably my last article in my myth busting series where I tell the raw and unfiltered truth about stuff I've learned during my 40+ years of software development in total, and 25+ years as a professional. The idea is to propose alternative methods to create software, with the objective being to get rid of superstitious belief systems, dogmas, and assumptions, to replace these with stuff that works.

The dirty secret of our industry is that almost all production code is garbage. The reason is complexity and over engineering, combined with Kool Aid marketing, implemented by companies wanting you to chose their stuff, such that they can grow their market share, and earn more money. This is often coupled with lock-in strategies, resulting in that once you've chosen your vendor and technology stack, changing it mid streams requires rewriting everything.

I have a solution to the problem, and it's basically referred to as SHIFT+DELETE refactoring. This is why I chose a photo of myself wearing a t-shirt illustrating the process, albeit in a funny way. If you don't get it, read the text of my t-shirt once more ... ;)

At this point some readers might object and claim that I've got my own company, with our own solutions, implying I've got financial incentives towards having others choosing our stuff, and that the differences between my company and most other companies are small - However, this is simply not correct. Yes, I do have a company, and yes we have financial incentives for you choosing our stuff - But, first of all, we have based our entire value proposition upon simplicity. Secondly, our stuff is in its entirety open source, permissive style. Third of all, our incentives are to have you use our stuff, and pay us money - But in order for that to happen, you must either start a new project, create a new micro service with our stuff, or as I would happily propose in regards to your legacy garbage; Do the SHIFT+DELETE refactoring process.

Hence, our incentives are much better aligned towards your employer's incentives, and your incentives, being (I hope) to deliver high quality products, delivering whatever your employer needs for it to deliver, such that you don't suffer a (nother) nervous breakdown a year down the road, due to having to maintain a mountain of garbage.

Contrary to other companies, we believe in great products telling our story, conveying our message, doing the marketing for us. AKA; Why spend 5 months doing that which you can do in 5 hours?

If we can succeed with the above marketing plan, we will have permanently changed the software development industry, since others will copy our strategy, resulting in an increased amount of innovation the world hasn't collectively seen since Gutenberg.

From a risk assessment point of view of course, this is much more risky than just keep on piling garbage upon garbage, adding more garbage to the world, using Kool Aid marketing strategies, locking in our customers, by delivering (sigh!) yet another message broker or NoSQL database, preferably built with some OOP rubbish methodology, resulting in the world growing further away from its beauty of simplicity, such that we can make money by continuing this "middle of the road garbage strategy".

My bet with the Creator though, is that truth matters, quality wins in the end, and people will somehow enjoy simplicity once given a choice.

I repent, FoxPro was better

My first job as a professional software developer was for a small company with 40 employees. We were delivering ERP systems, and our primary platform was FoxPro. FoxPro was a 4th generation programming language, so easy to use, you could create new software in hours using it. However, it had few if any OO mechanisms, it was naive at its core, and as Kool Aid marketing managers started tempting me with OOP and complexity, I fell for it. I apologise for that ...

FoxPro had "issues"; It was difficult to scale, it couldn't deliver web apps, it was Windows only, etc, etc, etc. However, at its core there was extreme beauty, that allowed its users to deliver in 1 hour what you would need 50 hours to do in C# or C++. Hence, I confess to you.

I modelled Magic after FoxPro!

Magic is to modern web application development what FoxPro was for desktop development 3 decades ago - Minus the Windows lock-in, with the ability to scale, yet keeping true to the "do in 1 hour what you need 50 hours to do in other platforms" philosophy at its core.

Return to innocence

The first program I ever wrote was on an Oric 1 in 1982. I was 8 years old. The program was as follows.

10 PRINT "THOMAS IS COOL"
20 GOTO 10
Enter fullscreen mode Exit fullscreen mode

The simplicity of being able to create software using constructs such as the above, inspired me to becoming a software developer, resulting in a comfortable life for me. My sadness on behalf of today's kids, is that it is impossible for them to reproduce the feeling I had. If a kid today wants to learn software development, he's got to spend 12 months learning OOP, HTML, CSS, C#, and God knows what more before he or she can even reproduce the simple code above in a "modern programming language context". And unless we can fix this problem, society as a whole is at risk. We need paths for our children to more easily learn, the same way we easily taught ourselves what we know. And OOP, Kafka and NoSQL is simply not it!

I want to finish with a video I believe illustrates what I'm trying to achieve. It's arguably got nothing to do with programming, yet still everything to do with programming. I'll let it speak for itself. Thank you for reading ...

Top comments (7)

Collapse
 
thumbone profile image
Bernd Wechner • Edited

Your concern for modern kids is misplaced. The existence of complexity does not require that baby steps aren't available, customary and inspiring with a sense of achievement.

Whether that is literally crawling in a world of runners, riders, drivers, aviators, astronauts...

Or if it's a kid set in front of a term, taught to type "python" and then:

while True: print("Thomas is cool!")
Enter fullscreen mode Exit fullscreen mode

And it remains as true today as it was in the '80s, that computing, like math, like English, is not just an esoteric field of study with its own academic degree and fan club, but also simply a useful skill for all sorts of professionals, notably, but not only, engineers, and scientists. And that latter group is focused on outcomes, efficiently and after any first effort to reread what they did last year, lucidly with maintainability in mind.

Collapse
 
polterguy profile image
Thomas Hansen

I liked your comment. However, simply adding OO to the mix, makes the task of learning software development orders of magnitudes more cognitively challenging.

Collapse
 
thumbone profile image
Bernd Wechner

Really? I mean no need to touch OO for ages when learning Python, but the idea is not complicated, and introduced easily with ideas like Fruit as a class and Orange and Apple and objects ... etc.

Python does open up small nest of complexity by making private members impossible and so the more stuff a class implements in term of attributes (be they vars or funcs) the more noise its API presents. But c'est la vie, that's easy to avoid in the first hours of Python, in fact you can successfully code lots in Python and never go there. Though it does rear its head eventually given Python's intriguing implementation of everything as an object! Even class definitions are objects! That is, while simple, something many will struggle to get their heads around fully.

Thread Thread
 
polterguy profile image
Thomas Hansen

For you (and me) this is easily understood. For a noob, it's rocket science. When I started coding, I could turn on my computer, and within 3 seconds I could start writing line numbers and goto statements in a procedural language. Today you have to download an IDE, a compiler, and dozens of libraries and other tools. Before you've even started the downloading process, you've had to wade through hundreds of articles to figure out what you should even download in the first place. Such things does not inspire creativity ... :/

Thread Thread
 
thumbone profile image
Bernd Wechner

Not sure that I agree. I mean you can have similar all you need is to turn on the computer if it's set up right (I can do that for my kids) and in term type "python" and you're in the same spot. Just can't use GOTOs, and I'm not sure that was an easier an idea than while, or for ... it was sure as heck harder to follow and understand - I wrote a game of Pong that way using PEEK and POKE and GOTO as my first coding jaunt as a kid ;-), and it wasn't easy to follow GOTOs. And that fun convention of incrementing line numbers by 10, so we could slip new lines in ;-).

Not so sure that it needs to be much harder today. Though I do agree, it often is ... more immersive. For example, I just checked this out for the kids: py.checkio.org/ a full on adventure game with little Python exercises but yes, the first induction exercise throws this at you:

def mult_two(a: int, b: int) -> int:
    # your code here
    return None

print('Example')
print(mult_two(1, 2))

assert mult_two(3, 2) == 6
assert mult_two(0, 1) == 0

print("The first mission is done! Click 'Check' to earn cool rewards!")
Enter fullscreen mode Exit fullscreen mode

Which, I agree, is more than I expected for a Elementary level first exposure. I'd have started with:

a=3
b=2
# calculate c as the multiplication of a and b
Enter fullscreen mode Exit fullscreen mode

That is enough for a total noob, to tackle the abstraction of variables (as in these kids haven't done algebra yet ;-)

Alas, methinks they want/need asserts to provide automated success feedback. Shrug.

Collapse
 
lexiebkm profile image
Alexander B.K.

I wish I could work using FoxPro 2.6 for DOS again :)
Define window ...
Activate window ...
10, 20 say "Bring back FoxPro 2.6 for DOS"
15, 20 say "Or... bring back Pascal"
25, 20 say "But I am learning Java and others..."
scatter memvar
gather memvar

Collapse
 
polterguy profile image
Thomas Hansen

Hehehe :D

Psst, you can ... ;)