Code Conventions

Recently I put together a set of markdown files for the few different web languages I write a lot of code in, these being HTML, CSS (Sass), JavaScript/jQuery, and CFML. I have these located on my GitHub page under a repository named Conventions

I put together the set of conventions for a few different reason. I thought someone might be able to get something from it, or for when I release open source code/ library’s I can point people to them, the final reason being I can show people the method to my madness if they every cross my code paths.

While the conventions documents are not 100% full proof I will be continuing to add and tweak little items as I can continue to write more code and find my rhythm.
A lot of what is already documented is straight from how I write my code at the moment, if I see a pattern in the way I write certain parts of code I document it as a convention, simple as that. I don’t go out of my way to write a convention to change the way I code, I write the conventions on the way I am coding.

I feel conventions should not be something you force, obviously this can break down within a team environment, but that’s a whole different story. While the conventions I have documented do contain some ways of writing faster/better code, a lot of what I have documented is personal preference and more style based.

A simple example of one of my conventions, spacing around if statements:

if ( x ) {

Instead of


o2 Price Increase, read the small print

So I got an email today from o2 saying about the increase in my phone bill. the increase will be 3.2% and will be on the next bill after the 28th February 2013, increasing my months bill by £0.83.

While at first I was a little pissed of, thinking how can they just increase my phone bill, when I signed up at X amount a month for 2 years. Then I sat back and thought about it, hang in, I signed a contract when I signed up for my phone, like any contract there must be something in there about this and low and behold there was.

o2’s Terms and Conditions, state:

5.2 We may increase or decrease our Charges from time to time. If we increase our Charges (apart from for Additional Services), we’ll let you know at least 30 days before the Charges are due to go up and you’ll have the rights explained in paragraphs 5.3 and 5.4. We won’t increase your Monthly Subscription Charges more than once in any 12 month period.

Fair enough, in clear black and white, they say they are able to increase or decrease charges from time to time. Simple you signed the agreement when you took your contract out. Just like any contract it’s up to you to read it and make your mind up if you are happy with their terms.

While I can see how some people are not happy with this, and I can see that some people can say that you do not have much choice as you can not really negotiate with a huge company like o2 on their terms and conditions, but you also do not have to sign the contract. Read the contract!

Does everyone hear things the same?

I often ask myself do people hear the sounds I hear the same as I hear them?

I know some people can be deaf or partially deaf, but I think that’s something different to what I am trying to understand.

What I am getting at is, when you speak you can hear your voice, when you speak to someone they hear your voice. Is the sound of your voice you hear identical to the sound the other person hears?

One of the reasons I have this thought is, I recently heard myself in a recording and it sounded very different to how I hear my voice, now this could be down to the recording device, but I have tried this across a few devices and all sounds are the same.

Am I that different?

I don’t think I am anything but normal, but, when I start to think about things and question pretty much everything within my head I feel maybe I am different. But am I? Do other people think to the levels that I am thinking?

It’s hard to put a finger on why these thoughts enter my head, but it’s not the thoughts that are the strangest parts, it is the depth these thoughts can go to.

Have you read the Terms of service?

I am a huge fan of 37signals, their products, their work ethos, their office. I have both their books and have followed their blog for as long as I can remember. I am not going to bore you with how much respect I have for the company and what they do.

One reason I follow them quite closely, is that they are open about the stuff they do and share this information on their blog. Being a company who produce web applications used by hundreds of thousands of people on a daily basis, I find their openness and willingness to share stats and information regarding the setup, and how they run and manage their company a great insight to their company. Maybe I am slightly nosey, but I do not expect them to share how much money they are making for example.

While this is not a blog post aimed at 37signals, it was what happened on their blog the other day that made me finally write it.

So, in 37signals’ usually manner of being open, they blog some insight to the numbers their company/apps/business deals with in things like support cases, requests, files stored, etc. See blog post here

One of the bullet points was

And a Basecamp user uploaded the 100,000,000th file (It was a picture of a cat!)

While a lot of people may take that as quite funny, it seems a lot of people have commented about their privacy is now under threat as 37signals maybe looking at users data.

This leads me onto the bigger picture…

How many of you use online services, such as Google? Facebook? Dropbox? Well, pretty much any online app that you store, share or post information to? I am guessing most of you do. Next question, how many of you have actually read the Terms of Service for these services? I am guessing about the same number as if you have then the number to the first question would be VERY low.

Lets look at the Google Terms of Service, I am guess a lot of you use either GMail or Google Apps, I know I do.

11.1 You retain copyright and any other rights you already hold in Content which you submit, post or display on or through, the Services. By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any Content which you submit, post or display on or through, the Services. This license is for the sole purpose of enabling Google to display, distribute and promote the Services and may be revoked for certain Services as defined in the Additional Terms of those Services.

The above, was taken straight from the Google Terms of Service, let’s look at this more closely. Google states that you remain copyright and any other rights to the content you submit to their services. By the next sentence is where it gets good.

By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any Content which you submit, post or display on or through, the Services.

Here they are saying what ever information you submit, post or display you are giving Google free rain to do what they like with it. You are even giving them rights to publicly display your information. So if you are sending sensitive information across GMail for example, you just gave Google the right to reproduce this information and publicly display your content. This also means Google employees are free to poke their nose’s into your data and you have agreed.

While Google have this in their Terms of Service, and I am guess many of you are unaware of this, other companies have stricter rules for example Dropbox who state:

We guard your privacy to the best of our ability and work hard to protect your information from unauthorized access. Dropbox employees are prohibited from viewing the content of files you store in your Dropbox account, and are only permitted to view file metadata (e.g., file names and locations). Like most online services, we have a small number of employees who must be able to access user data for the reasons stated in our privacy policy

Even though you are using a third party service which in some cases you are paying for, your information is being stored on someone else’s hardware, and in some cases being transmitted across a couple of providers (ie, from Dropbox’s server across to Amazon’s for backup). While 37signals meant no harm in what they posted (they have since posted a reply), it did create a riff in the comments, but what you are doing is putting your content into someone else’s hands and while 99.999% of people/companies have strict rules regarding privacy and data encryption and the rest there is still a chance someone is able to see your data.

But you must remember that all these companies will have monitoring software in place to watch how their applications/services are performing and to make sure customers are not breaking their Terms of Service. In 37Signals case the filename is logged and they saw the name of the 100,000,00th file was name cat.jpg, big deal, maybe they were not clear in their post that all they saw was the filename, they thought it was funny and decided to share it. But at least all they are seeing is the filename unlike Google for example who you are giving full access to your data.

I am a massive internet addict and use all the services I have talked about and more, and I will still carry on using them to store my information in the ‘cloud’. But will you? Maybe next time you sign up to some new service you will read the Terms of Service first.