LISTEN UP RECRUITS! This is Good Code Basic Training! I'm Sergeant Soccly, and it's my job to get you newbies up to speed on the problems this profession faces so that you can be prepared to deal with them.
Our mission is to fight the evils of bad code design, and the citizens need you meatbags to help us do that. Your nation thanks you for your service, and your contributions will...
Jenkins! Shut your mouth while I'm talking! Or is there something you'd like to share with the rest of us?
That's what I thought. Now listen up, maggots!
This great nation is plagued by three diabolical villains, three masterminds of confusion that represent the greatest threat to good code this country has ever seen. They call themselves the Bad Design Syndicate, BaDS for short, and they're about to be your problem just as much as they are mine.
All of you programmers will encounter these characters sooner or later. So pay attention, because I'm only going to say this once!
This first one is all looks, no brains, but he knows just enough to be dangerous. His keyboard's C and V characters are rubbed off. He makes his code look like Bart's chalkboards. His only goal in life is to be done. He is the Copier, and he's the muscle of the group.
The Copier doesn't think about how best to solve the problem at hand, he just Googles for a solution and pastes it in. His preferred weapon is a giant tub of Elmer's. As you can tell, he's not exactly the sharpest tool, but don't let your guard down, because if you're not looking he'll sneak an untested snippet right by you!
He may sound easy to fight, but he's very persistent. He doesn't want to think, and to do this he will spare no effort in copying and pasting the exact same code he's written again, and again, and again. He can't fathom why he would need to make code reusable, because to him, a keyboard has already made all code "reusable".
He's the first on this list because he's easiest to predict. But don't slack off! The next villain is much harder to combat.
She's scheming to hijack all of your spare time with her inane and tedious "improvements" to your code. She's constantly got her head in the clouds, thinking about ways to improve the design and make it more "functional." Everything she touches she makes bigger. She's the Completer, and she's the coordinator of the group.
The Completer is always thinking too hard. There's no scenario she hasn't considered and coded for. She wants to make sure every possibility is covered, every desire is implemented, every thought her client has ever had is already written down. She needs to control everything, and that's what makes her dangerous.
Anything she writes will be more complex than it needs to be, and whenever you ask her why she did something in particular, her answer will always be "because I thought it would be nice to have." Don't fall for the trick, rookies! She's just trying to throw you off her trail.
While she is dangerous, she's not half as bad as the final troublemaker, who's mere name sends shivers down any experienced soldier's spine.
This guy's motto is "code is hard to write so it should be hard to read." He's so confident in his abilities that he spends days making code as dense as possible. He wants you to despair whenever you have to read his code, because that just proves how smart he is. His calling card is written in Hungarian. He's Clever-Man, the leader of the Syndicate, and while he's not smart enough to pick a better name, he's the biggest problem this nation has.
Clever-Man needs to be smarter than everyone. His code works, sometimes even works well, but it's not readable, and that's just the way he likes it. He gets off on making others feel dumb. We suspect that he wants us to validate his existence, that he thinks we're mere toys in his game. He needs to feel smarter than everyone around him or he'll just, I don't know, explode? Metaphors are not my job!
We've been dealing with him for as long we've been dealing with that vicious hybrid rabbit-falcon in Babbage National Park, but just like Paul, he never seems to give up. Just be aware that you can't beat him directly, as you'll never be able to convince him that he's not as smart as he thinks he is. You'll have to use a more subtle approach.
So, newbies, any ideas on how we can beat these guys? I'm listening!
And you call yourselves programmers! Well, lucky for you unimaginative lot, we've already got a few tools we can use to combat these menaces. These are standard issue for new programmers like yourselves. There's only one trick to using them, and that's remembering that you have them.
Don't repeat yourself! You rookies are not very good at this; sometimes I have to ask you three times before you give me the correct answer. Don't continue making that mistake! The Copier will eat you for breakfast if you keep it up. Write code once, and use it as much as possible! If you copy-and-paste you are doing it wrong!
If you are thinking, "oh this might be nice to have and it'll just take a second," the Completer has you under her spell. Don't be fooled by he bewitching good looks and her false temptations! If it isn't absolutely necessary, you aren't gonna need it!
Keep it simple, stupid! Clever-Man hates the very name of this tool with a passion, so we use it every chance we get! Don't make things more complex than they have to be! Don't forget: cleverness is the enemy of understanding.
These three tools are your best weapons in the fight against the Syndicate! Don't forget to take them with you every time you go out on patrol, because you never know when they may just save your ass. If you use them correctly, with a little luck, you might even persuade one of these villains to change their ways. Good luck with that.
That's all for today, rookies! Get a good night's sleep, because tomorrow the real work begins. Jenkins, thank you for volunteering for extra shifts! Report to my office. The rest of you: Dismissed!