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.