Sunday, 8 June 2014

Sleep - it's important.

According to the BBC, scientists in China and the US have used advanced technology to study the brain during sleep, determining that a good night's sleep is important to learning.

For a while I have been guilty of under-playing the importance of sleep and I have to admit that I don't do as much of it as I should ... until the weekends anyway.  This is obviously not doing me any favours as I like to learn.

The main problem I have is that I don't like to sleep.  Or at least, I don't like going to bed until I am literally dropping off.  I can easily sleep for 8 hours once I get there, but usually I have to get up for work, meaning I only get between 4 and 6 hours sleep a night during the week, if I'm lucky.

However, I've noticed since losing weight recently and taking more exercise (running mainly) that I am feeling that tiredness sooner than I was.  In the past 3 to 5 hours sleep a night was not unusually with occasional bouts of insomnia.  That hasn't happened in a while.

There are a few main problems which I think contribute to my current sleeping patterns:

  1. Caffeine.  I like to drink caffeinated drinks, my current favourite being Pepsi MAX.
  2. Work addiction.  I'm lucky enough to do my main hobby as my day job.  This means I'm pretty much working all the time.  I'll go to work and code, then come home and code some more.  I love it.
  3. Society(?).  Usually I have to be in an office between 9am and 5pm.

To solve these problems I am going to have to make some changes.

The obvious one is to stop taking caffeine. That'll stop me from being over-stimulated at the wrong times of the day and hopefully allow my body to sleep when it's tired, not just when I get in to a state where I am dropping off.  I'll have to switch from drinking caffeinated drinks to water, though I don't really like water as I find it boring.  That said, I suspect there will be additional benefits to not drinking

The work addiction is just a matter of discipline.  At a certain time in the evening I am going to have to put the computer away and do something else.  Read a book, watch some TV, play a game, anything.  This should get my head in to a mode where it is starting to relax instead of trying to solve problems.

There's little I can do to change the working day, but I wonder if this is something society should be looking to address.  My job involves technology and I don't work a shift in a factory, so why do I need to be in an office at particular times of the day?  I do know that I have to work as part of a team and working face to face is far more effective than working remotely, a conclusion I have come to after 15 years of trying various working methods.

So that's where I am just now.  I'm going to make a conscious effort to get more sleep and improve my ability to learn, as well as get the other health benefits associated with sleep.

Do you get enough sleep?  If not, what do the think the main reasons are and what do you plan to do about it?

Friday, 23 May 2014

Should I use Google or Amazon for my new awesome app?

That's the question I've had to ask myself recently.  The findings and conclusions below are based on plenty of experience of Amazon AWS and somewhat outdated experience of Google App Engine )with a bit of a recent refresh of knowledge for the purpose of putting together this blog post).  Feel free to correct me in comments if I've made any mistakes.

Overview: Google is a PaaS (platform as a service), Amazon is an IaaS (infrastructure as a service).  This means more flexibility when designing a solution architecture with Amazon, but at the expense of having to do additional system administration. However, BeanStalk gives you a pretty close equivalent of GAE with minimal admin overheads.

Services: Fairly similar range of offerings, though Google doesn't appear to have an equivalent to Amazon's SQS (message queuing) - this may not be relevant for your app, but there are benefits to building large scale applications, loosely coupled using message queues for passing information.

Cost: Pretty similar though Amazon has a better range of options for reducing cost as the app scales.  Amazon are regularly reducing their prices on their AWS products.

Software Development / App Restrictions: Since you're deploying in to Google's PaaS, they restrict how you can write your application (e.g. no Threading, white list for Java classes) to maximise compatibility with their platform.  This needs to be considered during development as "normal" things Java developers are used to may not be available.

Data Access: With Google, if you don't use their RDBMS, then you have to use their "datastore" which gives you an interface with which to query the data.  The same is available with Amazon's DynamoDB.  However, DynamoDB supports joins and aggregate functions where as the Google's datastore does not.  Neither appear to provide an out of the box user interface for accessing data in their RDBMS service (which is basically MySQL so not exactly difficult anyway).

Data Security and Privacy: Both companies appear susceptible to a recent ruling with regards to data in the US.  If data protection at this level is a concern then neither Google or Amazon may be appropriate.  See:

There are UK alternatives if that's a problem you or your customers (e.g.

Maturity: Both are fairly mature now, but AWS has been around a longer.  The relative maturity of AWS over Google is reflected in the extensive administration console user interface.  Both provide command line tools and APIs, but Amazon's user interface is more complete (IMHO).

Support: Both offer support with varying turn around times and channels.  Amazon appears to be cheaper:


Amazon have regular official seminars, webinars and meetups (usually in London, but I've heard of some in Edinburgh too) to discuss their AWS features as well as an annual conference.

Google has Google I/O which is an expensive two days (since it's in San Francisco, I've been though and it is good ;-) and covers a range of stuff not necessarily specific to their cloud platform.

Conclusion: I don't see much point restricting yourself with Google unless there is a strong requirement for it (e.g. it allows for better integration with something Google specific).  The additional system administration of using Amazon AWS is outweighed by the flexibility and can be mitigated by using BeanStalk (initially) and automation (as the app grows and scales).