How many 32-bit types might we want?

I was recently directed to an article on "tiny types" – an approach to static typing which introduces distinct types for the sake of code clarity, rather than to add particular behaviour to each type. As I understand it, they’re like type aliases with no conversions between the various types. (Unlike plain aliases, an object is genuinely an instance of the relevant tiny type – it doesn’t have "alias erasure" as a language-based solution could easily do.) I like the idea, and wish it were better supported in languages – but it led me to thinking more about the existing … Continue reading How many 32-bit types might we want?

Diagnosing issues with reversible data transformations

I see a lot of problems which look somewhat different at first glance, but all have the same cause: Text is losing "special characters" when I transfer it from one computer to another Decryption ends up with garbage Compressed data can’t be decompressed I can transfer text but not binary data These are all cases of transforming and (usually) transferring data, and then performing the reverse transformation. Often there are multiple transformations involved, and they need to be carefully reversed in the appropriate order. For example: Convert text to binary using UTF-8 Compress Encrypt Base64-encode Transfer (e.g. as text in … Continue reading Diagnosing issues with reversible data transformations

Career and skills advice

It feels a little odd even to write this post, but I receive quite a few emails asking me for advice on how to get better at programming, how to get through interviews, whether it’s better to be a generalist or a specialist etc. I want to make it very clear right from the start, I am not a career guidance expert. I have very little evidence that this is good advice, and it may well not be good advice for you even if it’s good advice in general. Oh, and don’t expect anything shockingly insightful or original, either. You … Continue reading Career and skills advice

But what does it all mean?

This year before NDC, I wrote an article for the conference edition of "The Developer" magazine. Follow that link to find the article in all its illustrated glory (along with many other fine articles, of course) – or read on for just the text. Back when I used to post on newsgroups I would frequently be in the middle of a debate of the details of some behaviour or terminology, when one poster would say: “You’re just quibbling over semantics” as if this excused any and all previous inaccuracies. I would usually agree –  I was indeed quibbling about semantics, … Continue reading But what does it all mean?

New tool to play with: SemanticMerge

A little while ago I was contacted about a new merge tool from the company behind PlasticSCM. (I haven’t used Plastic myself, but I’d heard of it.) My initial reaction was that I wasn’t interested in anything which required me to learn yet another source control system, but SemanticMerge is independent of PlasticSCM. My interested was piqued when I learned that SemanticMerge is actually built on Roslyn. I don’t generally care much about implementation details, but I’m looking out for uses of Roslyn outside Microsoft, partly to see if I can gain any inspiration for using it myself. Between the … Continue reading New tool to play with: SemanticMerge

The Open-Closed Principle, in review

Background I’ve been to a few talks on SOLID before. Most of the principles seem pretty reasonable to me – but I’ve never "got" the open-closed principle (OCP from here on). At CodeMash this year, I mentioned this to the wonderful Cori Drew, who said that she’d been at a user group talk where she felt it was explained well. She mailed me a link to the user group video, which I finally managed to get round to watching last week. (The OCP part is at around 1 hour 20.) Unfortunately I still wasn’t satisfied, so I thought I’d try … Continue reading The Open-Closed Principle, in review

Stack Overflow and personal emails

This post is partly meant to be a general announcement, and partly meant to be something I can point people at in the future (rather than writing a short version of this on each email). These days, I get at least a few emails practically every day along the lines of: "I saw you on Stack Overflow, and would like you to answer this development question for me…" It’s clear that the author: Is aware of Stack Overflow Is aware that Stack Overflow is a site for development Q&A Is aware that I answer questions on Stack Overflow … and … Continue reading Stack Overflow and personal emails

Diagnosing weird problems – a Stack Overflow case study

Earlier, I came across this Stack Overflow question. I solved it, tweeted it, but then thought it would serve as a useful case study into the mental processes I go through when trying to solve a problem – whether that’s on Stack Overflow, at work, or at home. It’s definitely worth reading the original question, but the executive summary is: When I compute the checksum/hash of c:\Windows\System32\Calc.exe using various tools and algorithms, those tools all give the same answer for each algorithm. When I try doing the same thing in Java, I get different results. What’s going on? Now to … Continue reading Diagnosing weird problems – a Stack Overflow case study

Currying vs partial function application

This is a slightly odd post, and before you read it you should probably put yourself into one of three buckets: Someone who doesn’t care too much about functional programming, and finds higher order functions tricky: feel free to skip this post entirely. Someone who knows all about functional programming, and already knows the difference between currying and partial function application: please read this post carefully and post comments about any inaccuracies you find. (Yes, the CAPTCHA is broken on Chrome; sorry.) Someone who doesn’t know much about functional programming yet, but is interested to learn more: please take this … Continue reading Currying vs partial function application

Coding in the style of Glee

As previously mentioned, at CodeMash 2012 I gave a very silly Pecha Kucha talk entitled "Coding in the style of Glee". The video is on YouTube, or can be seen embedded below: (There’s also another YouTube video from a different angle.) This post gives the 20 slides (which were just text; no fancy pictures unlike my competitors) and what I meant to say about them. (Edited very slightly to remove a couple of CodeMash-specific in-jokes.) Don’t forget that each slide was only up for 20 seconds. Coding in the style of Glee As you may know, I’m from the UK, … Continue reading Coding in the style of Glee