10 Ways To Suck At Programming
I recently inherited a web app from a dirty, nasty, stinking contractor that claimed to be a competent enough programmer to be left alone to get things done. Unfortunately, we took him at his word. Functionally, most of the web app seemed to work at first glance. However, once the client took over the reins and actually started using it things went downhill fast. The contractor disappeared after payment (die reputation DIE!) and I was left to try and get things working properly and performing up to snuff while the client limped along with what they had been given.
I decided to document a few of the things that I found wrong along the way. These are really just things that every good programmer should already know to avoid… but obviously some people need to be reminded (or taught).
Update – 05.18.2010 – Some people thought that this article was too sarcastic. While I thought it wasn’t sarcastic at all, it does exactly what the title promises and teaches people to suck, I’m always game for being constructive. So I wrote an offset to this article – 10 Ways To NOT Suck At Programming.
#10 – Don’t store settings in a configuration file
When you’re writing a sizable application, things like database connections and SMTP server information will be used throughout the app. The best way to make sure your app is entirely immune to maintenance is to redefine those little bits of information every time you need them. So instead of putting them in the configuration file (Web.config or whatever) just leave them in your compiled code. Whoever inherits the app will thank you for sending them on a hunt through thousands of lines of code to change which SMTP server is being used. What’s even more fun is when the next programmer only finds 14 of the 15 places where you’ve used this code and a single instance somewhere deep in the app silently breaks hundreds of times without anyone knowing. Sometimes it’s helpful to build the variables in inconsistently concatenated strings. The repeated and more frequent interaction between the new developer and the disgruntled client will help strengthen their relationship. And if you don’t hook up that love connection, who will?
#9 – Don’t store variables in [any] memory scope
One of the great things about databases is they store your bits of information and allow you to access them whenever you need them. To make sure your app is as terrible as possible, you’ll want to be sure and access the database every time you need a bit of that information. The more common the information is that’s needed, the bigger win you’ll have by making a new database connection to get that information. Non-sensitive user information is a great use of this prinicple. Don’t worry about defining a user’s information, such as “isAdmin” to a variable and using it throughout the current request. Just query the database each time you need to know anything about the user. After all, the client paid for that database, we’d better get as much spin out of it as possible!
#8 – Use arcane plugins
If the client has a non-standard request, such as formatting a table in a way that is outside the abilities of your WYSIWYG editor (colspan are hard). You should definitely hit up the interwebs and search for random unsupported closed source plugins to do the work for you. If you would spend almost an entire hour writing it yourself, you should spend at least 3 hours searching for and getting a plugin that does roughly but not exactly the same thing. Bonus points if you can get a plugin that doesn’t do what you need, but offers 15MB+ of functionality you have no use for and include it without getting caught. Bonus bonus points if the documentation for that plugin is in a language not native to your market (for example, if you’re working in an English speaking shop look for plugins that are documented only in Spanish or German).
#7 – Never, ever remove functionality
Over the course of developing a large application there are bound to be times when functionality you were working on proves itself to not be needed. Now, to be sure to leave plenty of dead ends for those who come behind you to get lost in, never delete that functionality. Maybe even comment out random parts of it, or even hundreds of lines of it at a time, but don’t delete it. Imagine the hours of fun the future-crew for this app will have while they trace through this functionality only to find that it isn’t needed! If you can make it seem needed, without actually needing it, it will even keep them from deleting it themselves… This way the fun is exponential! Oh, a bonus on this one… if your project uses source control and multiple server environments, be sure to have a different version of your files (both code and compiled) on each server and source control. This way no one will know which one is live in production and who doesn’t love a good round of Code Russian Roulette?
#6 – Screw performance
Large applications, you know, the ones that pay the bills, are generally needed because they deal with large amounts of data. Sure, during your development process you’ll create 20 or so test records. Take my word for it, there’s no need to even worry about what happens once you get to 25 records, or even 1,000! Obviously, all pagination will work just fine and performance will never take a hit. So if it compiles, ship it!
#5 – Nest major logic/functionality in loops
Now obviously, we’ve already covered #6 so we know that we’re working with large amounts of data. And inevitably, there will be plenty of looping through that data to do work with it. If you want to make sure your application is really difficult to maintain and completely unusable to the client, you should embed major functionality and/or logic inside of these loops. For example, instead of running a query against the database to get ALL the data you need, storing the data in memory and working with the variables in memory during your loop, just get all the data except one field up front and loop through it… then on each loop you should get all the data again, and now include your extra field. This will guarantee that your app will never survive more than 5 concurrent users (re: #6). So for review: Get data > create loop > get data > work with data. I’m sure you see some room for added idiocy in that process, so feel free to nest this idea as many times as you want.
#4 – Document NOTHING
Look, documentation is for morons. I mean either you can read the code or you can’t, right (this was actually said to me at one point)? Of COURSE the next programmer will be able to read the code. What’s really fun though, is when you document absolutely nothing, especially not your intent. It pays to keep them guessing. You’re mysterious, like a ninja. No need to let someone get all up in your grill, knowing everything about what you were trying to do. Because if you document what you’re trying to do and then don’t end up doing it… well… that’s just embarrassing.
#3 – Use and reuse illogical variable names
There’s going to be a LOT of variables needed to work on this app, so you’d better choose a movie or television show with enough characters to use all the names. Lord of The Rings, Star Wars and Family Guy are all good choices for this. Maybe you can even form relationships with the variables. That way, you never have to kill them! You can have variables that are chameleons, changing their usage and values throughout processing and you can recycle them for something new each time you need a variable for new functionality. It’s like they’re growing up, evolving, right before your eyes! After all, you’re trying to be green and reduce your carbon footprint so recycling variables just seems like the responsible thing to do!
#2 – Catch all errors — and do nothing with them
Most languages / platforms nowadays have really good error handling built in. They’ll die somewhat gracefully and give enough details through the default error output to be helpful. You must not allow this to happen! 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.” This will ensure that if anyone wants to work on this app, they’d better spend the time getting to know the app and it’s adorable character variables before they start wrecking the app altogether.
#1 – Duplicate functionality
If the client tells you that they need two pages: One for an administrator that has all of the details on an item along with a button to delete it; and one for a regular user which has all of the details on an item without a button, you should create multiple pages to accomplish this. In fact, if you can make pages for each user group that would even be better. Making a separate page for each user is the ultimate success. So ninja up and get serious on this one, because it’s your last line of defense against the teeming hordes of qualified individuals who will inevitably be bewildered while trying to update your carefully constructed Pandora’s box of an app.
This is by no means a comprehensive list. On this project alone I could name 10 more things that could make you suck. But I’ll leave it at 10 for now. Anyone have more to add?
This entry was posted by Donnie on May 4, 2010 at 7:32 pm, and is filed under Programming, Rants, Software, Technical, Web Development. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.
-
-
-
#18 written by EdH334 1 year ago
How to suck at Relational Databases: the problem with Relational Databases is that, well the data is related, but its not encapsulated. Lets solve this by encapsulation problem by creating each item and its related data in its own database, and as a bonus add a 13MB overhead to every database, plus a 2 second load delay and voila, make your cross item reporting take 20 mins when it should take 20 ms!
-
#19 written by Sihle Dube 1 year ago
Great read fellows. I must admit, I for one have made all of those mistakes, not on the same code and company, but in my career. Most I rectified myself, when I had to maintain the code 8 months later, and I thought to myself “What an idiot, what were you thinking”.
That is why, no individual is hired from school into a Senior Developer position, but to an intern, graduate, and junior developer.
I showed the article to my subordinates and went through it with them so the understand each point. Their Perfomane Appraisal wll be measured against avoiding most if not all of those pitfalls.
Well done to the author.
-
#21 written by Rob 1 year ago
Don’t write code when you can spend $70,000 on third party ecommerce applications that “integrate” with your legacy systems. Of course, integration means you code the necessary “API’s” and the application performs direct reads of the ERP database.
Always choose these applications based upon the presentation by the salesmen without any regard to modern development techiques. We all know everyone wants to work in a development environment where strings are limited to 255 bytes. Makes creating auto-generated emails simple.
Always code your application to create tables for your “Product catalog” where each row in the table contains a single cell which contains a separate table for each row of data. That makes it easy to ensure your columns line up in the output.
SOA. Who would ever want to execute a function on your iSeries from a Windows box?
-
#22 written by RantsAgain 1 year ago
When you choose the application by the presentation given by neatly combed,favorite shirted salesman, when a moron developer asks , why the hell do you need to spend so much money when you can write yourself , say with pride ” Then we will have to do the maintenance of that app by ourselves, which we can’t” and ensure that you have another stripe tied man say ” these companies have deep pockets , so spending 70K is peanuts to them” and allow them to have a nagging corporate laugh.
-
-
#23 written by Charbel 1 year ago
I spent 5 hours trying to change the configuration file of an application I had to test to connect to my Local SQL Server. After spending that much time, I requested the source code, only for finding that the developper had hard coded the SQL Server password. After finally getting his number and asking him why, he said “this adds more security to the application. If anyone opens the configuration file, he will be tricked into thinking he found the password”
-
#24 written by fabio 1 year ago
another nice way to mess up with the program:
waste time!i made an activex control that act like a progress bar
it had a circle that is going around a label that show the progress in %now each time it complete a round it trigger an event
and it trigger another event when it gets to 100%it waste a lot of time
good if you want to make people think its a heavy program that takes time to load ^__^ -
#29 written by K 1 year ago
Create the functionalities or Fix the bugs, only which the end user is able to see. If an end user is not able to see a bug then no need to fix it.
example:- You must validate a check box whether it has been checked before submitting the form.
You can achieve this functionality through client-side code and also server-side.
You can also put the code at both ends to ensure no hacking or data interruption.
If you put the client-side code then there you can avoid an un-necessary roundtrip to server in the case when the checkbox is unchecked but since the end user can’t see whether you have put the client-side code or server-side, you can enjoy sending a roundtrip to server and validating the checkbox only at server-side.
-
#30 written by Matt 1 year ago
Don Box, I have to disagree with you. Having a graduate is no measure of quality, I’d go for an experienced developer with some achievements under their belt over a graduate any day. Both at once if possible but the experience wins over the qualifications.
I think the main ways to suck at coding have all been covered, I’d like to see a follow up on how to suck at developer management, featuring things like hidden feature agendas and estimate haggling.
-
#32 written by Adriaan Davel 1 year ago
The biggest mistake in my mind is to start developing by starting to code… More work is supposed to happen before coding than the coding it self. Bad code can be ok if something has been developed well.
Also keep in mind that bad code is sometimes caused by development (ie growth). To develop something means to grow it (its not called creating) and the more development happens after coding has started, the more the code is going to be abused… -
@Don Box,
Now that is just plain funny, and more than a tad myopic. When I graduated there were no respected engineering courses for computer science. For that matter given the rate of change in our industry no course can keep up.
Until our tools become as unchanging as an engineer’s a course will not be able to do more than instill basic principles.
-
I laughed. Very good article, and strangely, most of it applies to the code I’ve worked on over my entire (albeit short) career. If you want to find more rants, you can check out my blog:
http://c-sharpener.blogspot.com
I whine a lot too :)
-
#37 written by Don Box 1 year ago
This problem has a simple solution – hire developers with a degree from a respected engineering school. Inept developers wouldn’t be able to graduate from such an institution. If your hiring process doesn’t involve verification of a formal education in computer science, you are accepting the associated risk.
-
#38 written by Peter McClymont 1 year ago
Oh, here is one … release some code to production, but make sure that the code in source control is not the same code.
The most important thing though is to leave the company after that. The people after you won’t have any problem figuring out how to proceed after that.
To be honest I treated the problem as low priority (as I was working with many clients all at once) and I ended up leaving the company and dodging the problem.
-
#39 written by Peter McClymont 1 year ago
What a nightmare. I have worked with some pretty shocking people myself, but not anyone with all that lumped together.
What I reckon though is that it is not about education, and all that. It is about these things,
1) Common sense
2) Having a practical mind
3) Having DICIPLINE
4) Being able to push back if a deadline is going to compromise qualityI don’t do everything perfectly, I mean nothing is ever going to be perfect, but I do care what others in the future think of a random piece of code that I wrote.
I actually think too much education isn’t a great thing either. How things are in the real world is quite different than university. The most useful things I have learnt were not at university.
-
#40 written by Sleazy Otto 1 year ago
Don’t forget the time-honored technique of incorporating a critical subroutine into most or all of your loops, with a nefarious bug that only shows up about once every 1000 iterations … and then accidentally delete the source code.
Great read, wish I could say I’d never encountered these “opportunities”. I found #4 especially poignant, since that was the stated philosophy of one software shop I worked in…
-
#41 written by Eric 1 year ago
How about a VB6 function that returned data in global variables. Yes variables, two to exact. Oh, and you had to set one other global variable before you call the function. Yes it was a function too, and not a subroutine. If it were a subroutine, maybe they didn’t know about functions.
Many years ago I saw a C program written by one of our senior developers. All the variables were single characters, lower case for local variables, and upper case for global variables. When it was converted to a C++ application, all he did was wrap the entire application inside a single class.
-
#42 written by Old School code writer 1 year ago
Sorry BioGirl – but you did it to yourself. The assignment was to add some new functionality to a ‘working program’. Since the program was defined as being a working application, you should have added the functionality and handed it in. You weren’t asked to rewrite the original program – nor to critique its merits.
You should have concluded it this was a test and commented the code, highlighting the code that provided the fake output – then scribbled out code as a class object that could be readily called by an event driven object inserted into the original application that would do whatever added functionality was requested of you.
Even if the class instructor/professor got hoodwinked by the previous student – as long you fulfilled the assignment ‘to the letter of the description’, the instructor would be more or less compelled to accept your thesis.
Chances are pretty good though, that part of the examination is seeing how you handle some bogus, crap code. Are you smart enough to recognize it’s bogus? And how do you handle that revelation? Do you get stupid and indignant and try to reinvent the wheel on your own or do you complete your part of the assignment and offer notice that there is additional work (i.e. fixing the original code) that needs to be accomplished before the application is truly a working product.
In the real world, handling these type of sticky situations is a stern measure of both skill and character. If you are a programmer – you will sooner or later run into something like this where the success or failure of the enterprise you work for, may depend upon how intelligently you respond.
Except in the real world be very very careful because that bogus output might be there by design, you might be working for an Enron… so what do you do then?
-
#44 written by Geckex 1 year ago
Hey – I think one obvious reason for this kind of code is inexperience and lack of education. Too many textbooks about specific languages, and too few on OO design and just general best practice.
However – I think perhaps another issue is simply just that what we developers do for a living quite quickly becomes repetitive and to be honest boring.
I am certainly finding that for every moment of excitement and challenge I experience in my job, I spend a good two or three weeks just pounding the keyboard and churning out business logic code – which is just variations on variations of things I’ve done 500 times before.
I think what this business really needs is more frameworks and a lot fewer bespoke applications. reinventing the same faulty wheel over and over again. -
#45 written by Matt McGuire 1 year ago
worked with a old c developer once that would declare alot of variables at the top of the function like a,b,d,t,r,s,j,f,z,zz and may only end up using one of the them, but the rest waited just incase he needed them later.
Later on when I had to start transitioning his system to a new platform, I complained to him all the compiler warnings the unused vars gave. so he “fixed it” by assigning “1″ to every unused var.We ended up just dropping the origional code, after finding it too buggy.
-
@rlfried – it really is an “experience rules” profession. The more things you see, especially the mistakes, the less likely you are to make them. But when starting out, the best advice I can give is to latch onto someone who is senior who is truly good and base what you do on the way they do it. Do NOT emulate them, create your own solution using their theory in order to ensure that you understand it and ask them to validate your approach and critique it as they have time. Oh, and most importantly, ASK QUESTIONS. The only stupid questions are ones that don’t get asked!
When I’ve taught college classes in the past my biggest point of focus was to gain an understanding of why you are doing something a certain way and what is actually happening on the machine when you do it.
Good on you for wanting to perform the craft at a high level! Too many people nowadays just want to take the money and run.
@Frank Holden – I meant no disrespect to contractors, having been one myself for some time. The term “a dirty, nasty, stinking contractor” comes from something a group of us called ourselves as a joke towards the way the moronic FTE’s treated us. Inept programmers can’t be defined by employment status, nor can good ones. ;)
-
#48 written by SJRM 1 year ago
Here is one of the best ones.
1. Create a batch process in the server, to export data to some tables in a database.
2. Then, send a couple of users, a local application that they should run to fill more tables on the database.
3. Then, instruct the new programmer telling him that there is an automated batch process that fills the tables every day. and tel NOTHING about the local applications that a couple of users have.
4. After a couple of months, the new programmer will receive urgent calls from some users and a manager telling that the tables are not filling the data.
5. New programmer will found that the “automated” process in the server is just NOT working. The new programmer will think “How in hell the users were making reports all this years?”, and will fix the server automated process.
6. The new programmer will told the users everything is fine now. After a couple of hours, or next day, will receive again calls from the users that there is no data, and that they cannot “fill” the data in the tables.
7. Programmer will go to the users desk, sit at his computer, and found a totally new local application that he had no idea it existed.
8. After making some analysis in the newly discovered application, he will found the problem is that the password of the db user has expired.
9. Next chapter… how the programmer will go and search for every server admin trying to find who maintains that user and can change the password
-
Good article and it those things are obvious, the bad thing it’s when you are a decent programmer, you care about your code and when you request some time for re-factoring the answer is make it “quick and dirty”. And after that because of that instead of spending some time in the middle of the project you spend at least double the amount of time at the end to fix bugs and to understand what you wrote there.
-
#51 written by Dave 1 year ago
Favorite “worst” programmer used to set breakpoint on last instruction in program and then run the program. If it got to the breakpoint without crashing, it was ready for production.
His finest creation; a sorting routine that sorted the operating system of the computer and crashed it when quality assurance tested it. Ta-da!
-
@Andrés : Unfortunately there will never be a way to measure a developer’s inherent skill level. Your examples all use real world objective examples. Code is neither real world, nor objective.
As an example back in the day (approx 15 years ago) some of my code was under review by a peer. He judged it too complex and difficult to understand for future maintainers. In my opinion he was a fool and had no business critiqing my code.
Well since then he has found a new career as junior management in a call center, while I am still designing systems for companies.
BTW the reason he felt my code was too complex was that I was using vtables in ‘C’. He could not see any value to be had by that design choice.
-
#54 written by maghick 1 year ago
I inherited code from an energy company which crashed specacularly in August of 2001. This code was supposed to turn on a high-speed scanner, scann the pages, and enter them into Documentum. It took an hour and twenty minutes to run each time, forcing the operator to take a break. The upshot was that it did none of that; it merely consumed CPU time. All of its supposed functionality was actually performed manually by other employees.
Ironically, it had been written by the company’s lead developer…
-
#55 written by Snifflez 1 year ago
Do not listen to anyone that suggests code reviewing is key to ensuring quality code delivery. It can be debated to no end that two heads are better than one, but what sense does it make to have multiple developers coding the same thing? Imagine the cost savings of dumping the code review process from your bag of tricks! Don’t get frazzled about rogue curly braces or other syntax errors. Technology is advancing on a minute-by-minute basis and those misplaced characters may just turn out to be the missing key to your application. Besides, server-side and client-side technology will undoubtedly catch up and be fully capable of automatically correcting errors you’ve thoughtfully sprinkled throughout your code base.
Don’t forget, all major discoveries were caused by an error.
-
#56 written by Andrés 1 year ago
@frank: Well, that’s almost offensive to foreign people working on US… I live in Argentina, I’ve been working for foreign companies for 10 years now, mostly US but also UK and Spain, and worked and lived once at a software company in US. All I can say is that I’ve read countless lines of code from apps created and mantained by developers all around the world, and no discernible pattern arises. I’ve met brilliant consultants from India as well as brain-dead full-time employees from US, there are bad a good developers everywhere.
Well, perhaps you were just trying to be funny… so no offense taken :)
It is true that the software developing industry is kind of inmature yet. Hell, we’ve really taken of like what? 10-20 years ago? Compare that to, let’s say, the buidling industry and it’s millenia old expertise, or the car industry and their 100 years under their belt, and there we have a decent explanation of why we are still working mostly like artisans.
And that’s why we can’t still really teach someone to be a good developer. We can’t even measure in a consistent way how “good” a developer is. I mean, on Hewlett-Packard (i worked there for like a year and a half) most management reports on employee performance still considered things like lines of code per day. I think we are waaaaay off the mark here, but the problem is that while we may all agree that any good programmer should deliver mantainable and extensible code promptly, we won’t agree that much on what maintanable, extensible and promptly means. So, we are kind of stuck.
The point is, as long as we are unable to measure how good a programmer is, we won’t be able to detect and get rid of bad programmers, we can’t identify oportunities to teach and develop not-so-good programmers and we can’t award those who are performing well. Management is blind on this, and this is why so many good programmers get fired everyday while other *really* bad developers are still there producing war-torn, sewer-like, completely malfunctioning and unmaintanable code. It’s just completely random.
-
A good tip for sucking… you’ll want to make sure and sprinkle lots of places throughout the code where end users can run commands directly against the database. This gives your client all kinds of options to run DML and DDL against the server without having to use pesky administrative tools. I find a nice wide open ‘select * from names where lastname = ‘ & Textbox1.text is a great way to go. You should also list as many database fields as possible in query strings so that the end user has a guide for ‘extending’ the functionality of your application.
-
#58 written by BioGirl 1 year ago
Wow. I think you must have inherited the project I was given for my thesis. I was given a “working” program that I was supposed to add some new functionality to. Well, I came to find out (after many days of banging my head against the wall and fighting with the server) that there were several problems with the “working” program.
For one, everything was written linearly. There were absolutely NO functions or subroutines. So, what could have been a couple hundred lines of code in one file ended up being a couple thousand.
There were ZERO comments and/or documentation. This was complicated by the creatively named variables: $var1, $var2, etc.
The results were all faked! Not only was it poorly written, it didn’t work! The results that were spit out by the server were the same set each time. When the user entered a query, the program just spit out old results over and over again.
Also, it wasn’t written in a way that allowed for future expansion. So, I had to rewrite it.
So… it took me all semester to fix the “working” program. Now I’m not able to graduate this semester because I still have to add in the functionality to complete my thesis.
And yes, the jackass before me did graduate.
-
#59 written by Skibbles 1 year ago
Be sure to use as many global variables as you can. Encapsulated data types are resource hogs, so be sure to break them down into single variables as much as possible.
Make sure that all time-sensitive communications with periferal devices occur on the main GUI thread. Every time the customer complains about un-reproducable hardware problems, you can simply have them change the settings of a timer and get them to shutup for another day or two.
Put circular references to global class instances in all of your source files to guarantee that nothing can be compiled stand-alone for debugging or reuse.
-
#61 written by Malcolm Swaine 1 year ago
I worked on some legacy software once where a program ran a batch job for a user and placed the output in a standard output directory. Whenever the user wanted to get a copy of the output, they would use their browser and navigate to a specially crafted directory where the output would suddenly magically exist. Of course it broke and nobody could figure out by what process these new magically appearing directories with their program output were being created.
After a day or so of working through some of the sh***est code ever (VB6, Actionscript and ASP pages) it turns out that what was happening was, when the user went to try and pick up their program output with their browser, because there was no existing directory or files in existence, a 404 would be thrown. The f**king nob programmer had written the logic into the 404 script that was actually responsible for creating the appropriate directories and copying the correct files. It then sent a redirect back to the user’s browser to navigate to the newly formed correct URL location. Pants!
-
#62 written by Mark 1 year ago
Another angle that I’ve seen are the programmers that know just enough about areas to be dangerous, then insist on using them throughout the code to show off their “knowledge”.
Real “clever” tricks like forcing polymorphic behavior where it doesn’t naturally fit is a fun one, since it’s not always obvious in reviewing the code which flavor of a class is being used when. Bonus points if the names of the derived classes are either non-intuitive, or better yet, misleading!
Speaking of dynamic behavior, I’ve seen some real “clever” use of run time passing of method names into delegates. This way you have basically no idea what is being called at any given time until walking through in a debugger, assuming that you are able to get enough grasp of what circumstances triggered the call of some arbitrary sounding method. I mean really, the language authors put a lot of work into making the dynamic aspects of the run times work. It’d be insulting to them to not use the tools for maximum obfuscational benefits for future maintainers of the code!
And don’t even get me started on reflection . . .
-
#64 written by Richard 1 year ago
Another one for you: don’t bother with functions. I mean, that branch call is just extra runtime overhead. Far better to have a huge function with a massive case statment and lots of extra nested ifs. Like #5, iterative iteration is your friend. No need to put in a function call, jsut slap teh code in the loop .. and the next one, and probably teh next one too – don’t forget to make subtle changes to some of them …
I once tried to suggest to a colleague that when he’d indented the code 7 times (so you had to scroll sideways to see anything more than the blocking braces) it might suggest that perhaps there could be a better way? (He had a right go at me, for questioning his undoubted superiority …)
-
#65 written by Philip Meeks 1 year ago
There have been many insightful and depressing comments. There are a couple of points I’d like to add.
The first is that the real value of any business application is its maintainability and extensibility. Getting it up and running isn’t going to be of any value if it very quickly fails and can’t be repaired. The single biggest skill shortage I see out there is the ability to write maintainable code. Managers need to realize that getting it done one time isn’t as important as getting it done in a proper way which will build value for the company. Of course if it’s written in a maintainable and extensible way, it would likely be on time because the required structure would be thought out before work starts.
When a company hires contractors, they need to make clear that code reviews are part of the contract and that pay is dependent on the code passing review. No publisher would hire an op ed writer and then simply publish that article without an editorial review. If computer programming were approached in the same way, we might be less of a hit and miss business. Of course that assumes that publisher has qualified editors…which is likely the cause of many of these points. -
#66 written by Bob@Work 1 year ago
You might add: Don’t reuse variables, ever. Particularly ones that are global. Consider incrementing the same variable name as you redefine it in each new, creative location (myVar01, myVar02…), or, when feeling particularly creative, make up new names each time (myText, myString, myName, myTempString, myTextVar…)
-
#67 written by rlfried 1 year ago
I am a fairly new programmer, and I have to admit that I have been guilty of a few of these at one point or another. Even though I hold a degree in software engineering, the bulk of my knowledge comes from OTJ training and self-learning. I do not have the luxury of working for a dedicated development firm, so I am not surrounded by a lot of developers on a daily basis that could review my code and smack it out of me.
My goal is to become more polished and efficient, but I was hoping to get some insight from my more experienced colleagues out there on this issue. Other than the obvious situations (the app runs unworkably slow, bogs down the network, doesn’t work at all, etc), what are some indicators that you’re not using the best method to meet your requirements? My fear is that even though I’m getting the job done for the end-user, under the hood I am unknowingly writing code that will cause my name to become a punch-line down the road.
-
@Chris – I’m with you. Having been doing this for 16 years now it amazes me that I can count the really good programmers, the ones I would actually recommend for a position wherever I was working at the time knowing full well they would adapt and do a good job, on one hand. It’s crazy and a little sad that it’s so rare.
@rideg – Do you have an IDE that you use to make this simpler? I agree with making things functionally abstract, but it’s so difficult to follow on the database side without an IDE to assist. Any suggestions?
-
#70 written by rideg 1 year ago
@Javier (#21) “Abuse stored procedures and have each stored procedure call another….at least 5 levels deep for each instance.”
This isn’t necessarily a bad practice. SPs should be like methods, doing one atomic thing each. It’s much worse to have a monster SP with decision(s), as the cached execution plan may not be appropriate for all paths through the SP.
Lots of small SPs can also be a sign of good code reuse, which is not as easily achieved in SQL as it is in OO languages. -
#72 written by Chris 1 year ago
@Donnie, fancy a job?
I’ve been a DBA for 12 years working in companies large and small. In that time I have worked with 5 ‘good’ developers (plenty of bad DBA’s too but they tend to get found out quicker). Development is unfortunately one of those areas that attracts those impressed by the possible salary oppurtunites not the job itself……….like project management (I haven’t met a good one of those yet.
-
Some of you guys are pretty funny… saying I’m somehow at fault for what another programmer did. This article was about me _FIXING_ what another programmer did. The client is happy and the code hums along nicely now.
So, in the end we DID find out and we DID cut ties but that doesn’t ease the frustration of having to deal with someone who interviews well, quotes the magazine articles and still doesn’t deliver.
We’re a cynical lot, we programmers. :)
-
#74 written by alians 1 year ago
as to #6 … be sure to read enough of the compiler documentation to become dangerous … if you mess around with compiler flags and warning levels enough, you will be surprised at the crap that you can write that will actually compile .. and be sure to keep javascript error messages turned off in the browser … there’s nothing better than a web application that is generating thousands of javascript errors that no one knows about
-
#76 written by Dale 1 year ago
It seems like we are forgetting something very important in this, so-called fiasco. It happens all the time: Some one thinks they are the best at whatever they do, and sometimes THEY are worse.
For example; was there a QA unit at this company? Did you have a say in the interview and made known the company’s expectations?
Someone in the company hired this person, if you have issues with your Director, or whomever hired this person, then deal with that, instead of coming off like you are all better than this contractor.
I am not defending the contractor, because the examples given seems bad enough, but, no-way it should have gotten to the point where it was delivered to the Client without a Full-time person testing it or QA done, in some way before actually delivering the product.
Some critical thinking would go a long way here, rather than everyone jumping on the bandwagon, criticizing now, when you probably have even worse coding habits.
I am a DBA, and I have run into worse things done by Full-time employees, Developers & DBAs alike.
So there, this should balance things out some, especially since THIS is your claim to fame.
-
#77 written by Dale 1 year ago
It seems like we are forgetting something very important in this, so-called fiasco. It happens all the time: Some one thinks they are the best at whatever they do, and sometimes THEY are worse.
For example; was there a QA unit at this company? Did you have a say in the interview and made known the company’s expectations?
Someone in the company hired this person, if you have issues with your Director, or whomever hired this person, then deal with that, instead of coming off like you are all better than this contractor.
I am not defending the contractor, because the examples given seems bad enough, but, no-way it should have gotten to the point where it was delivered to the Client without a Full-time person testing it or QA done, in some way before actually delivering the product.
Some critical thinking would go a long way here, rather than everyone jumping on the bandwagon, criticizing now, when you probably have even worse coding habits.
I am a DBA, and I have run into worse things done by Full-time employees, Developers & DBAs alike.
So there, this should balance things out some.
-
#78 written by Al 1 year ago
I have to agree with duh??? The person(s) responsible for the project threw the requirements over the fence expecting everything to just work. The missing documentation should have been a major clue something was not right. The fact that the contractor got paid for code that didn’t even go through user-acceptance testing tells me that your Top 10 should describe shortcomings of people in your organization (Project Management and others). You got left holding the bag for a month piecing things together (undoubtedly while your other projects’ dates slipped).
-
-
#80 written by duh??? 1 year ago
Nice read but… If an IT manager pays someone tons of cash to provide a deliverable, you should only blame yourself for not code reviewing the garbage he’s coding. If you’re competent enough to interview him, you should be competent enought to read his code. Get rid of them if you see this kind of coding (thats’s why you hired a contractor in the first place).
And more importantly, don’t rely on them to test (especially stress test) the app. They will only test the coded functionality. Contractors should be held responsible (I am one)… Withhold a portion of the final payment until the app is delivered and signed off on by the client at least a month after delivering. The contract should also require them to provide documentation as well as training. Incompetent programmers are out there, but accept a little blame for ‘trusting’ them in the first place.
-
#81 written by JBaggaley 1 year ago
I have seen this so many times whilst working as a contractor that it gets depressing after a while! I even made the mistake of hiring a contractor myself and trusting him to do way he was highly paid to do. In my defence we had just interviewed about 30 of them and he seemed the most plaudable. I really learnt the hard way about enforcing code reviews on all staff (including on myself) because your whole team then start to take proper ownership of the code and muppets like this get found out a lot earlier in the firing cycle…
-
#82 written by DBAdmin 1 year ago
So, how do contract programmers like this get hired, over and over again, when employers have so many to choose from? How do they get by having to provide references, especially supervisor references? I’m definitely not refuting the idea that lousy programmers exist, because I have seen many of them myself, but how do they get and retain jobs?
-
-
XX: Whenever possible use single letter variable names, preferably in alphabetical order for parameters.
XX+1: Each function must do multiple activities. It may do 10 things, but you’re only interested in 2 of them. Expect the rest not to have adverse affects elsewhere.
XX+2: When documenting, over document the obvious and ignore the not so obvious. Take three pages explaining how to turn on the computer and one page documenting how to do backups. Mark the section for Restore as “Under revision”.
XX+3: Use the database to hold editable configuration parameters, but leave a few hardcoded anyway (in obscure subroutines).
XX+4: (Somewhat covered by #3) Ensure that variable and function names mean nothing. Just because the subroutine is called “Print” is no reason to actually do any.
Unfortunately I’ve had to deal with such debris left by highly paid consultants. Since I didn’t understand immediately how the code functioned and they claimed to, management always took the tact that I was the incompetent one. Besides it would bruise their egos for them to admit they had been taken in by charlatans. Even when their noses were rubbed in it, their attitude coming back was “Well you knew there was a problem, why didn’t you fix it?”
I have hours and hours of similar horror stories.
-
#85 written by Dave Clarke 1 year ago
How to strike a chord. I too have inherited an app that includes many of the above *features*. I have a couple of personal favourites, like the markup calculation that is written inline everywhere it is used, except for that one location where a margin calculation is used instead, causing a divide by zero error whenever the “markup” is 100%. And the xml generation routine consisting of a couple of pages of string literal concatenation, each string element inexplicably containing an extra space at the end which is then removed with the Trim() method. Thanks for the opportunity to share.
-
@Donnie Patterns, Patterns, Patterns. Aspect-Oriented. You can force your way to being a bad programmer in any environment, I suppose, but in many it certainly doesn’t make sense. This definitely reeks of ASP/PHP style which, even the author’s code I would probably not want to work with. Database queries and procedures, loops, etc.. Good frameworks handle all of this for you, like a Concierge.
-
-
Epic? I don’t think so, it is in fact scary that this is a depiction of most software in most companies and there is a very simple answer why this is the case;
Bad Programmers stay in companies and continues to be programmers, Good Programmers either move horizontally to a “better place” or vertically to a “higher position”. In reality, few places has management control of software being written.
Our industry is lacking professionalism. We are disorganized, and with tools equivalent of using flint axes to manufacture cars. To top it off, the “project owners” are incapable of telling what is good and bad, has no incentives and punitive actions at hand, I don’t see that this will change to any extent in the foreseeable future.
The real list is much more serious, less obvious and no laughing matter. :-(
-
@Mark – holy crap dude… that’s… epic… *stands in awe*
@Justin Alan Ryan – I’m not aware of any environment which enforces good practices. I read back over the list and didn’t see any items there that were language specific… Enlighten me to an environment which doesn’t allow bad programmers to be bad programmers and I’ll switch today! :D
-
-
#92 written by Pascal 1 year ago
My absolute favorite for multi-language applications:
Copy the entire codebase to add a new language, change all strings and when you ever have to fix something later, make sure to fix it in two different ways on each of the codebases.
Oh yeah, it was an ASP application. So #12: Use ASP!
We ended up just rewriting this thing.
-
In general this is a funny article, and it’s true that there’s a lot of bad code out there, but there are times when managers mess up the schedule and force a developer inexperienced in a certain technology to whip up something in a day or two or their job is put at risk. In that scenario, if you manage to get something that sort of works, are you going to be noble enough to risk your job or just ship bad code you won’t have to maintain later on?
-
#94 written by Javier 1 year ago
#21 Abuse stored procedures and have each stored procedure call another….at least 5 levels deep for each instance.
I took over some code and finding any sql query was like looking for gold. Stored procedures are great tools, but once you get to the point where a stored procedure does nothing but call 6 other nested procedures, you’ve gone too far!
-
#95 written by Mark 1 year ago
-
Donnie,
I was in this situation before, while I was working for a big retail company, I was responsible for one application which is used by 25 internal applications. We enhanced the code and released 13 times in 3 years, however when I asked for a new project, management said you are so good at doing the existing module, there is no need to takeup a new project. The management thought the application so easy because it was never rolled back while all other applications rolled back from their deployment. After 3 years I ended up leaving the company.
Like somebody said the person who fixes the bug gets the credit, hailed as expert where as the person who methodically writes good code, unit tests his code, following good naming conventions branded as a regular guy.
Life is not fair in general so was programmer’s life!!
-
#101 written by JohnQSmith 1 year ago
-
You know, it’s kind of funny. When I sat down to write this article I only had 15 minutes to get it done before I had to be somewhere. I wanted to get the ideas down after 4 frustrating weeks of working with this guy’s code, so I just went for it. When I started, I thought, “There’s no way I’ll remember off the top of my head enough stuff that went wrong to make a worthwhile read.” Turns out, I got to 16 items before I ran out of time and decided to turn it into 10.
The (somewhat) good news, though… It’s easy for companies to take good programmers for granted. Because if we do our job right, things just work and there’s never a big hubbub about it. But nothing makes a good programmer look like a super-hero like a bad programmer. ;)
Thanks for the comments guys! And @Hal, we worked together on some stuff back in like 2000 here in Birmingham. I’m glad to see things are well. :)
-
#104 written by Andrew 1 year ago
If anyone is wondering if this is real, I have been debugging an inherited application for way too long, and the 10 listed points are just the tip of the iceberg with this app. The guy who was responsible for the creation of the app calls himself an enterprise architect no less! It’s good, and a little sad, to hear that this is also a problem elsewhere.
-
As a Corollary to #6:
#6b – Ultra-Performance!
Cache. Everything. And make sure you can identify it easily. Yes, that even means caching the fact that your user made 17 AJAX requests on a given page before leaving. Oh, and for heaven’s sake do not expire the cache in a reasonable time, you never know when you’ll need that data! Your application will be ultra-super-awesome if it can find literally absolutely anything without touching the data-store, even days or weeks into running! -
-
@terry – Yeah, unfortunately it’s for real. I just spent 4 weeks cleaning up a mess this guy made for a really good… and big… client. Luckily the client was cool and I was able to keep my head just above water long enough to get things fixed.
I would have hoped the only people left who call themselves “programmers” were the real deal. But apparently there are still some stragglers!
-
#113 written by terry 1 year ago
-
#114 written by Mad Max 1 year ago
You’d be surprised, but they tend to cling to their jobs–and often survive while more competent people are let go.
I remember a project at a major software company which had never generated any revenue, and it had been around for 20 years. Every year, their manager was the first to run to his pals in higher management and ensure the project would survive one more year; other projects–like the one I was working on, with a large client base–were frozen instead…
-
-
#11: Be sure to add CRAZY functions that override standard built-in functions of the language to “enhance” security. Inside this functions, prevent things like “foreign GET variables” and POST requests from ANY outside source. Then, kill the script with the message “Your IP has been logged.” but don’t actually do anything else.
-
- Bookmark Service
- The Open Source U » 10 way…
- 10 Ways To NOT Suck At Programming | Finalint
- Adam Merrifield { the collective } – the collective thoughts and web works of adam merrifield
- FollowSteph.com – Lazy Friday Reading Assignments
- Loc’s Blog » Blog Archive » 10 Ways To Suck At Programming
- Daily Medicine #5 :: Ward 7 :: Your Web Cure
Didn't find any related posts :(
Loved this article! Bowing down to you in full admiration. I’m not that great a programmer and learnt a lot after reading this! Kudos!