Earlier quoted context omitted.
I did something like step #2 in C# some years ago. Pulled data from the database based on the calling function’s name. Clean Code was mental poison for me and certainly led to a bunch of overly abstracted or overly-DRY code.
I feel like every coder has to overdo it at least once to truly grok why it is a balancing act. And I think that oftentimes leads to the discovery that every best practice is a balancing act.
How to write unmantainable code (2015)
21–30 of 87 posts
Re: How to write unmantainable code (2015)
#22I noticed a variable (long word starting with z) used in a lot of places. Turns out it was the German word for "counter".
It was my first hint that most of the backend codebase was written as a competition between the two of them to seem the smartest.
On the front-end, I remember opening some many thousand line long file trying to figure it out. I scrolled pages and pages to the top of the file looking for a comment. I found one. The comment:
/* What is this shit? */
Written by someone who tried to help those guys.
Re: How to write unmantainable code (2015)
#23Code like that should set off alarms very fast, and any code review should catch it early on.
Re: How to write unmantainable code (2015)
#24They forgot the masterpiece I saw years ago: 1. Give all your Python class members a tedious naming convention. 2. Be DRY by writing helper functions that do name lookup based on a string of the last half of the member name. 3. Be even more DRY by having the function guess a little if the match isn’t exact You now have an application where you cannot search for where members are referenced.
Ah yes. Just like Ruby and meta-programming games with send, define_method, and method_missing.
Sometimes repetition is good.
Re: How to write unmantainable code (2015)
#25My favorite is when the codebase is so deeply buried in macros and headers that send you on a wild goose chase to find any actual code that it becomes much easier to just dump the binary in ida/binja. The source code can lie but at least the compiled binary directly does what it says
Re: How to write unmantainable code (2015)
#26This is the way it seems to go in the public sector, at least here in Norway. 1. Get an n year government contract for some huge public IT overhaul. E.g building a new hospital journal system for a large region(this example is real, google "helseplatformen") 2. Spend years developing this huge proprietary .net monolith with a waterfall model, and minimal user interaction and testing during most of the contract. 3. Re…
Re: How to write unmantainable code (2015)
#27They forgot the masterpiece I saw years ago: 1. Give all your Python class members a tedious naming convention. 2. Be DRY by writing helper functions that do name lookup based on a string of the last half of the member name. 3. Be even more DRY by having the function guess a little if the match isn’t exact You now have an application where you cannot search for where members are referenced.
For some reason everyone tried to be clever with code reuse in them which almost always resulted in an unsearchable mess.
Re: How to write unmantainable code (2015)
#28My first job out of college, my boss and I took over some code that was written by two genius PhDs (one math, one physics - we were working in finance.) I noticed a variable (long word starting with z) used in a lot of places. Turns out it was the German word for "counter". It was my first hint that most of the backend codebase was written as a competition between the two of them to seem the smartest. On the front-en…
Re: How to write unmantainable code (2015)
#29Re: How to write unmantainable code (2015)
#30Use micro-services! The more the better! And write each micro-service using a different programming language and build system. Make sure the protocols are not documented. And that the micro-services are called p376, f190 etc. Make sure that some micro-services need to access a specific server setup to build!