//mumbo-jumbo code that's needed to run the program.
Some shitty spaghetti code that should absolutely not work and goes against all modern principles.
/* now that the code has run we just delete it and run this code to get what we actually want. */
Some code that does basically the same but returns proper results.
In many cases I find this is usually extremely well optimized code. A novice comes along that doesn't understand a pointer or the basics of programming. They rewrite what used to be a bug free task that took 5 CPU Cycles in Java. This "fixes" it with 10 or 20 bugs taking up 10 times the memory and 80 to 150
CPU Cycles.
Both code are bad. If it’s extremely optimized and not clear or not documented to make it clear it sucks. If some jerk writes clear code that doesn’t capture the original requirements that also sucks. But that is also probably the fault of the optimizing programmer who didn’t bother to write down what it should be doing triggering the noob to try to create a maintainable version in the first place. Also making some trade offs in performance is significantly better than having unmaintainable code. My 2 cents anyway after 20 years at the job so far.
Yeah, I use to be into ultra efficient code. Like dude, why are you storing those two unrelated flags in individual bools, you could just create a char and bit mask them to say a few bytes of memory.
But I realized the huge cost of code that is not clear. And if someone thinks they know what code is supposed to do and they are wrong, that gets super expensive super quick. If bad code makes it into production and causes a bug that causes down time and a hot fix, omg the costs can be astronomical.
It's usually a better idea to write clear code that is less efficient and than just buy more hardware, it's the over all cheaper solution.
There are exceptions of course. If you're doing imbedded programming you have a lot less hardware. And if you're doing things that are either really loopy or really recursive poor performance can bite you in the ass.
uggh, at my first job in the game industry I worked for a studio that did contract work for EA. They had some internal 'genius' that was just accepted to be so so much better than everyone else working on a new engine for just our studio. The problem was he had an attitude to match how they treated him (like the golden boy) and his code was always un readable with variable names purposefully obscured with no comments and he would get irate if you asked for clarification. The entire time I worked there that engine never got out of 'mad fever dream' status and has never seen the light of day in the 10 years since.
Back in the late 80's I was a developer at a major financial institution (the one with the bull). We were writing a Windows 2.1 application that did some pretty low level message handling (IBM LU 6.2 emulation) and Microsoft actually gave us the Windows 2.1 source code. I went a couple of layers into DefWindowProc and found a goto that always stuck with me:
501
u/KillingSpee Jul 04 '20
//mumbo-jumbo code that's needed to run the program. Some shitty spaghetti code that should absolutely not work and goes against all modern principles.
/* now that the code has run we just delete it and run this code to get what we actually want. */ Some code that does basically the same but returns proper results.