Softwire Blog


Tips for managing technical people – Let your managees lead meetings


30 July 2015, by

Galvanizing the geeksThe following is an excerpt from my new book, “Galvanizing the Geeks – Tips for Managing Technical People”. You can buy the full book on my website, here.

Gone are the days when companies were ruled with an iron fist. The old way of managing involved one person at the top making all the decisions, and everyone else implementing them. As long as everyone did what they were told, everything worked well.

The problem with one person making all the decisions is that, rather obviously, one person is only one person. The limit to how much knowledge one person can usefully act on may be quite large, but it is still a limit. Distributing the mental processing across everyone in the organisation rather than getting one individual to do it all just seems sensible.

And there’s another reason to get more people involved in the thinking process: people think differently. There are even benefits to having two people, rather than one, think about the same thing; they might come up with very different ideas.

I see an organisation as a series of ‘thinking parts’ working together to achieve an overall aim. The people who are working on specific deliverables do the thinking about the detail of those deliverables.  Other people will do their thinking at a level that agglomerates data across a group of deliverables; they can form general ideas and principles from this, and, because they have all the information, are best-placed to do so. But they are still not best-placed to decide on the detail, even if they are considered more ‘senior’.

However, people within a company are still human. This means that they often stray down the easier path of simply doing what they’re told and no more. So prevalent is this concept that people often do what they think they’re about to be told to do, even if they don’t feel threatened or coerced. It’s just quite an easy way to do your job.

The best way to tackle this issue is to try and reverse the usual management relationship. Your manager may set goals for you (or help you to set your goals), but once you know what you’re aiming for it’s your job to work out how to get there. You may need help and advice from your manager, but not because they’re telling you what to do – rather, because they’re a resource that’s available to you to use.

I have a meeting-plan format for two-person status chats that I use to help underline this idea. The key component is to get the more junior member of the chat to lead the meeting. This seems back-to-front for most people; when I ask them to set an agenda, they don’t know what to say. But once someone is happy with this format, I’ll get them to email their agenda in advance; I’ll also ask them to demonstrate good action tracking afterwards by emailing through the list of what was agreed in the meeting. This gives them a starting point for the next chat.

This can be quite scary as a manager, because someone might not ask you the ‘right’ questions. But provided that the brief is clear, either someone is not going to hit their targets (in which case you can – and must! – intervene), or they will hit their goals despite doing something that you consider suboptimal. This is the point at which you need to let them make their own decisions; otherwise you’ll undo all the good work of setting up an environment in which they can make their own decisions. ‘You can make your own decisions except when they disagree with mine’ is simply not effective.

Emmet made me fall back in love with web development


28 July 2015, by

Emmet is an HTML generation plugin that is available for most notable editors/IDEs.

It has a syntax that is designed to be quick to write rather than easy to read. This means you can type an abbreviated expression such as…

#errorModal.modal.fade>.modal-dialog>.modal-content>(.modal-header>h4{Header Text})+.modal-body{Body text.}+(.modal-footer>btn:b.footer-button{Button $}*3)

…and then hit the appropriate key to expand it like so:

<div id="errorModal" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4>Header Text</h4>
            </div>
            <div class="modal-body">Body text.</div>
            <div class="modal-footer">
                <button type="button" class="footer-button">Button 1</button>
                <button type="button" class="footer-button">Button 2</button>
                <button type="button" class="footer-button">Button 3</button>
            </div>
        </div>
    </div>
</div>

The former may look nasty (particularly without syntax highlighting), but it’s pretty easy to write. In my experience Emmet abbreviations are consistently quicker to type than the equivalent HTML, even with an IDE to help complete it. It also has the advantage of being written in a largely linear fashion, since you aren’t closing tags.

The core components of an Emmet abbreviation are as follows:

  • tagName

    This is generally expanded into <tagName></tagName>, though there are a multitude of more intelligent abbreviations such as link expanding to <link rel="stylesheet" href=""/> and link:css expanding to <link rel="stylesheet" href="style.css"/>.

  • .my-class

    Placed on its own, this will expand into <div class="my-class"></div>. Placed after a tag name, it will expand into <tagName class="myClass"></tagName>. The #id abbreviation behaves similarly, expanding into a div or tag with the given id attribute.

  • >, +, ^

    Step into a child tag, across to a sibling or back out to a parent respectively.

  • *, $

    Iteration. *n repeats the previous element n times, $ within the repeated abbreviation is replaced with the number of the current iteration. As such, .my-class$*3 expands to:

    <div class="my-class1"></div>
    <div class="my-class2"></div>
    <div class="my-class3"></div>

