I’m excited at the moment, as I’m working on a project with some community guys (can’t say what, it’s a bit of a seeeecret), but I’m getting my mind back into design mode, which it hasn’t been in for a while.
So I thought I’d start by doing some developer Yoga! What’s that? Well, you pretty much grab two language specs (any would do), in my case, JDK 5 and .NET 2.0, and go over the language enhancements (including some of the basics), and also throw in some UML, etc. This hopefully gets your mind going again 😉
Well, as I was looking at some code examples, something popped back into my mind which I hadn’t thought of in a while, the whole idea of Class Normalization. So, you know, in Object Oriented design, you see alot of this:
Dog dog = new Dog();
Master master = new Master();
Nothing scary here, just two abstractions represented as classes and instances. But let’s move onto the most important part of this, the relationship. This is were we have a design decision to make; because for example, does the Master class walk the dog, or does the Dog class go for a walk?
Ok, let’s see that:
Class Normalization recognizes the relationship as needing an abstraction, for example, AWalk. So I can then do:
AWalk walkies = new AWalk(master, dog);
Then I can do cool stuff like:
walkies.distance = 3;
walkies.direction = WalkiesDirection.South;
It’s funny how the simple things in life…are, well, simple Av’a’good’week’end!