Inspiration, Inertia and I

One of the things about writing a blog is that there has to be something to write about. I am a regular reader of Coding Horror because of two reasons:

  1. Jeff Attwood writes good articles
  2. He does one every working day of the week

This is no mean feat. I’ve been reading his blog for about 6 months and I can honestly say that, although there is a central theme running in his posts, I haven’t detected any obvious repetition yet. When I think about what I’ve achieved in the same time frame I’ve probably managed one-or-two per month!

I recently heard Jeff talk and I think I have an idea at why he’s so much more prolific: he’s prolific. He has made a commitment to himself to publish every working day and he does. And this effort generates momentum, which generates traffic to his site that generates comments and trackbacks that fuel further ideas for him to write about. Where he has intertia, I am inert.

As for the inspiration it’s like anything. The more you do it the more you can do it. It’s a form of exercise for your writing brain. Once you start writing the ideas start to flow. I’ve been in love with the idea of writing for a long time, so perhaps I should follow the advice from his .NET rocks article and make a commitment to publish.

My original reason for beginning this blog was to write about the technical tricks and traps that I discovered. Mostly as a source of documentation but also as an experiment. But lots of people do this, because it means you don’t have to think about what you write. Yes, it serves a useful purpose because it means that a lot of problems I encounter can easily be looked up and fixed. But if someone else writes it and documents it am I adding anything by doing the same? I know the answer to this has to be no. If 95% of the internet disappeared tomorrow I’m still pretty sure I could Google to find out the syntax for adding a CONSTRAINT to a MySQL database table.

Please believe me. I’m not looking for the fame or hits. Just looking for my voice. When I find it I’ll be sure to let you know.

Paul Graham wants me to think he is mad.

Paul's book I’ve been reading Paul Graham’s Hackers and Painters. Published in 2004, it only just found its way off of my reading shelf and into my brain. This Amazon reviewer really sums up the book nicely although I mildly disagree with some of the statements.

Most of the book is a long-winded lecture about how great Lisp is, and about how that is the language of the cool, smart people.

There is very little about painting, it is only briefly mentioned in the beginning.

The first chapter is quite good, then it gets more preaching and more dull rapidly.

Mr Graham is obviously a smart guy and a capable writer. The fact that he was part of a dot-com start up that actually succeeded seems to have gone to his head though. Somehow the fact that he was in the right place with the right idea at the right time enables him to declare Lisp as the uber language, and everybody who doesn’t see that is a dullard?

The title suggests a book which is whimisical and fun. This book is a preachy diatribe by a pompous hacker who things he has the proper world-view for everyone.
— Kevin Stokes

But to give Paul his due he covers some excellent topics. One of the most intriguing ones is the third chapter about thinking the un-thinkable. The suggestion is that by thinking the un-thinkable you will enter a new head-space where perhaps you can make a concerted difference to yourself or others. When I read it, I thought: “I like this idea, I might try it out”. A few more chapters passed and he is talking about Lisp (which I will return to shortly) and I’m thinking: “I’m bored. Where’s my unthinkable thought got to?”. I thought really hard and I got one: “Paul Graham is mad”. Plain and simple. As instructed by Mr Graham I started to explore this idea right away to test its validity.

  • If Paul had a mania what would it be?
  • Where should we look for manifestations of this mania?
  • Will trying out Lisp make me as mad as I perceive all the other people that use it to be?
  • Am I mad and if I am would I be able to answer this question?

And I came to the conclusion that Paul Graham is not mad. Sorry folks. It’s just not true. However, the majority of his un-thinkable ideas (at least in this book) all seem to originate from a single perspective point (you get these in art too I understand!) that choosing Lisp allowed him and his colleagues at Viaweb to produce something others could not. Which is in itself a remarkable statement if it is as true as he suggests. So I thought I’d have another try at Lisp. I tried it once before and wasn’t totally turned off by the idea I just never really got going.

Now don’t get me wrong. I’ll not be trying it just yet. This is just a warning you understand, especially since I wouldn’t want Paul to think that he’d succesfully goaded me into it when he said:

… but I don’t expect to change anyone’s mind (about Lisp) over the age of 25 …

I reserve the right to not let Paul Graham into my head and eat my brain. It’s mine and I’m keeping it mine until I decide otherwise.

One of the cricisms of Lisp is that it doesn’t have very good library support. A little investigation into Unit testing frameworks and MySQL wrappers seemed to bear out what the Reddit development team are saying.

What makes Lisp so much greater (it seems) is that data and program are inter-changeable in as much as you can treat pieces of program like they’re data and vice-versa. And it’s difficult to conceive of a programming language that has the two concepts so fully inter-twined. Reflection is a way of achieving it but in my view reflection is evil because it makes compiler optimisations and function call traceability harder. These two arguments don’t apply to Lisp so Lisp wins again. It is partly because Lisp has all those brackets that it is so powerful.

And so we link into another one of Paul’s un-thinkable ideas which is to design the programming language of the future. His belief is that by imagining what we will want we can make this language today. Anyone can do it. And probably either has or will, we just don’t know it yet. He believes that this language will be optionally OO, with very few axioms, and support something like macros. Smells like Lisp to me. Change the meat on the barbecue Paul.

I refuse to believe that Lisp is the future. It would be quite extraordinary and quite exciting if it were to become so, but my crystal ball says no-way padre. But it is one of the languages in the evolution of languages that has played a significant role. And I do believe it has more to offer. Its time will come again and some spark will incorporate the final pieces of high-hanging Lisp fruit into the language of tomorrow.

