Angular2 DI Service Decorator

Dependency Injection or ‘DI’ is a mechanism used within Angular2 to provide instantiated services or other objects to the components (and other services) that need them. It allows a class to ask for just what it needs without needing to know about the entire tree of dependencies in order to create them itself.

The idea of DI is based on design principles intended to help us write better, cleaner and easier to maintain software. Unfortunately, there are certain limitations in the implementation of the Angular2 DI system which mean it’s not always obvious how to get all the benefits we should.

So, we’ll explore these principles using DI with the Http and an AuthHttp implementation as an example to show how it is still possible to achieve.

Read On →

Angular2 New Component Router Review

What makes a good client-side router? What do we even want a router to do? What is Angular2’s Component Router like and should you plan on using it?

I’ll share my own thoughts on this based on my experience of using it so far.

First thought, we need to understand why we use a javascript router in the first place. Some of this may seem “duh” basic but it’s often worth taking a step back in order to evaluate exactly where we are.

Read On →

Angular2 Route Security

Once you move beyond the quick-starts and examples and start building a real app with Angular2 you soon find you need to handle things that the examples often leave out or pass over.

Securing routes with the new component router is one of these and it can be difficult to figure out. Here’s the approach I’m using which seems to be working well for me and has been reusable across multiple projects.

Read On →

Dependency Injection in Go (Golang)

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.

Read On →

Cargo Cult Mentality in Software Development

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 On →

The difference between knowing and understanding

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 On →

Top 10 ways to fake it as a software developer

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 On →

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

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 Wordpress.com 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 On →

Creating labels for GitHub issue system

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 On →

Introducing Embed.ly client for .NET

First of all if you haven’t heard of Embed.ly 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 On →