Characteristics of "Great Software Design"TM

This post is not about design-design, but the internal design of a software system. Such a design has several general characteristics, and Code Complete 2 has a list of these. First, a related quote by R. Buckminster Fuller:

“When I am working on a problem I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong.”

Great Software Design would have all these characteristics, but that’s almost never possible. Some of them contradict each other, so often we have to make tradeoffs. Anyway, here’s the list:

  • Minimal complexity – if your design doesn’t let you safely ignore most other parts of the program when you’re immersed in one specific part, the design isn’t doing its job. This is also known as avoiding complexity.
  • Ease if maintenance – design the system to be self-explanatory. Wheter it’s yourself or a maintainance programmer that’s going to sit down and fix a bug in a couple of months time it’ll be worth it.
  • Loose coupling – Loose coupling means designing so that you hold connections among different parts of a program to a minimum. This means; encapsulation, and information hiding [read] and good abstractions in class interfaces. This also makes the stuff easier to test, which is a Good Thing.
  • Extensibility – You can change a piece of the system without affecting other pieces.
  • Reusability – Designing the system so that you can use pieces of it in other systems.
  • High fan-in – This refers to having a high number of classes that use a given class. This is good, the opposite on the other hand …
  • Low-to-medium fan-out – Refers to how many classes a given class use. If a class have a high fan-out (Code Complete says this is more than 7 classes, I don’t want to be that specific) this is often an indication of that the class may be overly complex. And complexity is bad, remember?
  • Portability – How easy would it be to move the system to another environment?
  • Leanness – I guess this could be compared to KISS. Voiltaire said that a book is finished not when nothing more can be added but when nothing more can be taken away. Extra code will have to be developed, reviewed, tested, and considered when the other code is modified.
  • Stratification – designing “in layers”. Can you view “one layer” of the code without thinking about the underlying layer? An example giving in Code Complete is if you’re writing a modern system that has to use a lot of older, poorly designed code – you would want to write a layer of the new system that is responsible for interfacing with the old code.
  • Standard techniques – this means using design patterns whenever it is appropiate to do so. This way, if you say to another coder “Here I use the Factory pattern” he will instantly know what you’re talking about if he knows the pattern. You do not want to be one of those “valued employees” who only write code that the “valued employee” can understand.

And, whatever you do: DO NOT CONSIDER SPEED! NEVER OPTIMIZE WHILE DESIGNING! (yes, those really needed to be capitalized). If I have one more PHP coder tell me that the MVC solution probably won’t be speedy, I will have to slashdot him physically in public. You don’t want to start off by trading any of the characteristics above for speed.

You design the system with design in mind, and if it turns out to be slow then you optimize. You will know what the bottleneck is, and you will make a sensible and thought-through trade-off. Then you will have your good design, and your speed. You will, rule the entire planet. Hah, kidding, the last part I just made up.

Well, what are you waiting for? Run out in a flowery meadow with your pen and paper and design something beautiful!

A guide for moving to Norway

Ok, I see this post is getting some traffic from Google on keywords such as ‘relocating to norway’, ‘moving to norway buying a house’, etc. etc. so before you start reading you should know that this article is a joke I published back in 2006. Ok, maybe it’s a little bit of truth in it. But it’s more of a rant than a serious guide. If you’re looking for something more serious you should probably try, a norwegian embassy like the (uk) one, or an american one. If you just plan on going as a tourist you should check out Thanks!

When moving to Norway there are a couple of things you should know. Hopefully this guide will help anyone who is relocating to Norway from any western country. You see, things will change.

1. You’ll need a car – since there are so few people in Norway, the public transport system either does not work or does not exist (depending on where you’re moving to). There’s no such thing as ‘the tube’ and no subway. Rumors has it they have a subway in Oslo, but it probably doesn’t work as it should nonetheless. Buses do exist in Norwegian towns, but they will not take you where you want to go when you want to go. So, you’ll need a car. This also applies even if you live in the middle of a city (e.g. Oslo).

2. Forget everything you know about cooking. Getting ingredients is very difficult, if not impossible, in Norway. The best supermarkets Norway has to offer – like Ultra and Meny – will have the basic stuff you need; potatoes, rice, sugar, some standard pasta and one type of minced meat. If you’re the kind of person who enjoys watching Jamie Oliver or BBC Food to get new ideas and recipies to use you should stop doing that after having moved to Norway. It will only make you frustrated, since you’ll not be able to get your hands on 50% of the ingredients they use. There are no such things as markets in Norway, neither meat, vegetables or fruit – you buy everything in the supermarket. Well, maybe some of the larger cities have markets around noon every other Saturnday but you shouldn’t bet on it.

So, prepare to eat a lot of frozen pizza. Unlike other countries, like e.g. Australia, where ordering pizza delivered is cheap – Norway actually has some decent frozen pizza’s. And we Norwegians eat a lot of frozen pizza. It’s not that we enjoy it so much, it’s more the lack of alternatives.

3. You’ll need a wine cellar. Getting your hands on alcohol is very difficult, since the government has a monopoly on selling it. The only shop that sells something else than beer is called “Vinmonopolet” and it’s closed most of the time. Expect it to be closed when you get home from work, so you need to plan ahead. Take a day off work to buy wine and other alcoholic beverages. Even though they are allowed to sell beer in normal grocery-stores, it’s only allowed at specific times, so they’ll probably not be allowed when you happen to be there (after work). So, buy lots of beer and store in your cellar as well.

