Tuesday, August 26, 2008

By feature or by layer? Neither and both!

It's one of those classical discussions that has been going on for years: should you organize your code by feature or by layer? What's the right answer to that question depends on the project and the way developers are going to work: will they have the need to look at the code from a layers' perspective, then the code should be organized by layer first. Will they use the features' perspective most of the time, then the code should be organized by feature first. But what if a group of developers will access the code by feature, and another group will access the code by layer most of the time? Or what if you would like to access the code by feature half of the time, and by layer the rest of the time? (Which is almost equal to saying that you really don't know.)

The problem may be that we're asking the wrong question. In stead of asking whether we're going to access the code by layer or by feature most of the time (or that we want to impose one of them on the developer team), we should be asking how we can allow the developers to access the code the way that suits them best at any time. Or in other words: if they need to access the code by layer now, and by feature for the next task, how can we accommodate for that? The answer is: by not organizing our code in a fixed, hierarchical manner, but by using tags and tools that allow to access the code by those tags. Unfortunately languages like Java don't support this yet, so we'll have to find a way around that...

No comments: