oh no, I just updated a ruby gem!

26 Aug

Are you a ruby developer? Do you want to manufacturer something to do? Well here is a quick tip. Take your beautiful working Rails 3 application that you started creating 6 months ago and type in “bundle update”.

I don’t think there exists a time when I have issued that command and then 10 seconds after it completed not thought “what the fuck was I thinking”. Just about every gem that updates seems to make several breaking changes. For real comedy value it’s worth doing it between major Rails releases, actually, I take that back, make that minor Rails releases.

This just doesn’t seem to happen with C++ libraries. When coding in C++ (which I do almost every day) I can reliably update to even major version changes and still be pretty much guaranteed that what worked before will still be working now. At most you get a “deprecation” warning. Not in the Ruby world, oh no, here progress is rapid but backwards compatibility is an afterthought. It really is no wonder that enterprises are so cagey about moving to, how can we say it, well in the words of Steve Yegge, hardcore liberal languages. There is something to be said for stability.

So is this a bad thing? As much as I would like to say that I think it is, I’m just not that sure. There is nothing more frustrating than using something that is not willing to change (I’m looking squarely at you Java). It’s the fact that there is no attempt to maintain backwards compatibility for at least a short period of time that doesn’t fill me with confidence.

These days you see many people picking the latest and greatest technology to build a business on. This always makes me squirm just a little. This may be OK for a small business with technical founders. However, it makes little sense for a company with shareholders where employees can leave at any time. I certainly wouldn’t want a company I’d invested my money in being in left open to the vagaries of change quite so much.

stop trying to show how smart you are

23 Aug

Sitting feeling bright and somewhat giddy with my own self confidence I decided to dust down my copy of “C++ Template Metaprogramming” by David Abrahams and Aleksey Gurtovoy. Thinking I really need to be the master of something and further thinking C++ template programming was that “thing”. I approached the task with some gusto for at least a few days hours minutes, however, as with most advanced study you really have to be willing to dedicate your life to it. It’s never long before the inevitable gloom of reality sets in and you realise that this is more than an afternoons work. Without much control your brain starts telling you that there are much more important things you could be doing. Thankfully for everyone else on your team you stop and decide that it’s just not worth it.

The fact is that writing code that only those who have decided to dedicate a fair chunk of their life to is never going to be the right choice. There is nothing worse than trying to understand code like this. There are times where it pays to be smart, like when you have a better (much) faster algorithm, or doing something saves you hundreds of lines of code. But most of the time you see this kind of code it’s people just trying to prove how smart they are.

Now C++ is not alone in this. Ruby has exactly the same problem – you can get stuff happening as if by magic. I could be wrong but I imagine most people read code from top to bottom, working line by line, they don’t expect code to be auto generated or happen as some elaborate method_missing technique. Sure I can maybe relax my vitriol for those building frameworks where things are being used in some generic unknown context. However the vast majority of applications out there don’t have to deal with these problems. The biggest problem these applications face is that the developers creating them want to architect some elaborate framework to fit a very specific use case – it almost makes me cry. I’m not sure why as a profession we don’t revel in an approach that oozes simplicity. This is certainly what the smartest developers I’ve working with have always managed to do.

questioning the truth

9 Aug

So, a colleague once told me of a story where an important academic paper (well important in its respected field) presented results that turned out to be false. Not exactly NEWS (think more first-world-problem) but this paper was peer reviewed and appeared in a prominent journal but still managed to slip through. This paper turned out to be cited in many places and only when my colleague tried to reproduce the results many years later did it become apparent things were not right – it turned out to be a bug in the original authors code that caused skewed results in his empirical analysis.

The thing is though, this kind of shit happens all the time, and it’s really fucking annoying. If you attended any conferences, meetups, usergroups, etc this practice is rife. Someone standing in front of an audience says something and it’s almost always instantly taken as fact, without the need to provide sources of proof. The audience then believe this to be true, as in many causes they are in no position to prove otherwise, and those that do voice an opinion are seen as being “aggressive”. The sad fact is that most of the time errors/hearsay go uncorrected, and people walk away misinformed.

