At the Scala Berlin meetup at Nokia.  Super, but I can’t help think the gender ratios are particularly skewed even for a tech meetup, spotted just one other woman. Ach well, there is beer :-)

At the Scala Berlin meetup at Nokia. Super, but I can’t help think the gender ratios are particularly skewed even for a tech meetup, spotted just one other woman. Ach well, there is beer :-)

Good morning tea, I love you x

Good morning tea, I love you x

Just wrote everything I should be doing on post-it notes and stuck them on the wall. Suddenly it becomes clear why I come home, think what shall I do this evening, and then feel overwhelmed and play computer games :-D  The good thing is, they’re mostly quick jobs, and totally manageable - just way to much to store in one little mind.

Just wrote everything I should be doing on post-it notes and stuck them on the wall. Suddenly it becomes clear why I come home, think what shall I do this evening, and then feel overwhelmed and play computer games :-D  The good thing is, they’re mostly quick jobs, and totally manageable - just way to much to store in one little mind.

Confusion and Frustration

Recurring Situation: I do some work in a non-Haskell language, and think “wow, this is hard … this would be a Haskell one liner … if only we had proper types, we could’ve skipped a whole load of bugs, understood what’s happening more, made the code easier to change, …. etc.”

Next, I tell people all about the nifty stuff I’ve found out, and their reactions make me feel something like how I imagine a Jehovah’s Witness feels. Everyone’s very polite and interested, and the opposite of convinced.

Through their eyes I see an abstract minded evangelist. But in my mind I’m a practical person sharing useful knowledge.  Gah!

Occasionally when you’re a developer you get one of those days when you spend hours and hours tracking down a problem, and then find out it’s something teeny weeny and yet non-obvious, and you want to scream about how stupid the world is.

On these frustrating days, I like to watch videos of the Bagpuss mice singing their mending songs. I love the way they’re so enthusiastic about fixing things and making things right :-)

For extra childhood regression style soothing here’s the magical mouse mill.

Things I like about Haskell

Here’s a list of some of the things I like about Haskell. It’s in no particular order, and is not exhaustive. There are things I don’t like about Haskell too, but this list isn’t about them.

It’s the opposite of verbose

You can write useful stuff in a matter of lines rather than paragraphs. Likewise if you want to understand some code, you’ve got so much less to read.

Okay, admittedly when starting out with Haskell, it can feel dense and hard to read, but it doesn’t take too long for your eyes to adjust, and for the brevity to become a blessed relief.

It’s safe

A friend of mine once said the Haskell compiler is like a logician sat on your shoulder. I guess this shoulder logician can be one of those people that might not come off so well on first-impressions. Sometimes he seems like an annoying irritating detail-obsessed nerd who is just itching to say “well, actually…” at every little mistake you make.

But the truth is he’s really a great guy, you’ve just got to put a little effort in to get to know him, figure out how you can express your intentions to him, and learn to read his error messages, and before long he’ll become an ever faithful and brilliant buddy who can do all sorts of useful work for you; and above all keep you safe. It’s kind of like having some sort of genius Rain Man type person and ever alert watch dog all rolled into one as your personal programming assistant.

It’s transparent

The logician on your shoulder is making sure that everything is defined properly. No side-effects allowed, and all the types of inputs and outputs must be known, and everything must be consistent.

The type signatures, and the type definitions pretty much just tell you what everything is, and there are far fewer surprises. Although Haskell does allow you to throw errors, making problems clear in return types in encouraged. You know that something with a pure signature isn’t going to be doing IO or messing with the database.*

* there are a few exceptions, that mostly involve a programmer deliberately using a function with the word “unsafe” in it’s name.

It’s concrete

Sometimes Haskell looks pretty abstract, like with this sort of stuff:

elem :: Eq a => a -> [a] -> Bool

wordyElem :: Eq a => a -> [a] -> String
wordyElem x xs = if elem x xs then "Found it!" else "No, it's not here!"

Yep, pretty abstract. But let’s actually use those functions:

> elem 'a' ['b', 'c', 'a']

> wordyElem 'x' ['a','b','c']
"No, it's not here!"

Despite the ability to define things in the abstract, and combine those abstract things together to make more abstract things, eventually when it comes to using things with some data the Haskell compiler will want to know the actual concrete types the data. By concrete type I mean, it expects to know “the input is a Char”, and it wouldn’t be happy with “the input shaped like this”.

Contrast this with the Java compiler which will allow you to have an object about which it knows nothing except that it implements the Comparable interface for Strings, and so can be compared to other Strings.

This nice, and slightly surprising, thing is that despite allowing you to be hugely expressive in the abstract, ultimately Haskell forces you to think in very concrete and clear ways about your data. And there’s something very solid and nice about that approach.

It’s easy to refactor

Well, this is hugely dependent on how loosely coupled your programming is, but in general the little shoulder logician is a huge help when refactoring. This makes sense, as you can think of your Haskell compiler as doing a sort of unit testing, and the key to good refactoring is having good tests.

Whilst we’re on the subject, I’ve heard it said that an advantage of using a dynamically typed language is that the programmer is forced to write unit tests, which I guess is true, and I have to admit that the test code coverage for a great deal of the Haskell libraries in Hackage is pretty low … but what if I said that an advantage of using a language with an obscure and ugly syntax is that the programmer is forced to write comments to explain it’s meaning? Well, the comparison is slightly facetious, but you see what I mean.

It’s easy to write reliable unit tests