It’s just that we’ll be able to do it without having a permanant speech impediment. Thhhorry Paul.

Too much information!

So, I was looking for something to listen to whilst I decided what I was going to do today. Would I go and: hunt for a much needed filing cabinet, work a bit more on the tibco/rv project, try working some more on my pet internet project, or have another go at some Rails programming? Couldn’t decide.

So I hunted my music collection for inspiration.

Bizarrely, I chose Duran Duran‘s Wedding Album which I always kind-a linked even though I’m not a huge fan of Duran Duran or Weddings (apart from my own of, course).

I played it and I was immediately taken back to 1992/1993 when I drove around Tadley in a car not too dissimilar to this one.

Ford Sierra

It was sadly, not a Cosworth (like the one above) so was similar but not quite as good. Savour the scene. A 20 year old youth, with patchy stubble and DMs and driving around a nowhere-town in a 8 year old knackered family saloon playing Duran Duran. I probably thought I was cool. I was most definitely wrong.

There’s a few misty-eyed memories from that time, most of which I’m not going to share. But the thing I was doing at the time was working on a program called the “Fragment Data System” for a forensic research company. So I duly typed those words into the internet and discovered a link to something about it.

From the link I figured that it was from a table of contents from a book published in 2000 called “Forensic Interpretation of Glass Evidence”. One of the co-authors of which is an ex-colleague of mine (John Buckleton).

Forensic Interpretation of Glass 
Evidence

Now let’s get one thing straight, the Fragment Data System, was not a great product. It was probably the best I could have done in 1992/93 as an intern and it definitely worked. So, to have it mentioned in a book is kind-of surprising. But that’s not the most surprising thing. The most surprising thing is that I can find echoes of my 15 year old past on this damn internet. It probably has more things about me hidden in its dusty corners.

It gets you thinking. In 1992/93 the public internet was a new thing, it was starting to gain popular ground and dial-up was king. The youth of today have the internet available as soon as they want and it seems that disaffected youffs everywhere need to write about their deepest feelings on a myspace somewhere. Well fast forward 15 years and you’ll find most of your adult life documented in a publicly viewable place. Kind of scary. But not maybe for the reason you might think. If everything you do and everything you are is on the other end of a TCP/IP socket, and those boys are everywhere, you don’t need to remember anything. It’s all there. You just have to know how to find it.

This is great news! I just attach myself to a computer and I no longer need to know what I’m doing or who I am because the internet has all this information. A little like Memento but without the need for body defacement. Now if I could only remember what happened to my wife it would be really helpful …

Learning Ruby by Extension

So I’ve spent the past couple of months learning Ruby. My previous employers are python nuts. And I have to admit as languages go Python is pretty good. But then I heard about Rails and so I gave that a try.

Already a fan of MVC, Rails appealed to me for the same reasons it appeals to everyone else. It’s quick to develop! Still hunting for that killer Rails app I decided to take a look at what else Ruby could do and bought a copy of the pickaxe.

Now it just so happened that I learnt Python by writing a wrapper to the TibCo Rendezvous library. I learnt a lot about Python that way. Especially nasty, dirty stuff, like garbage collection, the GIL and other threading nasties. This is because the Rendezvous library does/requires a number of things internally:

  1. creates/destroys memory that could have been referenced by a Python object
  2. requires messages to be ‘pumped’ from its message queue and delivered possibly in the same or different threads
  3. requires a callback from the RendezVous library back into Python code

These things generate a few programming challenges and require you to understand some internals of the language before you can make much progress. So it was by some curious happen-chance that I ended up involved with the Ruby version of the project.

So now I get to do it all again, but in Ruby! I’m hoping to make a better job of it this time, and I’m also helped by having some of the hard work already done. I’ll be posting various bits and bobs about the progress of this project as time passes.

In the main though, learning Ruby by extension has been overall quite pleasant. I disliked Python’s extension mechanism because it’s a bit of a pain to use and in the end I used Boost::Python instead of using the C fn() calls. In contrast then the Ruby extension mechanism is as clean as it can be and once a few simple rules are observed things mostly just work how you’d expect.

Now then, every concept in computing these days seems to have a TLA to accompany it which is also its mission statement, e.g: REST, DRY, blah, blah. Well I’ve now got my own. Here’s mine: SANS., Simple And No Surprises.

That’s what I want, simple programs that work how you’d expect, SANS-crap.

Vive l’ordinateur!

My C++ wants to kill your momma

… well actually it doesn’t. But it sounded good when I made it up. So recently I found myself needing to use a C++ partial function specialisation. No-one was as surpsied as me when this happened.

To say I was anti-templates would be too strong. I find the code they produce hard to follow, regardless of how elegant and efficient they really are. But then they do serve a really useful need. Obviously containers are an example of something where templates are indispensable. So you can’t just write them off.

But now that we have the standard library (and boost) do mere mortals really need to worry or bother about templates in the large? I think the answer to this is probably no.

But then again it depends on what you’re doing. And since I’ve started working on writing a wrapper around the TIBCo/RV library for Ruby I found myself writing a lot of C++ code that was very similar apart from the types involved. So then a little light bulb goes on in my head (40w supermarket own brand, cliche retardant) . Surely I can write a template to do this for me? This will mean that there’s only one code base for a bunch of similar behaviour and when I need to write that internationisation add-on (i18n) for my error messages I’ll only need to change one or two methods instead of a zillion.
Continue reading “My C++ wants to kill your momma”