The fact of the matter is that you really need assume what someone has said might not be true, do your own follow up and make decisions based on what the evidence supports. Remember that many people have agendas, and also that it’s very possible that speakers are talking about something that they have only a rudimentary understand of. Don’t blindly assume that what someone purports to be be true is actually the truth.

writing code used to be simple

4 Apr

Not that many years ago, though more than I care to remember, the process of writing code started with pen on paper. I’m not talking about 1970 here where you had to apply for compute time on some mainframe to see your ideas come alive, rather 1995 where it seemed the normal practice was to encouraging us disobedient students to first distil our ideas (and code) on paper. I’m gathering that this practice is largely forgotten? Despite its disappearance this can still be good practice but is made difficult by the increasing complexity of modern code libraries and frameworks.

Take Ruby on Rails for example. This used to be the poster child of getting an application up and running quickly. This might be still be true if you have years of experience developing Rails applications but for a newbie, forget it, you are going to struggle. The introduction of the asset pipeline, amongst other things, has made learning how to use Rails a labour of love.

It’s not just Rails though. A lot of the code that you need will already be wrapped up in a library written by someone else. Creating a modern software application is essentially just a case of rearranging these packages into a new unique order. In fact, the need for the order to be unique can probably be dropped.

Using these libraries is good though? Right? I mean we should never “reinvent the wheel”?

So how many times do you find yourself spending more time trying to figure out how the fuck to use some library than if you had written it yourself? No-one really expects there to be detailed documentation, which is just as well, as in general you’d be thoroughly disappointed. Maybe it’s because I’m dumb, but figuring out how to use a library can be a complete time sink. I mean, I hate to encourage this, as it seems like I’m committing a heinous crime, ’cause that’s what I’m told I’m doing, but just write the code yourself if it gets it working quicker for you. Obviously don’t rewrite the exact library that you are shying away from using, that is just stupid, but if you only need a subset of it’s functionality then go for it.

Never forget though, there will be a team of astronauts telling you that’s not what you should be doing. They will be spouting dogma, about this and that. However, if abandoning some well written (and not so well written) rules allows you to create a product that people use and love then tell the astronauts there are people who want to hear their shit on the moon and let them go there.

managing people like they do in the movies

22 Mar

Blogging about how hard you are to “manage” is possibly not top of the list of the smartest things I’m likely to do. The day will no doubt come when I’ll be contacting Google begging, pleading and grovelling to get this damn article removed from its cache. Serendipity will mean this is likely to bite me, and bite me hard.

It’s been a while since I’ve taken my place in that ageing behemoth of corporate management structure. Occasionally I’m thrown back there when either I think too hard or I’m told a story of the woes and misery bestowed upon a leaders minions as he marches forward “managing” those below his threshold. It’s like everyone heard that the do-as-I-say-or-I’ll-make-your-life-shit style of management doesn’t exactly work but someone forgot to tell those in management. It’s not a pretty sight to see.

So yes, people still manage like it’s the 1920s, ’cause that’s how they see it done in the movies, man! Just like how having sex like it’s done in a porno is probably not what you want to do when you’re tucked up in bed for a night of love with your other half. However, what these two things do share in common is that bringing up the topic doesn’t seem to result in an optimal outcome.

Have the gall to bring this up with your manager and you’re likely to be branded, then derided, and finally sent with your tail between your legs to your (now) wall facing desk. Even the thought of saying no or questioning management is likely to lead to stress and anxiety in those that live with this day in day out. So much so that I’m even banned from bring up this topic of conversation with certain people.

How hard can it be to realise that you (presumably) were employed because you could do the job? You know more about what you are doing than those managing you? Therefore you are going to be the best person to make any decisions. Sure, there are jobs where this may not make sense, there are exceptions to everything, but micro-managing an intelligent workforce is the worst management decision of all.

Joel Spolsky wrote about the very same topic and suggested that management should actually be called administration. This makes sense.

People being stressed out about their manager is so wrong on so many levels. Actively reducing the quality of someone’s life is not something to be proud of. You should be damn well fucking ashamed of yourself if you are. If there is a problem, talk about it, try to sort it out, advise them that the job might not be suitable. Leave your ego at the door, you don’t need to control everyone’s life, settle for controlling your own.

the budget VPS dilemma

16 Mar

