Author: Matt

  • High Performance Static Websites on Amazon S3

    I’ve been seeing more frameworks lately for generating static websites. The reason for these becoming more popular recently is the result of several developments.

    1. Cheap shared hosting is notoriously unreliable, slow servers overloaded with too many websites and hacked servers being able to infect and hack many other sites at once.
    2. The development of 3rd party services such as Disqus to power the dynamic parts of a website with embedded javascript. (removing the requirement of server side logic)
    3. The scalability, performance, uptime and low cost provided by Amazon S3 and their CloudFront CDN service.

    The difference in cost between a scalable dynamic site and a scalable static website can be staggering.  So if there is a way you can convert a website over to be static (perhaps with a daily or hourly upload of new content) it may be worth your while.

    A website with 1 million page views per month on Amazon S3 with CloudFront would cost roughly $6/month depending on the size of the assets.  Building up a simple server configuration with 1 database server and a webserver with small EC2 instances would bring the costs up around $150/month.

    One of the nice things about developing a static website is that you can script things however you want to.  Concatenate strings in bash or PowerShell or go all the way to having a complex database backed CMS system and template engine.  It also means massively less complex server infrastructure.   No more nginx reverse-proxied gunicorn server paired with a database server and a host to tools to monitor uptime and send alerts should things break.

    It’s for these reasons that I am working on my next project to have a static website backend instead of a dynamic django app.

    Using a template engine like Jinja2 it is trivial to convert content over to static files ready to be uploaded.

    Some tricks may be needed to handle things in a more complex static site.  Perhaps a small light server to refresh the static content every hour, or to run scheduled tasks, or to do other various asynchronous jobs.  Still the costs can be brought way down if your servers don’t have to handle the web requests.

     

     

  • Exercise for Programmers

    Staying on top of your game is best accomplished by continuously learning and by ensuring you are mentally and physically at your best.  As a desk jokey it can be difficult to get enough exercise in a day so you have to be pro-active about staying in shape outside the office.

    For several years I did a lot of running, 4-5 times per week I would run between 5km and 30km. Running is a great exercise because:

    1. it’s intense – you can always push yourself to run faster/further.
    2. Very little equipment required – just running shoes
    3. Local fun runs and races to keep you motivated
    4. Great way to see your neighbourhood from a different perspective
    5. it engages your entire body

    After moving to a new city running became  less enjoyable due to poorly maintained sidewalks and the only walking paths close by are along a noisy highway.  So I discovered something else to focus on.  Strength training.

    Strength training has a number of key benefits to health.  It makes you prepared for those few days a year that require lifting and moving heavy furniture or equipment.  The last thing you want to have happen is to throw out your back when doing some chores around the house.  When it comes to strength training the classics seem to be the most effective: deadlifts, squats, and bench press.

    Regardless of if you choose to do running, strength training, cycling, swimming, walking or yoga it would be wise to trade some evening TV time for some physical activity.

  • Cockiness of Programmers

    There’s no doubt that programmers are lazy people.  Anything that can be automated is, copy/paste code – you got it!

    There is another trait of programmers that they assume because they can program in one language well, and have touched a few other languages over the years they can quickly learn a new language on the job.

    Programmers are arrogant about their own skills.

    The article What If Cars Were Rented Like We Hire Programmers? exemplifies the problem though their analogy is not accurate.  A programmers job is more like the mechanic or factory worker building the car.  If you had built or fixed only Subaru Imprezas for 10 years then you are not amazingly qualified to fix Fords.  If Ford is looking to hire, they know that there are 1000’s of mechanics more experienced on their cars in the pool.

    I say this because after several years of writing Javascript, learning on the job, I finally decided to pick up a book.  The first thing I learned was just how much I didn’t know.

    More programmers need to read books to master the skills they need on the job instead of relying on Stack Overflow and Google to solve all their problems when they arrise.

    The thing to watch out for is the situation where you read someone else’s code and say to yourself “I have no idea how this works, or what it does”.  As a programmer that should be a red flag – you don’t completely grasp the language syntax.

    If you don’t have a complete handle on the syntax of a language chances are you also don’t know how to write idiomatic code.  Without those two things mastered the code you do write will be poorly organized and buggy. The next programmer to come along to work on your code will hate you.  You will be that guy who everyone bitches about for writing bad code.

    Bite the bullet, read a book from time to time.  Always be Learning.

     

  • Bitcoin

    Bitcoin has been in the news a lot lately and I’ve finally got into the game with a small investment to play with.

    Bitcoin is a new form of currency  which is technically quite ingenius but from an economic standpoint is quite unstable.  It’s basically a digital, anonymous, peer supported replacement of cash.  Each transaction is confirmed by others participating in the bitcoin network so that fraudulent coins are not spent, and money isn’t spent twice.

    The value of each bitcoin has soared over the last 2 months from $30 to over $200 per bitcoin.

    The way new bitcoins are created is through an algorithm called ‘mining’.  It’s designed to grow the number of coins linearly regardless of how much computer power is mining or how many are being used.

    This is ultimately the biggest problem with the currency.  Lack of control over the supply means that the price of it is dependant on demand on currency exchanges.  The price of a bitcoin is skyrocketing because recent news coverage has created an exponential increase in people wanting to buy some while the supply of new coins can’t meet that demand.

    Markets are fickle things, especially when untrained non-sophisticated traders are working the markets.  Quick emotional reactions will at some point result in a crash.

    If you were using bitcoins right now to do business you’d be having massive deflation effects.  The value of the bitcoins you have would be going up and therefore anything with a fixed price is becoming more expensive in hard currency.  If you were paying your employees in bitcoin then over the last 2 months your business expenses would have increased by 7x.

    In Canada the Bank of Canada’s main job is to manage inflation.  Steady inflation is what allows us take loans and expect to be able to pay them off, to hire workers at a set wage, to set product prices and have them maintain the same price day to day.  The controls over inflation don’t exist in bitcoin so the risk is quite high.

    I’m not sure where it will go in the future.  Will bitcoins hit $1000 each?  it’s possible. $10,000? maybe.  It will for sure be a bumpy road though.

  • Andromeda’s Savior v1.1

    Icon-72A late night of coding produced the first update to Andromeda’s Savior submitted to iTunes.

    This new version brings a health bar, a bunch of new enemies to shoot, and much improved Game Center integration.  It also includes a check to prevent people from cracking the game and getting free upgrades.  To date there are almost $5000 worth of purchases that have been given without payment.

    I’m particularly interested in seeing how the game center stuff works to improve the replay-ability of the game.  It will now show you, as you play, a picture of your friend who has a higher score than you as an encouragement to challenge your friends.  It adds focus to the players playing the game and should at least for some people egg them on to play more and for longer.

    The new update should be in the store next week.

     

  • Produce as Much as You Can

    It took a long time to really  fully appreciate the feeling you get from producing something new in this world and letting it go for sale or for free.

    There’s a lot of apprehension that comes with those first few products you release.  You worry about the bugs that are still there, the features you didn’t have time to implement and the competition that is fierce.

    Until you release something to the public for consumption it can be as perfect as you imagine in your mind.  Real life users never match up to your expectations – they don’t know how to use it. where are the features are, what it’s for etc.

    You put a lot of time and effort into building a new product.  Much of the skill that goes into creation is learned through school and books.  The things you learn from the first release of your product to the public can really only be learned by doing it.  The only way to get better at releasing your work to the public is to do it often enough to gain experience.

    So create as much new stuff as you can in this world.  Get it out there for others to use.  Learn as much as you can.  And then do it again.

    It’s the most addictive thing I know.

  • 6 Tips For a Successful Project Plan

    The difference between a successful project and one that is a dismal failure can often come down to the project plan.  There are different approaches to planning from ad hoc planning to full on gantt charts in MS Project.  I think there are some universals for developing a plan that results in a project that works as expected.

    1. Have a Vision

    It’s not smart to just be reactionary – someone asks for a feature, you add it.  That just results in a mess over time.  SpaceX the private rocket company run by Elon Musk, runs every decision through their goal question. “Will this help us get to Mars?”  By running every decision through this one question it helps to make sure that they don’t detour  slowly over time.  Figure out the end goal.

    2. Set Waypoints

    Figure out a series of releases that you could hit along the way to your final vision.  Ideally have things that can be done in less than a month.  Quick releases helps keep the momentum and allows you to test assumptions early, as well as build skills necessary for a better final project.

    3. Trust the Numbers

    You will make mistakes, misunderstand the market, have difficulty finding an appropriate sales strategy and have UI designs that your customers don’t understand or features they don’t want.  You will.  Be sure to have the analytics in place early to determine what actually works, and re-adjust your plan for the realities of the market as you discover them.

    4. Budget, Scope, Schedule

    If the project you want to finish cannot be done on time, on budget, or with all the minimum features then you have to face the real problem of re-evaluating the project or deciding to find something else.  Of course accurately knowing the costs of a project before hand is impossible.

    5. Talk to people

    You can’t create a a successful business in a vacuum.   You need customers.  They may not know what they want, but you definitely need to communicate with them.

    6. Track progress

    When you don’t track progress towards hitting your waypoints it is inevitable that deadlines will slip and scopes will balloon.  Tracking deadlines provides a bit of extra motivation to you and your team to work harder and more focused.

  • How to SOA an existing project

    SOA or service oriented architecture is a way of building a complex project so that each individual unit can stand alone with a documented API.  There are many benefits to taking an SOA approach to designing a complex software system.

    To those familiar with programming, SOA provides the same sorts of benefits as OOP but at a higher level of abstraction and with a network interface rather than a code interface.  The benefits of providing encapsulated logical units that can hide the complexities is well understood by most experienced programmers.

    For a business taking a SOA approach to building a complex project makes a lot of sense.  It allows teams to be divided into smaller groups to reduce the communication load and help limit the scope of the problems that any one developer has to concern themselves with.

    So how do you take a monolithic piece of existing software and change it to SOA?

    The first and perhaps most critical decision to make is where to cut your application into pieces which can become isolated services.  The most obvious first approach might be to cut between the GUI and the business logic.  That is usually NOT the best thing to do for any real complex project.  Deep coupling of the UI usually makes this division much to big for an initial undertaking.

    Likewise starting with something too small can lead to an abandoned project.  A simplistic project that can be ‘finished’ such that no developer ever has to be familiar with how it was built can lead to problems down the road when it breaks and no one knows how to fix it.

    So an SOA unit should be logical,  it should be not too big that it is destined to fail, and not too small that it can be forgotten.

    A further guide to finding an aspect of the code to pull into a service is whether it will have more than 1 customer or could have more than 1 if it was a service.  By customer I mean anything that might want to call into it’s API.  For a HR system the customers might be the GUI used by HR department, tools used by managers, excel spreadsheets used by the CFO and a business intelligence dashboard for the CEO.  With that many potential customers of an API there is a strong benefit to having an SOA approach compared to asking HR for quarterly reports or sending them emails to update an employees phone number.

    One further option to consider is to wrap your entire application in an API so that it can be leveraged somewhere new.

    On one project I worked on we had a complex requirement for managing encryption keys. We needed a way to expire old keys, provide redundancy against server failures, and have a nuclear missile style 2 person/2 password login process.  It made sense to develop this as a stand alone service.   It paid off with a project that gives us confidence that some newbie programmer can’t easily create a critical security hole in an application that uses it.

    Amazon is perhaps the best case study for a successful SOA deployment.  Their SOA approach has spawned entirely new billion dollar businesses (AWS).  One of the benefits they’ve seen is that because of their highly used SOA APIs the requirement for testing is greatly reduced.  Incremental updates get slowly rolled out providing time to listen for errors.  On these highly exercised APIs regressions can found quickly before any harm is done.  The actual use of the service provides a much more complete test of it than any test suite could possibly perform.

    Perhaps the best place to start on an SOA conversion project is to see if there is already some natural divisions in the developers knowledge and experience within the existing code base.  Creating SOA services based on these natural lines will ensure that the new teams will already have an expertise in their service and reduce the learning/ramp up time.  Domain knowledge is the biggest hurdle for any programmer (ie it take a lot more time to switch from enterprise software to video games than it does to switch from Javascript to C#).

    So you’ve got an idea for where to start.  The next thing to decide is what the API should look like.  I prefer RESTful interfaces because of the lower barrier required over something like SOAP for clients.  SOAP would make things like a bash shell script difficult to do.  I also prefer JSON over XML for similar reasons but also because XML allows for some style inconsistencies between developers such as should something be an attribute or child.  Should authentication be done with simple username/password or are there requirements for something like OAuth?

    Your team should probably develop a couple of libraries in some key target languages for their API.  This hides things like URLs and encodings behind a more obvious code API.

    Documentation is also very important.  An undocumented API will probably never be used by anyone.  Both the raw API and any libraries should be documented with examples.  If it’s a public API, put your libraries up on github.com so that other developers can easily find them and keep up to date.

    Work in some analytics if you can for the new API.  Tracking usage and performance of your service is fascinating and can provide some key insights into where improvements could be made.

    Lastly, a new SOA project will include some new infrastructure and deployment requirements.  You’ll need to decide on server requirements, uptime and redundancy for this new service.  As well as write any new deployment scripts for it.

    So an SOA conversion is not a trivial task.  It does come with some overhead which is usually made up for by growth of the service as it finds new customers and new use cases.  Reducing the scope of a large project into separate services provides less easily measurable benefits such as reducing communication costs, reducing the scope of future changes and making the project easier to understand.

  • Another Game in the Queue

    Icon-72On Monday this week we submitted another game to Apple for review.  This one is called Andromeda’s Savior and it should be available sometime next week in iTunes.

    The plan is still to push out a bunch of games very quickly.

    After an intense strategy meeting on Tuesday we decided to focus on a few key features to add to the platform before we spin out about 5 more re-skins as quickly as possible.  Then with 7-10 games in the store to generate some cash flow we’ll make a judgement call about whether to continue with quickly producing games or to spend a couple months on developing something higher quality.

    Developing 7-10 games with various art styles and themes should provide a couple of benefits.  It will give us more experience with Photoshop, 3DS Max, and Inkscape to create better graphic assets.  It will help to give us some insight into potential markets/themes that are more popular or easier to compete in.  The base of apps will also provide some leverage for cross-promotion of any new games we release.  If we do decide to release a more complex game in the future we’ll have a base to support it’s launch and some market intelligence to help guide it’s development.

    Needless to say, I’m going to have a busy few months ahead of me.

  • Successful Game Launch

    mzl.jwnecmma.175x175-75Colum’s and my work on the release of Air Barons has found tremendous success!  This is a re-skin of UFO Invader with rendered 3d model graphics of WWII era planes done by the talented Colum Furey.

    The initial response to the game has surpassed all expectations and it has been earning a very respectable income from advertisements in it’s first week.

    The strategy of trying to release 20+ new games this year is somewhat validated even at this early stage.  And if this success can be matched by the next few releases then it will not take long to significantly increase both of our disposable incomes to put towards a pair of Maserati’s.