Why You're a Bad PHP Programmer
Why You're a Bad PHP Programmer
Why You're a Bad PHP Programmer
We all have our bad habits. In this article, we'll go over a list of bad practices that are worth examining, reevaluating, and correcting immediately.
Who the Hell Do You Think You Are?
Every time I open a project that isn't mine, it's accompanied by a tinge of fear that I'm walking into some kind of Temple of Doom scenario, filled with trap doors, secret codes, and that one line of code that, upon alteration, brings down the entire app (and possibly sends a giant boulder hurtling toward me down a narrow hallway).
When we're wrong, and everything is fine apart from some minor differences in "how I would have done it," we breathe a sigh of relief, roll up our sleeves, and dive into the project.
But when we're right Well, that's a whole different story.
Our first thought upon seeing this unholy mess is usually along the lines of, "Who the hell does this guy think he is?" And rightfully so; what kind of programmer would willingly create such an unholy mess out of a project?
The Answer Might Surprise You
Awful code is the accumulation of multiple small shortcuts or concessions.
Your first instinct might be to assume that the guy who built the project is a novice, or maybe he's just an idiot. But that's not always the case.
My theory is that awful code is the accumulation of multiple small shortcuts or concessions just as often as it's the product of inexperience or stupidity. This makes the Temple of Doom app much scarier, because whoever built it might be just as smart, savvy, and well-read as you are. They just got lazy or put things together in a rush, and each of those little shortcuts added up into the winding nightmare that just fell in your lap.
Even scarier, this could mean that at some point, someone inherited your code and immediately burst into tears.
You're Better Than That, Baby!
It never hurts to reexamine your current practices and make sure you're not taking any shortcuts that could be contributing to someone else's lost sleep.
Let's take a few minutes and go over some common shortcuts, concessions, and other bad practices to ensure that our projects aren't striking fear into the hearts of the villagers.
You Don't Plan Before You Start Coding
Before you write a single line of code, you should have a solid plan of attack.
Before you write a single line of code, you should have a solid plan of attack. This helps keep you on track and avoids wandering code that will confuse you later, not to mention some other poor soul.
One approach that has saved me time both in development and in commenting is to write an outline in comments first:
view plaincopy to clipboardprint?
Watch Incendies 2010 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Incendies 2010 Watch Wow! Wow! Wubbzy!: Wubbzy Goes Green 2010 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Wow! Wow! Wubbzy!: Wubbzy Goes Green 20 Watch Point Blank 2010 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Point Blank 2010 Georgian Granny Shuts Down The Internet Watch Fading of the Cries 2011 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Fading of the Cries 2011 22 Day Internet Marketing BootCamp Review - Legit or Scam? DISH Network English Packages – an Ultimate Choice for all the Television Viewers DISH Network Standard Receivers – Must for Better TV Viewing Watch Paradox 2010 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Paradox 2010 26-Week Internet Marketing Plan Review - Legit or Scam? Watch Ferocious Planet 2011 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Ferocious Planet 2011 Watch Strapped 2010 Movie Online For Free, Streaming, Megavideo, HD, HQ, Download Strapped 2010 Rewards Network, Inc. (NASDAQ: DINE) $119M (MarketCap) Getting Acquired