Code consistency versus smart computers

We always say that consistent looking code is one of the best indicators of well written code. It helps other developers read your code and understand what you have written. Computers in a way force consistency. If you forget a semi colon in PHP it breaks the script completely. If you place a bracket in the wrong position in javascript it produces errors. If you miss a colon in CSS it will produce an error and your style will be missed. There are many instances where your code is forced into consistency. Names of functions, tags, elements, method, classes don't change, we call them exactly the same every time.

Computer screen displaying a tag labelled dumbBut what if computers were smarter, what if we could miss a semi colon or miss a colon and the computer worked out what we meant. What if instead of defining a colour by its hex value we defined it by a resembling object such as a banana, the sun or a blue sky. Would this make our lives easier and allow us to create programs quicker, or would it just cause chaos? At what point in time does a lack of consistency cause mayhem?

XHTML forces us to be more strict, we are told to close our tags, always use lowercase and make sure each attribute has a value. This causes consistency and makes our code neater and easier to read.

HTML 5 goes in the opposite direction. We don't have to close tags, we can use what case we want. What HTML 5 does is allow messy code, it allows inexperienced web developers create websites. HTML 5 forces parsing engines to be smarter, it forces them to render pages on what it believes we are trying to create and gives us more flexibility to be sloppy.

Alert box asking - You don't understand your computer. Do you want to change thatSo what does all this mean? Should programming become more like the English language giving us flexibility and creativity. Should everyone who knows the English language have the ability to program. If this is the case then HTML 5 is on the right track. Maybe we should stop with this consistency theorem and start working towards smarter computers. Let our computers gather intuitively what we mean, let them do the work and gives us a break from all the syntax errors. Let computers read our pseudo code and realise what we are trying to do. Let computers figure our when we are writing insecure code and fix those holes for us.

This day seems like it is a long long way away. So until then, maybe it's best we keep the strict rules and program consistency. If that is the case then we should all treat HTML 5 as a strict markup language and do the right thing. Not for us but for the next developer that has to read our code.