10 ways to suck at programming
-
Well, inheriting such an app is bad. What's worse is when the culprit was you a few years ago. (I'm just rewriting my own intranet web app which I rolled out 2 years ago. When I look at the code I could throw up).
soyka wrote:
What's worse is when the culprit was you a few years ago.
I have just gone red with embarassment! :-D
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Oh, there are many things to add to this list, like: -use exceptions for ALL conditions, not just the exceptional ones. It will kill performance even more. -Don't ever refactor code. -Make large, complex nested if/else structures, and initialize variables in almost every branch of it, so the reader will never now if variables have been initialized after that structures. -If a function requires more input, don't add parameters. It will require you to change all calls to it. Rather add a global variable... -Put many classes in a single source file and avoid the file name of that source file to make sure nobody will ever find your classes. And much more, sigh... And all of this really happens...
-
El Corazon wrote:
Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....
I haven't seen you. OK? Nice to hear from you again tho'. Keep well!! :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
Henry Minute wrote:
I haven't seen you. OK?
:cool:
Henry Minute wrote:
Nice to hear from you again tho'.
:cool:
Henry Minute wrote:
Keep well!!
:jig: I am trying. :) Hope you are too. How's the lounge been?
_________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....
-
Henry Minute wrote:
I haven't seen you. OK?
:cool:
Henry Minute wrote:
Nice to hear from you again tho'.
:cool:
Henry Minute wrote:
Keep well!!
:jig: I am trying. :) Hope you are too. How's the lounge been?
_________________________ John Andrew Holmes "It is well to remember that the entire universe, with one trifling exception, is composed of others." Shhhhh.... I am not really here. I am a figment of your imagination.... I am still in my cave so this must be an illusion....
El Corazon wrote:
How's the lounge been?
I've only just returned after a 4 month absence. I was out in the wilds with no internet access. It does seem for the most part to be up to its usual high standard though. Most of the regulars are still there (mostly laughing at Graus's inability to deal with anything technical) and a few good newcomers. Keeps me off the streets, anyway. :-D
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
I've dealt with a lot of those in inherited codebases. Some other ones:
- Store the customer's entire selections and orders in the Session object, against numerous, sometimes arcanely-named keys. This way, the customer gets the surprise gift of having their whole order disappear shortly before they are ready to submit it.
- You have direct access to the database, but why would you want to make it that simple? To properly express your genius, translate all of the data into an XML hierarchy that looks very little like the original data, and then make your code use that.
- When accessing XML like the above, avoid using element names or XPath, and instead access XML nodes based on their indexes. That way every slight change that is made to the XML breaks the app horribly. Bonus points if you access the root node using
XmlDocument.FirstChild
so that it breaks inexplicably when an XML declaration is added. - Make as much use of tables as possible, and generate each individual table node manually using
new TableRow()
andnew TableCell()
and using a variable for each. - Generate as much Javascript in the codebehind as possible, including unrolling all of your loops when you could just enumerate a dataset.
- To further make use of the CPU on your database server, create your data schema in such a way that even some of the smallest operations require stored procedures with expensive joins, cursor loops, lookups, and temporary tables. Then use more of these than necessary.
Also use many global variables. Do not pass anything except flags as arguments to functions. When adding new functions just make new globals for them to reference. When using the flags, overload the bits as much as possible to avoid making new functions. For example, start with a simple boolean flag and then extend it by using negative numbers to mean 'more false-ness' and greater positive number to mean 'more true-ness'. Shortly you will no longer be able to tell chat the function does. Of course, that has its own solution. Just copy the function to a _v2 version and change that. Whatever you do, do not think the problem through from the beginning. Do not refactor the code. Never generalize a solution, or parameterize a function to make flexible.
-
A lot of people make that mistake, Ravi - even here. A lot of very bright people are complete morons when it comes to communicating in their native languages, too - including here. I try to overlook those little flaws and read the message hidden inside the misstatements. :-D Recipe for a happy life: Approach every article and conversation as you would a fortune cookie. Though the English will surely be bad, there just might be something in there you need to hear.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
Recipe for a happy life: Approach every article and conversation as you would a fortune cookie. Though the English will surely be bad, there just might be something in there you need to hear.
Dude, THAT was inspiring! :)
--------- Andre Sanches "UNIX is friendly, it's just picky about its friends"
-
Recipe for a happy life: Approach every article and conversation as you would a fortune cookie. Though the English will surely be bad, there just might be something in there you need to hear.
Dude, THAT was inspiring! :)
--------- Andre Sanches "UNIX is friendly, it's just picky about its friends"
Feel free to quote me... :-D
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
-
Tootin' my own horn: I always comment heavily - really as a defensive mechanism for my shoddy memory. This thing they call refactoring (or what I always called clean-up) - starts with, and continues throughout, the development cycle from the first keystroke. Most of us, I'd wager, do the same, as better ideas develop: why wait? Once upon a time, talking to the "big boss" about this, I noted that my detailed commenting of code makes me expendable. He said that it's why I'm not . . . In a world driven by "No good deed goes unpunished", it's was an inspiring moment.* Consider that if you're working for someone who isn't stupid - treat them that way! * Also, he has experienced a contractor who further outsourced his code and, after all was said & done, a lot of money followed the pathway of that great flushing sound.
/xml>
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
"As far as we know, our computer has never had an undetected error." - Weisert
"If you are searching for perfection in others, then you seek dissappointment. If you are searching for perfection in yourself, then you seek failure." - Balboos HaGadol Mar 2010
-
Although they're all good... here's my favorite. :) Start off by wrapping nearly every tiny piece of functionality in a try / catch phrase. Then… inside the catch… put a comment, like “// It borked lawl.” Unfortunately I have seen this exact situation more often than I want to admit. I think their thought when writing such is, "Exception handling is evil... I want my On Error Goto!"
-
What's one little spelling mistake between coders? Anyway, I can't stop to chat; I have to decide whether to update the variable "NumberOfMillions" or "NumberOfBillions".
I wanna be a eunuchs developer! Pass me a bread knife!