It’s a question many people ask. It’s a question many people want an answer to. But if you try to find an answer to the question “What should I use in my programming?” then you’re bound to find conflicting answers from various corners of the software sphere.
It turns out, that there isn’t any one right answer. Usually, you should do what works for you. More often than not, when you join an agency, you’ll be asked to conform to the current pattern set by the existing team, which itself will likely have been introduced by the first developer in a much younger agency many moons ago.
So, I can’t tell you what to do. But I can tell you what I do and why, and maybe it’ll help you? Who knows. So, here goes…
PHP
You name it, I’ve seen it. People use everything in PHP. Underscores, camel-case, underscores, uppercase, hy… no. Not hyphens. I’ve never seen hyphens.
Why?
Because - Hyphens aren’t allowed in variable names. And, assuming you’re a php developer you should know why. $variable-name is interpreted by PHP as $variable minus name. And what’s in a name? Well, without a $, PHP will assume it’s a pre-defined constant. So, first off, don’t use hyphens.
So, what do I use? I used camelCase. For everything. When it comes to high-level languages, most people use camel-case or underscores. I don’t think there’s anything wrong with underscores - I just happen to find it faster to hold shift and press a key, rather than hold shift to make an underscore, then type the next letter. So my variables look $likeThis. Constants though, should always be capitalised - this is actually pretty standard across most industries. That’s because, in languages that don’t use prefixes, it makes it much clearer. $variable and CONSTANT. Easy to see isn’t it?
Training languages, such as BASIC encourage you to capitalise keywords: INPUT, PRINT, DIM etc. But these days, we have colour-coded editors and it’s very standard to make everything lower-case except constants. Get it?
MySQL
Ah. Well, that’s just blown myself out of the water. When you type a MySQL statement, you DO type the keywords in capitals. That’s because it makes it VERY CLEAR to see which statements are DOOERS and which are ACTORS. SELECT name FROM users WHERE password = ‘hackme’.
By the way - never store plain text passwords. Ever. If you’re ever unlucky enough to be my subordinate and I catch you doing it I WILL FIRE YOU. Storing plain text passwords are bad for many, many reasons.
- People generally use one password for everything, regardless of how you educate them. If this password ever gets revealed to the world from your site, you’ve just screwed them over in multiple ways and they will sue you for every penny you, your family and your whole ancestry has ever earned.
- Regardless of how secure your website is, you can never be sure that your developers have remembered to secure every entry point. One hole, and a hacker can dump your whole database, and as bad as that is for your company, it’s worse for your customers. And then worse for you, when they all sue you.
- My website is safe, I’ve secured all the entry points. Or have I? What about the server itself? All the hundreds of processes and protocols it runs? Can I guarantee the work of the developers of all of those too? No. Never assume you’re safe for a second. Always keep your (to use a terrible cliché) ‘eye on the ball’.
- Ok, So I’m a GOD and everything is so secure I’ll never be hacked. But, it turns out, one of my employees is dodgy, and sold the unencrypted password database to someone for £1,000. They convinced them, it was just a list of passwords and emails for our site which is just a newsletter signup - what could they even do with that info? Easy money! Except they just successfully logged into a range of websites across 100,000 customers and ‘hacked’ several million pounds of wealth for themselves. Well done.
So remember: Watch your code, watch your servers, watch your employees. And if the site is hosted by another company - their employees might not be all on the level too. More security is better. The only difference you’ll have to make by keeping only encrypted passwords is to change your forgotten password system - send people a link with a unique hash ID to change their password, rather than re-sending them their password, which you can’t. Simple. But I digress…
JavaScript
Much like PHP, I like to use camelCase for JavaScript. Simple eh?
HTML and CSS
Oh, where to start. This is often the area I take most issue with other developers. As it turns out, a lot of HTML developers use hyphens in their class and id names. But I don’t - I use underscores.
Why?
Well, remember, hyphens aren’t valid variable names. And I like to pretend that classes and ids are variables. Especially when you have to manipulate these things with JavaScript - hyphens just seem to fail a little. I often relate using it to starting a class or id name with a number. I’ve seen it done by several people. What’s the harm in using or starting a class name with a number? It’s easy to use JavaScript to do cool things like that! Except - you just failed. Numbers aren’t valid variable names. var 6 = 9 just wouldn’t make sense to anyone. If I said to you: ‘6!’. Would you think: ‘He means 6′ or ‘He means the contents of 6, which is 9′? But ids and classes aren’t variables, so why can’t I use numbers at the beginning of them? Well, to me it seems obvious - the people who developed it wanted to be consistent. So, stay consistent. Don’t use numbers at the beginning. And, I can’t stop you using hyphens, but I’ll respect you more if you use underscores.
Oh, and regardless of what you use, I won’t respect you at all if your sites don’t validate. There’s no excuse AT ALL to produce a website which doesn’t validate. Who cares? you ask. I care. And you’ll care when you do something dodgy that messes up in the next version of IE and you have 100 clients within their guarantee demanding a free fix!
Oh, and don’t go around using camel-case in your ids and classes. Because I said so. Generally, you’ll find all good sources of web tutorials will tell you to use lower-case for everything. It’s not good to mix case in HTML / CSS, because of the way some browsers can treat things (and why cause more preventable problems for yourself than you have to?) I know a lot of ASP developers do it. But, just don’t. The web elite web community is quite anal, and they won’t like you for it. And will tell you how ASP is a derivative of Visual Basic which is a derivative of BASIC which is a BABY language. And, I’ll join them in mocking you.
I think that’s everything. Did I miss something? Did I annoy you? Leave a comment!
In case you’ve been living in a box for the past few months, you may have noticed that Apple announced details of their newest creation yesterday; the iPad.
So, several days later the iPhone arrives. The first thing you notice is the box. It’s small. Very small. Much smaller than any other mobile phone box I’ve seen in the past. But don’t be fooled by this size - the box is made to a ridiculously high quality. Opening the box reveals more exciting goodies - and a very well arranged content. From the top there’s the iPhone, then a little pinch pull which reveals the lower compartment and contains the quick start guide. The lower compartment contains an iPhone connector USB cable, USB socketed power plug (beautifully designed) and the less exciting iPod headphones. The box doesn’t contain a manual - just a quick start guide. Although, the phones use is almost self explanatory.
Turning on the phone reveals its high value. Beautiful design, magnificent finger response on the touch screen - it really is a marvel of human ingenuity and progress. The oleophobic coating of the 3GS is an interesting addition. It certainly makes removing finger prints quite easy and if you have dry enough skin like I do, you don’t actually leave any finger prints at all (this makes you less willing to let other people have a play, as they’ll more often than not return it covered in their finger grease). One thing I did notice is that this coating has not been applied to the main press button - which is a shame.
Changing the settings of the phone is quite simple - just press the settings option and everything you need is right in front of you. The default selection of installed software is more than you’ve ever had on a phone before - maps with GPS being my favourite. And of course safari - browsing the web with a real web browser finally! It’s quite hard to fault the phone at all; the user interface is inspired, it’s very fast - at least compared to my old phone, apps. Apps. The app store - who’d have thought how good it was! Remember all those years ago at the back of magazines there were adverts for mobile phone game downloads, wallpapers, ringtones etc? Well, I never bought any. Ever. One week with the appstore and I’d already spent £20 - and most of that on 59p and free apps. Genius.