The above, combined with square brackets for attributes and braces for text, allow you to rapidly express your desired structure.

It’s more trouble than it’s worth to try and write the entire file as one giant expression, but it’s good for getting a rough skeleton onto the page that you can then tweak and fill in. Generally speaking, if you’re having to stop and think for more than a few seconds then it’s worth expanding what you’ve got so far and taking stock of your surroundings. The fact that it’s simple text replacement means you can construct your abbreviations piecemeal, writing one, expanding it, looking at the results and then using another to fill in further detail where appropriate. Most editors also give you the ability to wrap existing HTML elements with an abbreviation, along with similar structural changes.

As someone who had previously sworn off web dev as a fever dream of boilerplate and awkward hacks, it’s tools like Emmet (alongside modern CSS/JS frameworks) that have made me fall in love with it all over again.

Tips for managing technical people – Is burnout a management problem?


24 July 2015, by

The following is an excerpt from my new book, “Galvanizing the Geeks – Tips for Managing Technical People”. You can buy the full book on my website, here.

Galvanizing the geeksAs a rule, you should set goals and let people choose their own path towards hitting those goals.  This implies a certain level of trust that they will go about these in the way that they believe is best.

Looking at it this way, it seems that, if an individual chooses to overwork in order to hit their goals, then this is their choice. Most company reward systems means that working all hours of the day will earn you more money. So should an individual be allowed to choose this path?

I can understand the argument that says yes, they should be free to choose. Personally, however, I think that there’s a very good reason to cut off this particular choice. If your incentives are set out to reward people who work harder, it’s fair for people working to those incentives to assume that all-out, non-stop hard work is what you would most like from them.

But as a manager, that’s not what I want. I want productive, happy individuals who are hitting their short-term productivity goals and long-term career goals by doing a decent weeks’ work.

Some people will enjoy their job more if they work a few extra hours to hit their goals. No problem! In fact, I applaud this attitude. Some people will achieve their career goals sooner by taking an interest in technology and reading around the subject at the weekend. Again, I see this as a positive step that will make them happier as well as more productive.

But routinely working 14-hour days and weekends hardly ever makes people happier. And it doesn’t always make them more productive. It’s not what I personally want for my colleagues.

Telling people that you’d rather they didn’t do something while paying them more for doing it is not always a very effective message. So I intervene quite strongly if I feel that people are overworking. I’m not prepared to remove personal choice, but I can make it clear what we as an organisation consider to be a reasonable effort, and what we consider to be beyond the call of duty.

It sounds like a contradiction, but I believe in trying to curb people’s choice slightly in such cases. The unpalatable alternative is that they think you’d like them to be taking a certain course of action, when in fact that isn’t how you’ll be measuring them.

Softwire in 2015


20 July 2015, by

If you are interested in how we run as a company, you should watch the following video.

Fixing aggregation over relationships with Sequelize


17 July 2015, by

I’ve been setting up Sequelize recently for a new Softwire Node.js project that’s starting up. As part of the initial work we wanted to investigate Sequelize (the go-to Node SQL ORM) in a little depth, to make sure it could neatly handle some on the trickier operations we wanted to perform, without us having to fall back to raw SQL all the time.

Most of these came out very easily in the wash, but one was trickier and needed investigation and upstream patches, and I’d like to take a closer look at that in this post. The challenging case: aggregating values across a relationship (i.e. SUM over a column from a JOIN).

Some Background

The project is sadly confidential, but the core operation has an easy equivalent in the classic Blog model of Posts and Comments. We have lots of Posts on our blog, and each Post has 0 or more Comments. For the purposes of this example, Comments can have some number of likes. Defining this model in Sequelize looks something like:

var Sequelize = require('sequelize');
var db = require('./db-connection');

var Post = db.define('Post', {
    publishDate: { type: Sequelize.DATEONLY }
});
var Comment = db.define('Comment', {
    likes: { type: Sequelize.INTEGER }
});

Post.hasMany(Comment);

