Your Baby is Ugly13 May 2009
I’m not kidding, you have one ugly baby.
Its not your fault…well probably not your fault.
Did you drop him a lot in the first few weeks you brought him home?
I’ve never personally had this conversation with anyone,
- Yes, I’ve seen this done on Seinfeld...if you haven’t watched Seinfeld go grab a copy of the complete series. It still holds up.
- I actually did see someone tell somebody their puppy wasn’t cute...so sort of in the same vein as telling someone their child is ugly. Needless to say, “awkward” doesn’t being to describe the mood the conversation took on.
I’ve never seen anyone tell a parent their child is ugly, however, when it comes to creating software, I advocate telling people who write ugly code that yes, indeed, your code child is ugly.
First, for those of you who don’t design software and write code for a living a little background on the parent/child relationship people have with their software.
Software, like children, requires massive amounts of time and energy. You, as a designer/architect/coder, conceive the code, often times starting with little more than a blank page. From there, you outline the basic functions of your code, you test your code to make sure it meets specifications, and you clean up your code to ensure it follows all of the best practices dictated by your company. Hopefully, in time, when your code is completed you can send it off to play with all of the other code in the system. With any luck, you’ve written a good piece of software that is well behaved, has good manners, and is robust enough to function for many years to come with very little maintenance.
However, with all of the work that goes into the code sometimes it just turns out ugly.
What is ugly code? Ugly can be described in so many ways…it could be:
- Inefficient, taking way too long to perform simple tasks
- Overly complex, possibly a piece of code performs a task in 50 lines where if someone took some time with the code and refactored it the same task could be performed in 10.
- Incorrect, not producing the correct results.
This is by no means a complete list, but a small sample of items I have run into in my career.
Like anything anyone spends any amount of time with people often grow attached to their output. With such an attachment people do not take kindly to having that output being called ugly, be it real life children or code ‘children’.
However, as I have said, it must be done…
To their code children, not their real life children…. geez you are a monster. I’m not sure you should continue reading this blog…
If you can control yourself and your urges for calling kids ugly please continue, we have much to discuss. Otherwise, I bid you good day.
How you tell someone they write ugly code is up to you. I don’t advocate sending a company wide email letting everyone know that Johnson can’t write a for loop to save his life, and he would serve the betterment of mankind if he never touched another keyboard. No, that’s just mean.
Nor would I post their code on the refrigerator and write a large ‘F’ on top of it with a red sharpie…although humorous, after sending that first company wide email Johnson may get the impression of not only do you think he is a horrible coder, but you might not like him either.
No, I’ll leave the delivery of the bad news to the parent of the ugly code up to your discretion, but something must be said, because lets face it, that ugly code child is going to grow up and become your whole team’s responsibility.
Failing to correct ugly code when it is first generated leads to all sorts of problems and heartache. Firstly, for you, you will likely be the one on call when the code begins to fail in your company’s application, and it will be up to you to fix it at 3am on Christmas Eve. You will be up all night attempting to track down the module that is failing, and once you find it you will attempt to get something working as quickly as possible, because every second the system is failing your company is losing money.
This is no way to conduct a career…working under the gun to fix a problem, hopefully you didn’t cause. Especially if it could be avoided by telling the original designer they created one ugly child, and you, for one, do not want to support it when it starts misbehaving and throwing a temper-tantrum.
I recommend several steps in approaching and telling someone they have just written some ugly code:
- Come out and say, ‘I’m not calling your code ugly, but we need to talk about how you implemented requirements x, y, and z.‘
- Lay it on the table that there are concerns about the code, not the person who wrote the code. Attempt to separate the parent from the child.
- I suggest approaching this situation as a learning exercise. Point out why you believe the code, although possibly technically correct, has room for improvement.
- Make sure people know during this exercise this isn’t an indictment on their ability to program or create working algorithms, it just so happens this one isn’t up to snuff and needs some work. The important point is to stress this isn’t personal and you hope to fix the code to avoid problems in the future.
- Be able to back up your suggestions on how to fix the code with industry standards. Share with the individual why you believe their approach isn’t quite correct and show how it is done everywhere else in the industry. Even if you don’t have Johnson’s full respect it is very difficult to argue with how the rest of the world performs a task.
Lastly, put others at ease around you by inviting them to call your code ugly. Separate yourself from what you have created and attempt to learn from their years of experience. It’s the ability to take criticism and to learn from it that will help you grow in your career.