Our story begins in Derby train station at 6:40am, where we boarded the “West Highland Statesman” weekend excursion train. We were sitting in a very posh premier dining carriage, made by Pullman in the 1970’s and named Apollo. This train would be our home for the next 13 hours until our arrival in Fort William.
Some time afterwards, breakfast was delivered to our table with a glass of bucks fizz. Sausage, eggs, bacon, potato, mushroom etc, it all made for a very happy eating occasion. We were offered some toast later on too, but I think the fry-up was probably enough to start with!
With breakfast gone and the light beginning to appear I began to turn my camera towards the great outdoors and photograph the landscape, rather than food and Ben! Sometime later it was announced to us that one of the carriages had developed a severe wheel flat (a flat tyre if you wheel), and so we’d be travelling a little slower than we were scheduled for and would have to swap the affected carriage out. A flat wheel isn’t as odd as it may seem - one side of the metal wheel becomes worn to a point where it stops rolling properly, and either drags along the rail or makes a bit of a thumping noise.
In Manchester we were joined by Ben’s parents and a couple of his old teachers. It was 11am by this point, and we were glad we’d opted for breakfast just after 8am! Breakfast was eventually served to the newcomers, followed by the dumping of the Buttermere carriage at Carnforth. With the wheel flat out of our way, we were free to chug on to Scotland.
As civilisation disappeared out of the window, food entered our bellies via canapés, several courses of food and Petit Fours. Not to mention the wine and champagne!
Because of the wheel flat earlier in the day, our train was delayed several times successively for sprinter trains to pass as we’d missed our station slots and charter trains are considered a lower priority on the rail network, regardless of delays. At one point, we would only have caused a delay of a few minutes to one train but because of the current system we were delayed by over half an hour instead. Thanks network rail! An extended leg stretch in Rannoch because of the delays meant that we eventually got our coaches from Spean Bridge to the hotel, rather than from Fort William.
On arrival at our hotel, The Ballachulish, we went straight in for dinner and some sleep!
One of the highlights of this trip is Glenfinnan, where we made a stop. The station has a little museum and shop, and we were treated to some bagpipe music on the platform by one of the train’s stewards! Glenfinnan is also home to the Glenfinnan Viaduct, a massive stonework bridge spanning a wide valley. If you’ve ever seen a Harry Potter film you’ll have seen this viaduct - it’s the impressive one the Hogwart’s Express travels over. I didn’t manage to get any photos of it, but I did get an HD video whilst we were going slowly over it on our return.
Now, as it turns out, riding on a train is quite tiring and poor Ben kept falling asleep. Luckily, I was there to capture the moments with my trusty camera. 
My purchases from Mallaig consisted of a fridge magnet and a furry haggis. Now, a haggis is just a type of food - not an animal, but earlier that morning Ben’s parents had told me a funny story about Ben! Needless to say, the furry haggis purchase was apt and amusing.
The next day was another early start, with breakfast, coach trip to Fort William and then catching our nice Pullman train home. It was a much better day on the way back, and parts that were dark on the way up were now clear, providing some spectacular views. 
Continuing our journey home, brought more food, wine and gluttony. Not to mention games. 70’s peg based mastermind and Othello come to mind. I’m quite good at Othello, having played Reversi (the American version) many a lunch time at school, on Windows 3.1 (It’s up in Nebraska!) Needless to say, I won the game against Ben’s music teacher although I did a sloppy job - leaving two of her pieces on the board!
Seeing an easy win, Ben decided to play Othello against his music teacher too, only to be followed once again by defeat. Bad luck old chap!
One of the things the new iPhone 3GS has is an internal geographic compass. This is achieved with a device known as a magnetometer - something which can give you a 3-dimensional X, Y, Z co-ordinate to the magnetic north pole. The great (and sometimes frustrating thing) about these devices is, that they’re influenced by nearby metallic object, albeit, not by much. Still, this ‘negative’ effect is one we wanted to exploit, and turn into the first visual metal detector app for the new iPhone.
During tests I noticed that metals which tend to be more influenced by magnets were also the items most easily detected - Iron was found easily, but Aluminium barely registered. One of the other things I discovered was the influence of magnets on the 3GS - the stronger the magnetic flux, the higher the influence on the 3D geometrics. After this discovery, and our current lack of icon for the project I had an epiphany and said “Flux. This thing measures Magnetic flux too. How about a flux capacitor?”. Anyone who loves Back to the Future will know what that is! This remains my most significant contribution to the project.
After we’d finished producing the app and start of the site, we went to record the video in my dining room, with my Panasonic Lumix (The resolution on that thing isn’t too bad for a video). The final cut of this video features me swearing (sorry about that) and the sound of the doorbell, as a nice man delivers our Indian curry. Mmm.