4. Plan ahead. The “Plan ahead” strategy mentioned above, will be needed for much more than getting your alcohol in house. If you need to use the Norwegian Postal Service they will be closed when you get home from work. Also, most of the shops in the city centers also close pretty early, so they’ll be closed as well. So if you need to use any kind of public office, or buy something in a shop, you’ll need to take a day off. Just ask your boss – tell her that you need to buy wine or a new coat or post a letter or whatever – she’ll understand. Norway has very generous workers rights, so bosses usually understand.

5. Prepare for the weather. If you’re going in the summer – great! It’ll be light out most of the time (from early morning (0500) to late night (2400)). The summers in Norway are great. Except it rains a lot. If you’re going to stay during the winter you should bring anti-depressants. Or wait, you don’t have to bring them, cause anti-depressants is probably one of the few things you won’t have a problem getting your hands on in Norway as the pharmacies are open till late (some are even 24hr). The reason you’ll need anti-depressants if because it’ll always be dark. All the time. True, it’s only up in the north it’s dark all the time – but it won’t matter if you’re in the south cause it’ll be dark when you leave for work and when you get home it’ll be dark. So, if someone saw the sun from 13:00 to 13:30 that won’t affect you since you’ll be in your office then. If you haven’t taken the day off to buy alcohol that is.

You’ll still want to stay in shape even though the weater is crappy and you’re depressed. So, you should get a membership at a local gym. If you live in one of the “four cities” (Oslo, Bergen, Trondheim, Stavanger) chances are you’ll actually have a gym close to where you live. But expect to pay a lot (around $1000 a year), and the services will probably not be as good as what you’re used to. If you’re used to 24hr gyms you should try to forget all about them before moving to Norway. Some gyms close at 17:00 on Saturndays for instance. Yes, it is true.

6. Pay isn’t everything. Remember, if you’re moving to Norway for professional reasons – pay isn’t everything. Here are some simple calculas for you: deduct 40% from whatever you’re going to be paid (the government will have this). Deduct 25% from whatever you’re left with (this is the tax on everything you buy). So, it’s important that you like your job, cause you’ll spend all your money on the government. But don’t be bitter, remember they need the money to run “Vinmonopolet” and the postal service. It doesn’t matter if you won’t be able to use the services.

PS! Some of these facts might not be 100% accurate, and maybe I did use some irony here and there. And visiting Norway on vacation is probably a great idea, so if that’s the case you can ignore my rant.

Economist on open-source

This week’s issue of The Economist has an interesting article on open source called Open, but not as usual (subscription required). It’s not all positive, here are some paragraphs:

As “open-source” models move beyond software into other businesses, their limitations are becoming apparent.EVERY time internet users search on Google, shop at Amazon or trade on eBay, they rely on open-source software—products that are often built by volunteers and cost nothing to use. More than two-thirds of websites are hosted using Apache, an open-source product that trounces commercial rivals. Wikipedia, an online encyclopedia with around 2.6m entries in more than 120 languages, gets more visitors each day than the New York Times’s site, yet is created entirely by the public. There is even an open-source initiative to develop drugs to treat diseases in poor countries. (…) However, it is unclear how innovative and sustainable open source can ultimately be. The open-source method has vulnerabilities that must be overcome if it is to live up to its promise. For example, it lacks ways of ensuring quality and it is still working out better ways to handle intellectual property. (…) Its advantage is that anyone can contribute; the drawback is that sometimes just about anyone does. This leaves projects open to abuse, either by well-meaning dilettantes or intentional disrupters. Constant self-policing is required to ensure its quality.

Then they go on to tell about the whole Wikipedia story.

One reason why open source is proving so successful is because its processes are not as quirky as they may first seem. In order to succeed, open-source projects have adopted management practices similar to those of the companies they vie to outdo. The contributors are typically motivated less by altruism than by self-interest. And far from being a wide-open community, projects often contain at their heart a small close-knit group. (…) Projects that fail to cope with open source’s vulnerabilities usually fall by the wayside. Indeed, almost all of them meet this end. Of the roughly 130,000 open-source projects on, an online hub for open-source software projects, only a few hundred are active, and fewer still will ever lead to a useful product. The most important thing holding back the open-source model, apparently, is itself. (…) There are two doubts about its staying power. The first is how innovative it can remain in the long run. Indeed, open source might already have reached a self-limiting state, says Steven Weber, a political scientist at the University of California at Berkeley, and author of “The Success of Open Source” (Harvard University Press, 2004). “Linux is good at doing what other things already have done, but more cheaply—but can it do anything new? Wikipedia is an assembly of already-known knowledge,” he says. The second doubt is whether the motivation of contributors can be sustained. Companies are good at getting people to rise at dawn for a day’s dreary labour. But the benefit of open-source approaches is that they can tap into a far larger pool of resources essentially at no cost. Once the early successes are established, it is not clear that the projects can maintain their momentum, says Christian Alhert, the director of, (..)

Good stuff. As always, a subscription to The Economist is highly recommended. I enjoy the dead tree version every week :)