My time with the free Amazon EC2 micro instance drew to a close in the last few weeks, that coupled with a few minor instance freezes in the last couple of months got me interested in moving the sites that I run elsewhere. Traffic to my sites is relatively low, maybe a few hundred hits a day max. Given this, a cheap VPS package looked to be exactly what was required.

First up, I done a rough calculation that showed that if I wanted to keep my EC2 micro instance running then if I took out a 3 year reserved instance it was likely to cost me (on average) around £50 per year for a US West instance over the next 3 years and closer to £65 per year for an EU based instance. Both of these are pretty good value for money – and since these sites are essentially a cost sink this is of at least some importance.

However, given the hassle I’d been having with my instance freezing I thought #1 is this going to keep happening and #2 if I take a reserved instance for 3 years then I’m kind of tied down.

In the past I’d been slightly ambivalent about what country the server was hosted in. With Amazon I’d thought screw it, I’ll host it in the US West as it was cheaper, thinking that my traffic tends to be spread throughout the world with maybe a slight leaning towards the US. However lately while creating some backups and trying to copy them locally, I released that this might be OK in terms of people viewing a site but it was a solid pain in the ass when taking full backups off the server to my local drive. So I started looking at VPS providers in the UK.

Surprisingly the cost of having your own VPS has nose-dived – I presume this is due to Amazon driving down prices, cheaper hardware and advances in virtualisation software. After looking around I managed to find a decent deal (~£47 a year with www.burstnet.eu) for a VPS with 512MB RAM, 20GB hard disk, and 1GHz CPU speed on a UK based server – I’ll stress again how much better it is to have servers in your own country when using SSH and copying files.

Now some might be asking why not just go for shared hosting? Well for many this is likely to be a good option. However, when you are running more than 2-3 sites I found that using a VPS is likely to come in at the same price if not cheaper. Plus, I rather enjoy installing the software, setting up the servers, admin of the server, etc. Sure, I may screw it up from time-to-time, but over the years I have learned quite a bit from doing things like this myself. This knowledge has been useful on many occasion. If you write software then you really should know at least something about the platform it runs on – maybe this is old fashioned now I dunno.

Anyway I actually started this post aiming to discuss how I set up WordPress, PHP, nginx, etc on my budget VPS but I’ve gone on way too long already. That’ll have to be a topic for another day. Instead I’ll wrap this up by summerising that:

  1. Amazon may not always be the cheapest – except in the first year where a micro instance is free, and you can’t beat free;
  2. Check www.lowendbox.com to see if there are any nice deals going;
  3. Try to find a server that is geographically close to you if possible;
  4. If you’re a developer, get a Linux VPS, even if it does costs you, call it an investment in your career – OK, you can do this stuff on a local Linux machine but it ain’t the same. It’s good to know how to set up a web server, configure it, and other general server admin tasks. If you ever plan to scale something one day these things will be important. It even gives you a chance to use vi or vim and wonder why the fuck people put themselves though that ;-);
  5. Having your own server also allows you to make mistakes without that stomach churning moment you get when you realise you’ve screwed something up at work – you can now screw up on your own time first;
  6. Running your own server also gives you a better idea on what the performance of your application is. I’m pretty sure it will surprise you. I thought 512MB was a crazy amount of RAM for a few simple sites. It’s amazing how it all adds up when you are running a DB and a web server with several websites on one VPS. However that’s the post I was trying to write when I started this. That’ll be next.

the internet and i

1 Jun

If you are able to read this please keep it to yourself, don’t tell anyone about it. Your ability to possess information that others do not have access to is crucial to moving only in the forward direction. Yet there is very little information now that is not readily available to everyone. The internet is almost ubiquitous. Rewind a mere 15 years though and observe how the landscape has changed so dramatically.

Back then a PC was the something only the posh kids had. My school was fully laden with BBC micros that you could only use to control some piece-of-shit-circuit-board that you had cobbled together to light up a few LEDs in the form of a traffic light.

I still remember to this day getting my first PC – a (big) Compaq laptop of sorts. It was purchased second-hand from a shop that specialized in guns, knifes and guitars – I still have it somewhere. They probably didn’t even know what it was. When I read stories of people in the 80s having PCs it makes me laugh as, in my world, this stuff was sooo out of reach that you wouldn’t believe.