With this model in place, Sequelize makes it easy for us to do some basic querying operations, using its Promise-based API:

db.sync().then(function () {
    return Post.findAll({
        // 'Include' joins the Post table with the Comments table, to load both together
        include: [ { model: Comment } ]
    });
}).then(function (results) {
    // Logs all Posts, each with a 'Comments' field containing a nested array of their related Comments
    console.log(JSON.stringify(results));
}).catch(console.error);

The Problem

Given this Post/Comment model, we want to get the total number of likes across all comments for matched set of articles (‘how many likes did we get in total for this month’s articles?’). A great result would be a SQL query like:

SELECT SUM(comment.likes) AS totalLikes
FROM dbo.Posts AS post
LEFT OUTER JOIN dbo.Comments AS comment ON post.id = comment.postId
WHERE post.publishDate >= '2015-05-01'

Sequelize in principle supports queries like this. It allows an ‘include’ option (in the example above), a ‘where’ option (for filtering) and an ‘attributes’ option (specifying the fields to return). There is also Sequelize.fn, to call SQL functions as part of expressions (such as the attributes we want returned). Combining all of these together suggests we can build the above with something like:

db.sync().then(function () {
    return Post.findAll({
        // Join with 'Comment', but don't actually return the comments
        include: [ { model: Comment, attributes: [] } ],
        // Return SUM(Comment.likes) as the only attribute
        attributes: [[db.fn('SUM', db.col('Comments.likes')), 'totalLikes']],
        // Filter on publishDate
        where: { publishDate: { gte: new Date('2015-05-01') } }
    });
}).then(function (result) {
    console.log(JSON.stringify(result));
}).catch(console.error);

Sadly this doesn’t work. It instead prints “Column ‘Posts.id’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause”, because the generated SQL looks like:

SELECT Post.id, SUM(Comments.likes) AS totalLikes
FROM Posts AS Post
LEFT OUTER JOIN Comments AS Comments ON Post.id = Comments.PostId
WHERE Post.publishDate >= '2015-05-01 00:00:00.000 +00:00';

This is wrong! This attempts to load the total aggregate result, but also to load it along with all the Post ids involved, which isn’t really meaningful in SQL, unfortunately. If we group by Post.id this will work (and that is possible in Sequelize), but in reality there are a large number of Posts here, and we’d just like a single total, not a total per-Post that we have to load and add up later ourselves.

Making this Work

Unfortunately it turns out that there is no easy way to do this in the Sequelize, without getting involved in the internals. Fortunately it’s open-source, so we can do exactly that.

The real problem here is that the ‘attributes’ array we provide isn’t being honoured, and Posts.id is being added to it. After a quick bit of analysis tracing back where ‘attributes’ get changed, it turns out the cause of this is inside findAll, in Sequelize’s model.js. Take a look at the specific code in lib/model.js lines 1176-1187. This code ensures that if you ever use an ‘include’ (JOIN), you must always return the primary key in your results, even if you explicitly set ‘attributes’ to not do that. Not helpful.

The reason this exists is to ensure that Sequelize can internally interpret these results when building models from them, to reliably deduplicate when the same post comes back twice with two different joined comments, for example. That’s not something we need here though, as we’re just trying to load an aggregate and we don’t want populated ‘Post’ models back from this, and it causes a fairly annoying problem (for us and various others). There is a ‘raw’ option that disables building a model from these results, but that sadly doesn’t make any differences to the behaviour here.

In the short-term, Sequelize has ‘hooks’ functionality that lets you tie your own code into its query generation. Using that, we can put together a very simple workaround by changing our connection setup code to look something like the below (and this is what we’ve done, for the very short-term).

function resetAttributes(options) {
    if (options.originalAttributes !== undefined) {
        options.attributes = options.originalAttributes;
        if (options.include) {
            options.include.forEach(resetAttributes);
        }
    }
}

