The Cosseted Programmer

It appears we have come to a juncture in information technology where the sheer weight of data is forcing us to draft everybody into the ranks.  Over the years there have been multiple plays to gamify programming – make it cool – make it understandable – rather have people just stare dumbly at that results and prod occasional buttons.  Our limbic system flinching in response to sounds and colourful 3D shapes was previously considered satisfactorily.  Now we are encouraged to buy virtual stuff inside other stuff to make our experience more valuable.  And it works – because unlike pharmaceuticals – these things aren’t licensed and our kids are hooked into them from an early age.


And it’s no longer enough to just consume these goodies – we’re also taught to create.  Creation is cool.  Photos, videos, blogs, apps.  It’s a self perpetuating cycle of creation – no destruction, just additive, endless piling upon piling of bits into bytes into terabytes into hard disks in drawers and burned onto disks and stored away never to be looked at again.  The world may soon fill up soon like the Stross/Doctorow dystopia planned and we’ll be forced into living in the Clouds ourselves or turn the solar system into one big computer.  Our bodies slumped in the corner of our living rooms while the substrates fill up with our souls emancipated by the combined efforts of humanity – from east to west – working together to abstract our lives away from a flawed meatspace.


So there are these guys like Bret and Light table guy and Anonymous Game Framework Guy who probably all live on the West Coast in the sunshine and think purely in terms of web servers, big data, shiny tablets, closed feedback loops and turning everyone into a developer.  And that is all well and good and also sometimes I think like that and the world is all shiny and exciting – but there is somehow a missing element here.  Our thoughts turn to the lack of boredom thanks to smartphones.  The gap between waking and sleeping where we’re not sharing our lives with each other or silently just consuming others thoughts or the thoughts of machines.  How many of those twitter people you’re reading are actual people typing stuff and thinking stuff?   Are we even paying attention enough to pass our own Turing Test?


A lot of effort, direction and money is being spent/burned/created/transferred in order to capture and inspire developers.  To draft a few inferior souls into the wake of conglomerates who have spotted our Achille’s heel and are making us all believers of a doctrine whose only basis is that inaction and not thinking of anything better to do is a good reason to glance down and lose ourselves again in our hand held worlds.  At the same time as these real businesses – ones that provide a service and get a payment for that service – are making a lot of money out of this shuffling around we are held fascinated in the glow of the Gorilla[R] glass.  We are marking time.  This developer for all, creator for all – as I read it this week the ‘democratizing’ of the development landscape – is no such thing.  And despite these tools being wonderful and in their own way addictive (so that one can become addicted to simply learning more development tools) occasionally it’s just nice to sit around and do something worthwhile and with merit rather than worrying about what technology it needs to use in order to attract the most attention.

The Speed of Change

So I’ve been changing my little 3D app into a framework and puzzling over some of the challenges that this in itself throws out.

A framework creates a logical structure over an existing (or missing) structure and provides you a consistent way of thinking about things. This applies not only to applications that might use that framework but also to other technologies you want to integrate on the back end. The advantage of turning an app something into a framework something is that in you’re effort to construct the framework you start to ask yourself what you really want out of the technology. Additionally you might get lucky and turn what you’ve created into something that someone else could use. So by creating a framework you’re abstracting, promoting re-use and thinking carefully about your design – these are all good things.

So what does “a framework” mean?

In the case of an input device framework this means that you can think about how simple interactions with users are to be represented without having to deal with the actual keystrokes, mouse clicks and gestures just yet. So you can define an interface and then worry about the details when you actually come to use it. In the case of the components you want to define in your framework – the targets for these actions – then you can also think about the interfaces they should expose and how best to interoperate with them. Again the technology that the framework operates with will have certain limitations but those are details that you or someone else can worry about later.

So in some ways it’s just a method of procrastination?

It can be if you’re not careful. And as with any form of programming it can be as simple or as complicated as you want it. The challenge is to do this in a way that is meaningful and works for my existing app in one existing technology but with eyes on the future. With my app’s current dependence on XNA (and XNA may have a limited shelf life) I want to ensure that my own framework is going to allow me a method of porting potentially to DX11/C++, WPF/XAML, Android/Java, iOs/Objective C or wherever else I want to go. So I’m investigating these other technologies as I come up with the framework – so it acts as a stepping stone as well as a way of breaking up the work of porting into manageable chunks.

