Captain Codeman

Web Development and Cloud Computing

Dependency Injection in Go (Golang)

Do you really need "Spring"?

Are you trying to figure out how to do dependency injection in Go (Golang) to make testing easier and allow you to switch providers? Maybe you want to create an app that you can run on Google’s AppEngine to take advantage of their PaaS datastore and other features but you want to have the ability to swap out the storage and run it on AWS against DynamoDB?

You just know you need a Dependency Injection library don’t you? Well, I’m going to try and show you that you probably don’t.

dependency-injection go

Read more ...

Cargo Cult Mentality in Software Development

"It's always been this way" isn't a good reason

Have you ever worked on a project where people insisted that the team follow arbitrary rules?

There’s often a reason for the original ‘rule’ but like any Cargo Cult the reason has been long forgotten and lost over time leaving little behind but a blind adherance to a practice in the belief that it somehow magically bestows benefits on a project.

The best example of it for me that I see all the time on teams is the insistence on using fibonacci numbers when estimating.


Read more ...

The difference between knowing and understanding

There really is a difference

I came across a commit recently that perfectly demonstrates the huge gulf that can exist between knowing there is a way to do something and truly understanding the reasons behind it.

Anyone who has tried their hand at web development has probably gone through the stages of learning about HTML and how the different elements are rendered on the page and then discovers CSS and how they can be styled to look like the beautiful sites we all know and love … or not. Usually not by a long way, especially when you’re starting out.

At this stage we’re normally producing a convoluted mess of unmaintainable styles applied to every element as needed. If we want a <div> to have a red border then we add style="border: 1px solid #ff0000" to it. Eventually we stumble across a blog post or tutorial that explains that this is a bad thing and that we should really be using CSS classes instead to apply styling.


Read more ...

Top 10 ways to fake it as a software developer

How bad developers succeed in poor teams

Or “how to survive in a role where you are supposed to have technical skills when you don’t really have any”.

If you’ve spent any amount of time working in software development then sooner or later you will get to work on a team where there are one or more ‘less than productive’ developers. If you’re particularly unfortunate then you get to work with someone who is a complete negative net asset - they consume more time and effort than it would take to create the work they ‘produce’ and no one seems to notice that they never really contribute to getting project features completed and instead spend their days interrupting others and creating problems.

But they survive and seem to even thrive, probably being paid more than many other people on the team who are actually getting the work done. How do they do it? Well, these are their techniques intended to help you to spot them early, not to become one of them!


Read more ...

Switching blog from WordPress to Jekyll hosted by GitHub Pages and styled with Twitter Bootstrap 3.0

Tired of dealing with WordPress issues

Phew … that’s a mouthful !

I’ve used WordPress for my blog for the last few years since switching to it from BlogEngine.NET. Originally I continued hosting it myself but it seemed like a never ending treadmill of installing software updates and battling with incompatible plugins which I finally grew tired of so I eventually ‘outsourced’ it to the hosted service.

This worked much better and I have no complaints with the quality of the service itself but am a little unhappy that after you pay to use it they add advertising to your site and you then need to pay extra to have their ads removed. I doubt my blog generates a huge amount of ad revenue but still, I’d much rather it came to me and I think it would be fairer to have a free ad-supported service OR an ad-free service which you pay for.

I’ve spent a few hours getting setup using an alternative and while it’s not yet finished and more than a little rough around the edges I can already see the value in it.

It’s based on GitHub Pages which provides free hosting of static content for github user, organization or projects. Because all the content is hosted in Github it’s automatically version controlled and published whenever you commit changes (within a few minutes).

Read more ...

Creating labels for GitHub issue system

Simple script to automate creation

I liked the ideas for Managing your backlog with GitHub Issues and the type of labels used but creating them was harder than it should have been because of the unicode characters and custom colors and so using them consistently on multiple projects would mean repeating the same work each time (unless there is a ‘copy labels’ button that I haven’t noticed!).

So, I decided to write a little script to automate the process. It creates a slightly different set of labels as shown below but could be easily adapted to your own needs:

Read more ...

Introducing client for .NET

First of all if you haven’t heard of you really should check it out

At it’s core, embedly is an oEmbed provider. oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

If you’ve ever posted a link on facebook and been impressed that it automatically added a title, some descriptive text and one or more preview images to select from or included a playable video automatically and want to build something like that into your own site then this is for you.

Read more ...

Event-sourcing benefit: migrating between storage types

Here’s an example of one benefit of Event Sourcing …

How much work would typically result from “hey, we need to change platform and store our data in a different database …”? Even using NHibernate and going from one relational database to another, you’d potentially be looking at a significant piece of effort.

Now imagine instead trying to migrate between fundamentally different storage engines such as from SQL Server to Amazon S3 or from Oracle to MongoDB?!

Well, EventSourcing not only makes it possible, it also makes it trivially simple too.


Read more ...

MongoDB provider for Elmah

mongodb elmah

Read more ...

Simple Service Bus / Message Queue with MongoDB

A service bus or message queue allow producers and subscribers to communicate asynchronously so that a system can handle disconnects, processes being stopped and started or enable peaks of demand to be handled beyond what the subscriber can immediately cope with. The queue acts as a buffer that the producer writes to and the subscriber reads from.

There are lots of implementations such as NServiceBus, MassTransit, Rhino Service Bus and the cloud-provided services such as Amazon’s Simple Queue Service and Window Azure’s AppFabric Service Bus. Some take a little time to get started with and the cloud ones can also rack up charges pretty quickly if you are doing too much polling.

Often, all that is needed is something fairly simple to buffer messages between processes and persist them. I’ve been making good use of MongoDB recently in conjunction with Jonathan Oliver’s EventStore library for a CQRS-based project so it seemed the obvious place to start – why not use MongoDB to store the queue?!


Read more ...