10 ways to suck at programming
-
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.
-
:laugh: Oh really? Great article.
-
A great read!:thumbsup: My only complaint is the author's misspelling of "rein". /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
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.
J. Dunlap wrote:
Generate as much Javascript in the codebehind as possible, including unrolling all of your loops when you could just enumerate a dataset.
From my current inherited, registered in code nearly all forms, is OMGSCript[^] I think I'm still recovering, weeks after removing all traces of that from the codebase.
-
Ravi Bhavnani wrote:
author's misspelling of "rein"
Nope. Could not find this wrong spelling. Maybe the author read your comment and fixed it. :)
No he didn't. The author misspelled "rein" as "reign". /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
No he didn't. The author misspelled "rein" as "reign". /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
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"
-
No he didn't. The author misspelled "rein" as "reign". /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
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!
-
J. Dunlap wrote:
Generate as much Javascript in the codebehind as possible, including unrolling all of your loops when you could just enumerate a dataset.
From my current inherited, registered in code nearly all forms, is OMGSCript[^] I think I'm still recovering, weeks after removing all traces of that from the codebase.
-
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!
It's no big deal - I was just pointing out the error, not judging the content of the blog post. Btw, I agree with the author's sentiments, which is why I :thumbsup:'d Henry's original post. /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
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"
Roger Wright wrote:
Though the English will surely be bad, there just might be something in there you need to hear.
Absolutely! Which is why I :thumbsup:'d Henry's original post. :) /ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
-
-
You can view the cached copy here: Cached Copy at Google
-
Every now and then the Daily News drags me back here... :-D (obviously not kicking and screaming - I didn't even scare the hamsters) I groaned, I laughed, I hung my head in pain.... oh the memories of 30 years of programming with other people's code (I debugged the high school's grading program because the business teacher said he knew more than me about programming, and he couldn't find out why GPA's were all zero (I was grounded before my Mother saw the actual grades -- luckily retracted)... I couldn't walk away from a challenge, even then... oh the current existence... I am working on the "I write self-documenting code, so I don't ever need to comment anything" guy... outside of taking forever to say his name that way, he's returned to 2-5 year old code and had to come to me for help understanding it. That has helped the very old argument in my favor, unfortunately it is still a pain... and I may be taking over some of his code-base soon X| I think #8 and #2 are the only two I don't have to deal with on a daily basis.... And that is because #2, almost no one in the group is checking for errors. :omg: Maybe I can eventually get that fixed.... :sigh:
_________________________ 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....
-
-
-
Every now and then the Daily News drags me back here... :-D (obviously not kicking and screaming - I didn't even scare the hamsters) I groaned, I laughed, I hung my head in pain.... oh the memories of 30 years of programming with other people's code (I debugged the high school's grading program because the business teacher said he knew more than me about programming, and he couldn't find out why GPA's were all zero (I was grounded before my Mother saw the actual grades -- luckily retracted)... I couldn't walk away from a challenge, even then... oh the current existence... I am working on the "I write self-documenting code, so I don't ever need to comment anything" guy... outside of taking forever to say his name that way, he's returned to 2-5 year old code and had to come to me for help understanding it. That has helped the very old argument in my favor, unfortunately it is still a pain... and I may be taking over some of his code-base soon X| I think #8 and #2 are the only two I don't have to deal with on a daily basis.... And that is because #2, almost no one in the group is checking for errors. :omg: Maybe I can eventually get that fixed.... :sigh:
_________________________ 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:
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.”
-
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....