var db = new Sequelize(db, username, password, {
    "hooks": {
        "beforeFindAfterOptions": function (options) {
            if (options.raw) resetAttributes(options);
        }
    }
}

If you’re in this situation right now, the above will fix it. It changes query generation to drop all ‘attributes’ overrides if ‘raw’ is set on the query, solving this issue, so that running the aggregation query above with ‘raw: true’ then works. Magic.

Solving this Permanently

That’s all very well for now, but it feels like a bit of a hack, and this behaviour seems like something that’s not desirable for Sequelize generally anyway.

Fortunately, we’ve now fixed it for you, in a pull request up at https://github.com/sequelize/sequelize/pull/4029.

This PR solves this issue properly, updating the internals of model.js to not change the specified attributes if it’s not necessary (if ‘raw’ is set to true) both for this case (attributes on the query root), and the include case (the attributes of your JOINed models). That PR’s recently been merged, solving this issue long-term in a cleaner way, and should be available from the next Sequelize release.

Once that’s in place, this blog post becomes much shorter: if you want to aggregate over an include in Sequelize, add ‘raw: true’ to your query. Phew!

Sponsoring Bonkron, a Ghanaian village


14 July 2015, by

We sponsor a village called Bonkron, in the Ashanti region of Ghana.  This is done through a charity called Ashanti Development, which our MD Zoe has been volunteering with since 2009 and is now a trustee of. We’ve raised money for our village predominantly through regular Charity Saturdays, but also other exciting events such as our annual stand-up Comedy Night and our birthday party.Kindergarten

Last April, with an initial donation of £19,000, we provided latrines, sponsored hygiene training and started a £300 hardship fund to take care of the elderly and disabled.

With water and sanitation taken care of, this year we faced a choice: what to build next?  We were quite keen on getting internet installed, to enable all kinds of support and improvements over Skype – healthcare, teaching English, even perhaps teaching coding?  However this turned out to not be super easy and was held up while Ashanti Development talked to Vodafone.

We decided to start exploring other options.  The village had been asking for a kindergarten ever since we first sponsored them.  As our contact Penny at Ashanti Development explained,

“In Ashanti, the parents often work on their farms all day. There’s nowhere for the pre-school children to go – probably no building large enough to house them – and they are left to their own devices. They play outside and you often see very young children who are badly injured in consequence […] So all the villages want kindergartens and are happy to employ village women to look after them, and since the little children have the worst time (they are the last in line for food, clothes, anything) I think kindergartens are a good idea.”

So in early April we gave them the go-ahead to spend another £12k on building a kindergarten!  They were really excited about this, and very quickly started work on it – they hoped to get sand, blocks and roofing done before the rainy season starts.  We got running updates about the work, and the building isn’t looking too bad as you can see.

BeesWe also spent £250 on sending two people from the village to a bee-keeping course.  They’ve built two hives, and were each given a hat and veil, a boiler suit and bee gloves, and a smoker.

We’re really excited by this opportunity to help a whole community.  Penny from Ashanti Development recently remarked: “I’m told that Bonkron is changing in leaps and bounds and is even beginning to look a bit prosperous. It’s amazing the effect that sanitation has on health and energy supplies.”

Where in the UK £25,000 probably wouldn’t get you a Central London parking space for the year, out in Bonkron it has gone so far towards helping the prosperity of an entire community. It’s been great to watch the changes in Bonkron take place and we can’t wait to see how they progress, as we push towards introducing the internet and bringing more positive changes to their lives.

Softwire’s Tech Workshops


9 July 2015, by

This year Softwire have started hosting events focussed on achieving success in the software industry. Our first event held in March focussed on getting the right talent into your tech team, particularly how to attract younger developers who are keen to expand their knowledge. Our most recent event looked at successful project delivery and how to achieve this on every project.
We had three great speakers come along to present their ideas on the topic.

Kicking off the afternoon, Johnathan Rigby from Fourth sditchpresented his ideas on motivating technical people. He was followed by Rachel Davies from Unruly, who shared some of the ideas her teams use to handle continuous delivery of their products. She presented all the aspects of extreme agile development that they use to keep their products up to date in a rapidly changing tech environment, including pairing and mob development. Finally Alex Wolff from Softwire who talked about making sure you take your projects in the right direction and the need for flexibility when handling an agile project.

Our special guest Bill Thompson hosted the afternoon, also chairing a panel discussion during which the audience were able to present their ideas about successful project delivery as well as getting more specific input from our speakers.

The event was packed out, with attendees coming from the IT departments of many companies across London. Having enjoyed the talks and time for discussion, we ended the afternoon with informal networking and a chance to enjoy the scenery at Shoreditch House. We’re looking forward to hosting more similar events later in the year.