If you run a website or blog then you might not consider yourself to be a programmer – particularly that is if you run a blog in WordPress or in Blogger. However chances are in many cases that you will program to some degree even if you don’t think of yourself as someone who does – for instance you will probably have to deal with some basic HTML even if you run a WordPress blog if only to insert new lines and the like. At the same time, if you do take the effort to learn some programming you’ll find that this is an incredibly useful skill that enables you to give your site lots of new features, to make changes and tweaks. Meanwhile it will also help you to monetize your site in a number of different ways with mobile apps, Facebook apps, Java games and more. In other words I’m telling you that if you don’t code then you should. And now I’m about to give you a great little tip to help you do that better. So listen up.
Basically what I’m advocating here is organization and simplicity in your code. I’m not talking about just making sure that you use indentations – in fact that’s not particularly important – rather I’m talking about naming your variables in a smart way, using subs and functions wherever possible and annotating, annotating, annotating.
I say this because I’ve recently been programming a lot making apps, and apps are a living embodiment of the iteration cycle – you release an app and then are able to update it on the fly in response to comments and reviews. It’s never ‘finished’ as such and you’re always adding to it and tweaking it which means the app you start making won’t necessarily be the one you finish off with or even resemble what you had planned.
In other words you will be adding new features, changing old features and altering things you aren’t planning on altering now and that’s why you need to keep things organized. Otherwise when your multifunctional app is capable of doing everything it will be impossible to understand the code when you come to it.
The same goes for your HTML and for your PHP – treat your code as though a child was reading it and annotate every single last detail and section it up in an obvious way. In other words where you have the code for your first menu, put an annotation at the top to say ‘MENU 1’ and at the bottom to say ‘MENU 1 END’. This way when you’re glancing at it you will instantly know what everything does and when the code gets long you can do a search for the ‘bookmark’ that you need. This also means that if you do hire web design or other experts to help you with your optimization etc., that they will intuitively be able to find their way around.
A Particular Kind of Refactoring
Refactoring is the art of reprogramming a code that already works pretty perfectly with the goal of making it work perfectly more efficient thus saving you on resources. However the kind of refactoring I’m interested in is refactoring for you. In other words that means coding in a way that makes adding new bits really easy. Have a series of grids on your front page that contain content? Then naming them grid1, grid2, grid3 means that in order to add six more you can simply copy and paste that code into notepad and replace ‘1’ for ‘4’ etc.
This will save you time, but more importantly it will enable you to do things on your site and in your other code that you otherwise just wouldn’t be able to get your head around.
Tom Koh is an avid blogger who writes informative articles when you buy website visitors internet marketing.