Wednesday, August 25, 2010

Separation of concerns

So I got myself stuck a bit. Much of this was due to a lack of tests (boo) and a problem trying to think how to write tests. And much of the problem with the tests was to do with setting up the environment; I tried too early to get things compiling themselves.

I did went down the DynamOS in DynamOS route because I had a lot of code where I hard coded functions and objects (eg lists and numbers) and I don't want that, it looks bad. Sorry not being very clear.

Anyway, where I've ended up is that I realised I need to separate the data from the code; I need to _start_ with the image and test against that. I can write tests against the contents of the image as well. But that's where I have to start, rather than the poxy 'Environment' object I currently have.

And it separates the testing too. I can test the loading of the image completely separately from its execution. And I can test it's execution completely separately from the contents of the image itself (sort of).

This makes me happy, and provides a new direction for me to work in.

BTW this was largely inspired by JSqueak, not because it particularly does this, but simply by having a look and thinking about things a bit differently.

No comments:

Post a Comment