Archive for December, 2007

Composite oriented programming to the rescue?

Friday, December 28th, 2007

Some people, counting Richard Öberg, have come up with the latest in a long series of attempts at solving a long-standing OO problem – how to create classes that can take part in several different functions.

An example: Suppose you are a developer working for a telco. You may have heard about something called a “terminal”, which is… well… a phone. Sort of. Only it can do much more. No, really. A telco guy would know what I meant. (And, presumably, agree with me about the concise meaning of the word, which I can guarantee would not happen. Another blog post waiting to happen right there.)

If you have been persuaded by Eric Evans or Martin Fowler, you will quickly notice that terminal is a noun, and therefore may be a domain object. If you have not been persuaded by the gurus that a domain language or a domain model is a good thing, this post is not for you.

A terminal has several different natures. You can think of it in terms of a logistical unit – something that sits in a warehouse, gets mailed to a customer, then possibly returned.

It is also something that provides a dial tone to the customer. Note how a dial tone has very little to do with logistics. This is something separate, which happens once the customer has gotten hold of the terminal. Both of these functional areas are relatively complex behaviors which are going to need many lines of code to describe.

I can think of at least two more major functional areas terminals are involved in – and this is typical of a domain model. Your model is probably going to contain several hundred domain objects. A handful of them are going to be model hot spots which will, if you don’t watch your step, grow into spaghetti monsters with several functional areas smeared out over a single object. This is a problem on many levels. The simplest problem to describe is the sheer size of such a spaghetti mess – several thousand lines of code that is not one coherent unit, located inside one class/file is very hard to understand. Hard-to-understand code is not a good thing. It is a specialized case of writing your system using a single object.

Many have tried to solve this problem before. C++ uses multiple inheritance. AOP solves this problem, as well as many others. So far, no single solution has “won”. If you want to read more about these solutions, I suggest getting Filman et al, “Aspect oriented software development”. Oh, and while you are at it, Clarke/Beniassad: Aspect-oriented analysis and design might be a good companion book for when you want to draw your domain model out on a whiteboard. UML is not going to cut it alone.

Qi4j seems to be a rework of parts of AOP with this problem in mind. I haven’t been able to look at it much yet, but so far it looks more promising than AOP did. I think AOP has lost. I can’t really see any programming shop invest in teaching AOP to its junior developers if they haven’t done so already. The required “delta skill set” to use AOP is just too large compared to the benefits, and it is also “old technology”, which for some reason is ungood in the software business.

Qi4j looks like a much lighter-weight approach to this problem. I am going to be interested to see what happens to it in the coming months. I hope I can find the time to look much harder at it.

Geir

“Anything that is not in subversion only has short-term usefulness”

Friday, December 21st, 2007

This statement appeared in a mail discussion today. The context is an architect from a large financial institution saying this in response to an effort to improve the information flow within the organization.I don’t really agree with this. Anything you stuff into subversion is going to have to live within a branch/release world. Not all information is well suited to this format.

  • The release plans themselves – this information usually lives in some tool, and drives the branch/release structure of subversion.
  • Information about how you get up and running as a developer – this should stay static between releases. If it doesn’t, you may have a problem.
  • How to install the system. This should also stay as static as possible.

I think a wiki is a very good place to put things like this.

A wiki removes the focus on following some template (“We must have the ‘Foo’ section, even if it is empty!”) and forces whoever writes the information to think about his audience. Hopefully, this leads to something that is more useful.

A wiki is publishing-oriented. A word-document is more of a write-only kind of communication where the document gets put into a non-searchable structure, where it stays put and fossilizes over time because nobody can find the thing.

A wiki does not follow a branch/release structure. It is totally amorphous. Therefore there is room for the “strange” information that doesn’t fit in anywhere else.

A wiki lets anyone edit information – and it is very easy. This makes it easier to pull people into the documentation project. You don’t have to set aside a week to improve a wiki page, like you would have to do to write a document – or get permission to change one.

A wiki can function as the “single” starting place for people who look for information. This is, perhaps, the most important aspect of a wiki.

Still, a wiki is only a technology. It can be abused, just like any other technology (word?).

If your users are unstructured, the wiki will be unstructured. If you don’t care about documentation, the wiki will probably not be up-to-date.

A wiki is also an awful tool for working with diagrams. Since people usually grasp things easier when they are presented with illustrations, this is a big drawback for doing more complex documentation in a wiki.

A lot of wikis have very poor versioning capabilities. Some information is going to change over time, possibly not in step with your releases, and you will have to do the changelogs by hand if you care about that kind of information.

Still – a wiki can help organize some of the information that does not fit into a branch/release model.

What we need may be a subversion with cross-cutting capabilities. It should be called SAOP.

Geir

Unitils released

Tuesday, December 18th, 2007

Well, the unitils guys beat me to it – they have now released version 1.0 of their tool.

As for testaco, there won’t be any free time for that until march, earliest. There are just too many things to do. It also does not make sense to have two tools like unitils and testaco which to mostly the same thing, but in incompatible ways.

I am contemplating dropping the test library bits of testaco and using unitils instead. This would make testaco an eclipse plugin and a documentation bundle for how to create an integration test suite. I really don’t know.

Feedback would be much appreciated.

This will probably be my last post until the new year. Happy holidays, people!

Geir