Still, what would the general public have done with the PC back then anyway (apart from gaming)? The internet was a luxury goods item at this point. Even at university only a few computers had internet access. However, between ’95 and ’97 it exploded. You were faced with a computer lab full of students looking up porn and printing out the pictures (I mean they were not much use unless you printed them out, right)! Those were the days of looking up what you wanted with reckless abandon without feeling that someone or something was watching you – soon to be quashed with the corporate firewall and government legislation. Make no mistake though, we are still in the golden age of the internet. Laws and legislation will likely mean that the freedom we associate with the internet now will not be the same 30 years down the line.

What puzzles me most is how we got by programming without the internet? If tonight I decided that I wanted to learn OCaml to build some super useful web service, then I would start by searching Google. I’d get binaries, sample programs and documentation in minutes. If I had a problem, I could search on Google or ask a question on Stackoverflow. The barrier to entry is just non-existent. I struggle to remember exactly what we had to do all those years ago. It must have been ridiculously hard compared to the present day. But this is good. We got information easily and moved forward. That said, the internet does have its bad points.

We now struggle to get things done because we can listen to music online, watch videos, read blogs, not to mention the ease with which we can communicate with friends using social networks. What the internet gives with one hand it takes away with the other.

I’m often tempted to unplug the router and see how I get on with work minus the internet. Invariably at the last minute though I find some compelling reason to have it switched on, then the thought of uplugging it fades into nothing and time just slips away again.

on being open to change

15 Apr

How easy is it just to say no? I think you’ll probably find just about as easy as it is to always say yes. In the past I have often found myself entrenched in that no camp. It’s so easy to hate a company, a stance or an ideology without even attempting to think of the why.

I recently decided to try out an approach where instead of following my five second gut instinct assessment, I would instead spend some time trying to overcome my own (possibly) over zealous opinions.

My test subjects for this were the guys at 37signals. I frequently found myself disagreeing with most things these guys were saying for no reason other than the aggressive way they generally put forward a point. This is a real stupid thing to do – even more so when you see it in writing!

Anyway, in this new era of love and enlightenment I picked up the book Rework by Jason Fried and DHH. I was immediately surprised how much I identified with the things these guys were saying about running a business, from focusing on products that can make a profit from day one, to abandoning long range forecasts (or to paraphrase “elaborate guessing”) about your business. So two guys I thought I “hated” actually hold opinions pretty close to my own, i.e. I was being an asshole!

Before anyone gets the impression that I’ve now turned into the “super fanboi”, I should say that I don’t think that Rework described THE way to run a business. It’s simply A way to go about things, and one that happens to be close to what I believe. For example, the books contains ideas that may fall apart when it comes to dealing with large enterprises or when trying to build “uber” companies like Google and Facebook – who can argue with their success. However most of the ideas seem spot on if you are trying to build a small to medium B2B business.

So the moral of this story is try to see past the way information is being presented to you and look at what the information is actually telling you – this is true for both the hater and the fanboi. However, it should also not be overlooked that if something is shit, then say it’s shit.

an afternoon with Don Knuth

17 Feb

It’s not often you get the chance to spend an afternoon with probably the most famous hacker/developer/computer scientist the world has ever seen. However, last week I got the chance to do just that when myself and three colleagues had the great fortune to spend some time with Don Knuth.

For the uninformed IT “professionals” that have never heard of Don Knuth this is the guy that brought to us the idea of analysis of algorithms and asymptotic notation (big-O notation), the Knuth-Morris-Pratt string searching algorithm, the Art of Computer Programming book series, the list goes on. However, he is not only an “algorithm’s guy”, he also developed the Tex typesetting system and the METAFONT language used to define vector fonts. So basically he is the most famous computing guy out there.

Knuth is a surprisingly easy guy to talk to. Sure, he can really lose you pretty quickly in a conversation, but he also has some great insights.

Our conversations tended to centre around stuff to do with algorithms. His next volume of the Art of Computer Programming will likely focus on constraint satisfaction problems and satisfiability problems – the former being something I worked on myself in the not to distant past. I asked what he thought was a good algorithm to teach people and he said he thought the biparite graph matching algorithm was a nice one in terms of beauty (he did mention another which escapes me now). Not everyone will find the algorithms stuff that interesting (you should!) but his view of beauty is maybe something more universal.

