So Many Rights & So Many Wrongs

Beacon Blog Article

By Beacon News | Published July 21, 2011 | Categories: Web Development

Some people think there is no 'right' or 'wrong' way to code. I agree and disagree. I'm not saying there is only one right way and all developers should live by this method. I'm saying that there is a wrong way for anything. People can go about the same thing in many ways and it would be considered right. Each developer has their own style and comfort zone in how they do things and as long as it is efficient, doesn't bear on page performance and doesn't fall into the 'wrong' category then it's still considered good code.


  • Following the rules that the W3C has defined for creating websites
  • Following Web Standards, Best Practice and the KISS principle
  • All code validates and runs error free
  • Separate content from presentation
  • Semantically correct markup
  • Fully minimized and clean
  • Makes sense


  • Using things in a manner they were NOT meant for (ex. tables for layout)
  • Hacks that are unneeded (hacks are normally only needed for bad code)
  • Overly complex (adding in some code because it was too simple)
  • Re-writing built in functions (re-inventing the wheel of php)
  • Doesn't make sense


To fully explain things there is the W3C which is an organization that standardizes Web technologies. They are the people who define how the web works in terms of HTML. Following these rules will not only keep the need for hacks at bay but it will also keep your code valid because that is what you are validating against when it comes to HTML and CSS. Yes... you are validating your code against the rules they have outlined for you. So tell me again why we wouldn't follow the rules?

As for fully minimized and clean I mean can I look at it and point out anything not being used? Did the old stuff get cleaned out? Are there unnecessary things? Are there too many unneeded wrapping divs? Is the programming of the code logical? Can it be done in a simpler way? Basically take the code and remove everything you can from it. Make it as small and compact as you can without losing any functionality. Once you're done it is minimized and clean.

Overall when I say there is a 'right' way I mean when any knowledgeable developer can look at the code and figure it out almost instantly because it is done the way it was intended and follows Web Standards and common sense then it is good code.


Ahhhh the 'wrong' way. Man oh man is there a definite wrong way of doing anything in life. Let's take going to a grocery store that is half a mile down the road. What is the right way to get there? There are a few ways that would work I mean you could walk, take a bus, ride your bike or even drive your car. All these work and are logical. Well what about walking 1 mile the opposite direction to get on a bus that takes you to the airport where you fly round trip to the furthest destination and on return get a rental car and drive straight to the grocery store. This in my eyes is wrong.

It may seem dramatic to some but you have to admit that's not the most efficient way to get to the grocery store. You might catch yourself thinking 'Why would anyone do that?'... And that is a good indicator question that determines bad code.

On a less obvious side there are other things that make it the 'wrong' way including invalid, erroneous, weighted, hacked and non-logical code. When people use tables for layout it is actually wrong because it is invalid. If errors pop up or it takes triple the time to load due to controllable factors it is wrong. If you use JavaScript to apply CSS classes or inline styles when there is no JavaScript functionality on the page then it is wrong. If you are re-writing built in functions for any scripting language then it is wrong. These are just a few examples that there are wrong ways of coding things.


In conclusion I understand that some developers use floats and some use positioning this is their style and both methods work. There is a difference between that style factor and the just plain wrong or outdated factor.

I know I can't make everyone a believer overnight, some will just always believe if it runs then it must be good code. However I encourage you to Google the 'benefits of web standards and best practices' and after a few good reads go ahead and try to search for the 'downfalls of web standards and best practices'. Since I don't know of any downfalls please comment below if you do find any.

Also stay tuned for more blog posts about this topic.

Let's get to work!

Contact Us