Dabbling with rust

I have been dabbling with the rust programming language lately, it is quite refreshing compared to my work around high level programming langauges such as PHP, Ruby and JS. These are some of my thoughts on rust comnig from a high level programming language.

Memory management

In high level programming languages rarely do you worry about memory management, I’m not talking about direct memory manipulation as this is often not possible but rather the life time of your variables and objects as they are usually freed by the garbage collector, on the odd occasion you may have a run longer program which uses an ever increasing amount of memory or one that uses large amounts of data.

From a rust perspective you need to understand the difference between a stack allocated variable and a heap allocated variable and although I have learned this from university rarely did I think about it when programming perhaps this make’s me a bad programmer but generally I left it to the programming language to determine the best location of my variable or object.

Ownership

Again when programming I didn’t think about the ownership of an object, of course I was aware that by passing a variable to a function that it may manipulate that, but I did not think about whether it should hold on to that reference and make changes in future invokations unless it was expected. I think this could be a potential issue if you’re not anticipating it e.g. Doctrine’s managed objects.

In rust you have to think careful about who owns what, so as to avoid a dangling pointers and instead it introduces a trivial concept of ownership where as only one context may own the variable at any given time and even then the ownership may have restrictions e.g. immutability. Given this I think it allows you to reason about the system a lot easier give

Locks

Options and results

Lean Start Up

I read The Lean Startup a few weekends ago and it got me excited for developing in a lean way, what is the lean way? Well the way I understood it, it was trying to fail as fast as you can so you can learn from those failings and proving what you’re doing matters with actionable metrics.

It was in general light on concrete processes but the theory has changed the way I approach working on my personal projects, before I strived for technical perfection before I would release it, I’ve realised this is a mistake as it meant I was developing in a silo for many months sometimes years, often building features no one wants. Now I aim to build the minimal to validate my hypothesis that users want this feature and back it up with the data.

The data side of things is new for me as I don’t specialise in analytics but it’s quite interesting to understand how you can prove something analytically with control groups. So I’ve started to read The Lean Analytics which is a book in The Lean Series and also ordered Running Lean which I may end up reviewing sometime.

Anyhow to sign off, if you haven’t read The Lean Startup, definitely read it, if you’ve read it but can’t remember it, I recommend you read it again.

Development environment

I’ve been spending a lot of time recently getting my development environment setup, I’ve found once I’ve learnt a better way to do things, I won’t want to go back to the old way. So when I learnt about Puppet, I didn’t want to go back to a shell script or manual installation. But these tools take a lot of investment to setup and get right, then you may find out about a complementing technology such as hiera or facter, which you then have to go back to the drawing board and re-iterate.

Finally I am satisfied with my development environment such that it’s easy to work on all the different technologies my projects use from static, node, ruby and php projects so I thought I’d share it on my blog.

My development environment; built with Vagrant, Packer, Puppet, Hiera.

Multi-factor authentication

I recently enabled multi-factor authentication for both my Google account and LastPass account, it’s amazing that I’ve held out for so long given the associated risk with losing either accounts. However after investigating multi-factor authentication solutions again, the backup options really sealed the deal, I don’t know if they recently added support for them or I simply didn’t invest enough time previously.

Google provides the ability to generate a collection of random numbers which can be used once as an authentication code, as well as the ability to use multiple phone numbers incase your number is inaccessible. For the applications which don’t yet support multi-factor authentication but uses a Google account, you can generate an application specific code.

LastPass uses Google for multi-factor authentication however supports many other provides including YubiKey, Toopher, Duo Security, Transakt all of which I’ve never heard of before. It also allows you to generate a one time password which will grant access to your account if you forget your password. Finally you can export your passwords to CSV and print it off if you’re using randomly generated passwords which you don’t remember.

In case you don’t use multi-factor authentication I highly recommend it, I also recommend using LastPass as the idea of using unique passwords for multiple sites becomes cumbersome so I usually end up defaulting to five passwords with varying levels of entropy. In case you don’t like the idea of storing your passwords in the “cloud” I hear 1Password is also very good.

2013 In Review

This is the first time I’ve written a review of the previous year, possibly because I don’t write often as you can see by the lack of blog posts. I decided to do it so I evaluate last year and see if this year I have achieved the goals I have set out to do, so here is 2013 in a review.

Mentor

For the first time in my career I found myself without a mentor, someone who wasn’t just superior by rank but also knowledge. This was due to the fact that the development manager left and he was not replaced, instead two specialised lead developers were chosen to fill his role. Unfortunately this didn’t work out perfectly as certain areas of which he managed did not get picked up and therefore became unmanaged with no one wanting to take ownership of it.

Although I do discuss ideas and problems with the lead developers as well as the other developers, it is not often that I can learn something new from them of which I did with the development manager. This is disappointing as I feel when you have someone who you learn from frequently, you have an accelerated development, so this was hard for me. Instead I have had to search more for knowledge else where be it blogs, articles or even podcasts.

Side projects

I started a few side projects in 2013, a game which was a 2D top down RPG, a mobile application to track 1001 beers to try before you die, a macaw-esque tool and finally a collaboration between some of the developers at work to create a idea crowdsourcing platform.

I am disappointed with how little I’ve achieved on side projects this year, although valuable knowledge was gained by developing them I would have liked to release something. I did manage to get the landing page of the idea crowdsourcing platform completed but that’s hardly an achievement.

Development Environment

Towards the end of the year I realised that not all the developers had the same development environment and because of this, occasionally we got the “it works on my machine” problem. We normally use a guide to setup our development environment with Macports but this is quite long, tedious and error prone so some developers opted for MAMP. I wanted an easier solution, so I started looking for one, I found Vagrant and decided to start playing around with it.

After writing a thousand line plus bash script to provision my virtual machine I realised this wasn’t portable as it required the developers to have intricate knowledge of all the commands, what I needed was a domain specific language. So I did some investigation and after a discussion with the IT team it was decided on Puppet because of the support and maturity.

Again, I invested many hours learning Puppet and writing manifests and classes to build our development environment and finally it’s in a good enough state to deploy across the developments. We’ve got a few developers using it however I am unsure whether I will invest my time in it with the current state of providing hosting undecided.

Forward

Side Projects

I want to see at least one side project launched this year and a landing page does not count. I know it’s not hard, but I am a perfectionist, I want to ensure it’s perfect but hopefully my reading will help me get over this problem.

Development Environment

I want to further improve our development environment by using Packer to build a pre-configured base and also to ensure our bases are all the same. I am half way through this with support for building Vagrant boxes, I just need to add the Amazon support and we should be done.

I also want to investigate using Docker as there is some work being done to make it work nicely on OS X, so we’ll see how that goes, if it provides to be a viable alternative to provisioning an entire VM it’ll mean less overhead.

Reading

One of my personal goals for this year is to read twelve books in the year, I know it’s not a lot to some people but keep in mind I read no books last year, I sourced all my information online. I will be particularly focusing on non-fiction but I may get a chance to read a few fiction on the way, the first book I’m reading is Rework by 37 Signals so maybe I’ll do a review on that