So where does this end up?

A framework may well end up being no use to someone else but it will at least provide you with a stable view of various technologies underneath – a little like a photographer framing a shot with his hands. Your frame of reference is you, rather a moving background with unclear borders. And in case you haven’t noticed technology things are moving pretty fast these days. If you want to get ahead – then get yourself a framework.

C++ (chew slowly)

I spent a some time on the weekend looking at Rosegarden for Windows for the first time in a while.  I’ve been meaning to get the device allocation working correctly with RtMidi and get the MIDI recording also working but it’s slightly more challenging when you have to pass stuff back from it’s own thread rather than having access to all the nice Driver level features we’ve built into Rosegarden.

Rosegarden has the concept of a Studio – originally this was designed around the idea of device templates and the autoload document in Logic Audio – so essentially you can set up your external MIDI and audio devices once and then save it all to your autoload file and every time you hit ‘New Composition’ you get a fresh canvas with all you devices all set up and raring to go.   In my original design I’d also expanded the idea of the Studio to encompass audio placement eventually so that you’d be able to mimic acoustics of virtual instruments and such like – so being able to place MIDI and audio instruments in the stereo (or more) sound field and have consistent effects.  However it just became a layer in the end whereby we could try and put sensible names onto MIDI instruments and provide something approaching a consistent interface across audio and MIDI.   Perhaps in this regard it wasn’t such a good idea simply copying the Logic Audio model because to be honest it wasn’t a very elegant solution – I just didn’t know any better.

Have a look at Albeton if you want to see a way that this can be addressed for recording purposes.

Anyway – I digress – Rosegarden has a Studio concept which is an abstraction of MIDI and Audio devices and I need to tie up my outgoing and incoming MIDI events to the Studio model if I’m to make Rosegarden understand what the events are and where they come from.  So I have to jump through a few hoops to make the MappedStudio (as it’s known at the sequencer level) available to the MidiThread.  At this point I got a great remind of how hokey C++ syntax is – as my RtMidi event callback is a static method I have to declare any data structures that it wants to use also as static.  As I’ve been used to the wonderful world of C# for a long time now I tried to write:

static public MyStructure m_myStructure;

In the class definition.  Forgetting of course that my scope definitions are section based in C++.  Then for the life of me could I remember how to initialise this static public structure in the code and where?  No – first I tried in the header (of course no joy), then in the body but of course I got the naming convention wrong.  Eventually I got my definitions correct after a lot of fiddling and probably some swearing and of course waiting for the rebuilds (don’t forget the linker errors) but it demonstrates to me just why I moved on around 2004 and tried another language or two after being mired in C++ land for a while.  It can all drive you insane and I’m just now thinking that I’ve not even started to think about debugging the undoubted mistakes I’ve made in memory management with the changes I’ve made.

So bear it in mind, C++ is wonderful for connecting across the seemingly impassable chasms of disparate functionality and fixing holes between APIs but it takes a bit of your soul with you every time you lose your temper.  So take small bites, chew slowly and keep topped up with plenty of fluids.  It’s going to get warm and shouty out there.

The Xyglo Framework

Rather than ploughing on with features directly in the Friendlier codebase I’m now in the process of breaking it out into a framework that I can share with others.  This will allow me to get feedback from all you developers and also potentially target multiple platforms – or at least see what I have in common with other platforms and if the same event model is going to work with them.

What with things changing in the Windows world – W8, DX11, perhaps the end of XNA then this for me is a sensible option.  Also I want to shortly have a look at VS2012 and the options available there.

Please as I just tweeted – Kinect for Windows SDK is going to be upversioned shortly and I’m still lagging behind on my framework for that too.   So, back from the summer break, suddenly masses to do to keep up with the rest of the world.

I’m also way overdue on my promise to do some more work on Rosegarden for Windows.  This also needs to be worked into the mix.

All in the all my poor Raspberry Pi doesn’t get a look in!