He also expressed a love for writing code, he said that when he gets up in the morning he thinks about writing code and misses it on days when he doesn’t get the chance. That is pretty cool by me and sits in stark contrast to many academics. I got the feeling that he wasn’t too keen on the “apps” developers as he called them. My guess is that his thoughts lie with more meaningful problems than fart apps – however people download them so who are we to say. Still, there was definitely some lamenting going on about the fact that people use software without ever trying to understand what the software is actually doing. That is, have at least a high-level view of the data structures and algorithms used that make the said piece of software useful. Having this kind of understanding allows you to select the right tools for the job. In my experience people that tend to have this knowledge and understanding are far better developers and is likely why Google, Microsoft, Facebook et al. try to attract developers with this kind of knowledge.

He was telling us that he watched The Social Network on the way over on the plane. He said he thought it was great how Mark Zuckerberg was also someone who just liked building stuff like him – this was something Zuckerberg said himself at Startup School 2010. What is even cooler is Mark Zuckerberg actually sent him a copy of the latest Art of Computer Programming book and asked him if he would sign it for him.

So Don Knuth himself will have long forgotten who I am but at least I will be able to recollect years down the line this encounter with a computing genius.

is ruby killing your career?

15 Feb

I’m probably at the point with Ruby where I consider it my programming language of choice (I program in both Ruby and C++ in my day job).

Over the last few years I’ve kind of grown to love Ruby but I’m not really one to get passionate over someone else’s choice of programming language – apart from Java, which, I’m sorry, I hate. However, when it comes to employment, there is no doubt in my mind that being competent in a particular programming language can strongly influence A) getting an interview and B) getting the job.

This is why ruby developers, like me, are killing their career. Sure Ruby is cool and Rails is awesome but do a quick check on job boards and see how many people are looking for a ruby developer. Actually, let me save you the time I’ve done some of the work already.

I’m not claiming this to be scientific in anyway what-so-ever but it does warrant some thought. I only searched using the programming language as a keyword, which, I know, may not give the full story but should convince you there is some merit in the point that I’m trying to make. Additionally (and I suppose somewhat importantly) my search area was restricted to Scotland.

First up I carried out a search on s1jobs.com. The table below gives a summary of the results:

Language Number of jobs matching keyword
Ruby 3
Java 18
C# 26
C++ 9
PHP 7

I then tried a cwjobs.co.uk:

Language Number of jobs matching keyword
Ruby 2
Java 35
C# 45
C++ 45
PHP 4

As you can see, the job prospects for Ruby developers here in Scotland are somewhat dire. Sure, people don’t always look for a particular programming language when employing someone (which is a decent policy) but, as I said above, it helps a lot.

I decided to take my crude search a little further as I thought “Hell, there will be waaaaaaay more cool Ruby jobs in London”. Below we have the results, just cwjobs this time:

Language Number of jobs matching keyword
Ruby 57
Java 792
C# 838
C++ 611
PHP 196

That was kind of disappointing! Ruby still doesn’t do that great – even worse when you realise there were over 200 that mentioned Perl and 150 Python. By the looks of it if you want to maximise your chances of getting a job in the UK, and already doing Java or C# in your day job, you’d be better off learning C/C++ in your spare time.

Is all this going to stop me coding in Ruby? Probably not. Is it worth thinking about for a minute? Yes sure. If I was starting my own company and was hoping to get some developers in then I’m likely to be faced with a problem. Yes you can train people up, but that costs time and money. When they leave it may be worse, as the chances of finding replacements at the required skill level will be difficult. Finding a Java/C#/C++ programmer is bound to be far easier.

So is it all bad news for us Ruby developers? Well not if you plan to move to California – yeah yeah I know I’ve went on about it before. I’m not exactly sure of the popular job boards in the US so I went with the only one I knew off the top of my head, careers.stackoverflow.com. The results for the Bay Area are as follows:

Language Number of jobs matching keyword
Ruby 27
Java 33
C# 10
C++ 23
PHP 17

Maybe this was a skewed sample set but impressive all the same. So moral of the story is if you want to be a well paid Ruby hacker make sure you don’t stay in Scotland :-).