The transparent nature of your input and outputs and lack of side-effects, can make it easier to write comprehensive and reliable unit tests.

It’s easy to maintain

I should qualify. You can easily write terrible sh*t Haskell code that’s a nightmare to maintain; it’s not magic.

But if you combine Haskell’s terseness, and transparency, which make it easy to read, with the lovely helpful compiler and the advantages that brings to refactoring, and perhaps some high quality unit tests if you’re doing it properly, then it’s not hard to see that a Haskell codebase can be easier to maintain that those in some other language.

It’s begs you to model

Mental models are the programmer’s secret sauce, no matter what the language. Just as much as writing a good story isn’t about knowing grammar rules and vocabulary, writing a good program isn’t about knowing languages and libraries.

In any language, when you look at good code it looks like it’s not really doing that much; it looks effortless, and simple, because the approach and way it’s been modelled makes the functionality just easily fall out. Bad code has to put a lot of effort in, it looks big and complex and it seems to be doing an awful lot of stuff.

We all sort of know this intuitively, and it’s why we would expect someone who’s studied maths, science, engineering or philosophy to have an advantage when tackling programming, even though you program most things without needing to know much more than basic arithmetic, and logic. We know that the subjects are kind of similar, but what is it that’s similar about them? They all involve building and working with mental models, ideally ones that are simple, useful and elegant.

Building models is important in any language, but with Haskell that logician on your shoulder is trying his darnedest to force you into it; he wants a model that is coherent and consistent, that he can wiggle around for you, and if he doesn’t feel like he’s getting it he’ll spew errors at you until he’s satisfied.

Now that’s not to say that the model you’ll build will necessarily be a good one, or that you can’t pull certain tricks to evade his watchful eye, like hide under a mahusive monad stack stuffed with IO and global state and pretend you’re programming a declarative language, but at least Haskell is shifting the emphasis from just telling a computer what to do, to creating a model. In short, it makes you think.

It’s actually kind of easy

In all the struggle to create elegant models, and the constant discussions with your shoulder logician, and all the new concepts to grasp and internalise, it often doesn’t feel like it.

But the concepts come, and you fall in love with the shoulder logician, and you eventually hit on something kind of elegant, if you squint a bit, and suddenly you have something small, and nifty, and shockingly simple, and you think “wow, how did that happen?”.

It’s feels good

Who knows why really, but for all the rationalisation, ultimately I like Haskell because it feels good. Best reason for anything.

Lovely Weekend

Oh me, oh my!

It was GeekGirlMeetup Berlin this weekend, and I think I could sleep for a week. Really happy :-D  I have no idea how there are so many friendly, talented and fantastic Berlin techy women, but there are.  And it’s nice.

Love Emx

Emotion Splurge

I started a new job this week. This is a permie job, not a quick fill in one.

The first week felt slightly overwhelming and scary, this is not at all because it’s a scary place to be, in fact everyone is very welcoming and friendly. It was caused by a combination of a strong desire for everything to go well, mixed in with confidence issues on my part.

Also, I confess, I was super hormonal all week. It was the sort of week which should’ve been passed in pyjamas watching sad films whilst blubbing uncontrollably, eating stuff, and definitely not thinking about your bloated stomach and spotty face. (Sorry, to much info.)

Whatever, hormones don’t excuse it, and I know the cure anyways … focus on enjoying yourself, and have lots of fun :-D  And I think that’s going to be fairly easy to do at this job. So all is clover.

Mind you, that can be on Monday.  This weekend will be a special treat pyjama weekend.

Wishing you lovely weekends too xx

Bank Job Frustration

I’m doing a quick job for a bank. It’s just 2 weeks to fill in for someone’s holiday, and it turns out the people here are quite nice. Niceness isn’t considered that important in some banks, so it’s much appreciated.

There’s just one thing that’s driving me up the friggin’ wall. Lack of internet. Well, we have internet, but there’s a whole lot of stuff that’s been blocked, like Twitter, Facebook and Gmail.

I do have my phone, but I’m in one of those large tower block things, clad in oodles of metal and glass. I’m sat in the centre of the floor, and no light can penetrate this far in. Mobile reception is minimal, and the lighting is fluorescent.

I’d like to Skype my old CEO and ask him if he’d sponsors someone from Scrive to come over to Berlin to talk about using Haskell, but I don’t have reception enough to use Skype on my phone, and I’m blocked from installing it on my computer.

I’d like to go on Facebook and organise a way for all the GeekGirlMeetup Berlin organisers to meetup, but I can’t use Facebook, and even if I could, if I organised a Skype get-together I’d have to go out to an internet cafe to join in. Which I can only do at lunchtime.

I’d like to email people the great news that I met up with a lovely lady from Skills Matter yesterday, and she said she wants to help out the functional community in Berlin, and if I send her a wishlist of our dream people, well you never know your luck … if they’re in Europe maybe they could pop over.

Now, I guess because I’m only here for a couple of weeks, it doesn’t really matter. But imagine if I were working here permanently. It feels deeply crazy and anachronistic for a company to be actively restricting its employees interactions and communications with the wider world, especially when done in such a blunt and all-pervasive way.

No Twitter, no Facebook, no email, no communicating. It all feels very retro. To complete the feel, I have a PC running Windows XP, with IBM Lotus Notes for email and a copy of IE7.

Ah well, at least they haven’t figured out that Tumblr exists :-)

An unfocused splurge. Please be forgiving.