The Weak Reference

The Weak Reference

Kurser i Domain-Driven Design - Våren 2012

Sunday, December 30, 2007


Entertainer Of the Year
Entrepreneur Of the Year
End Of Year

Here is an unimportant selection of what I did 2007 (in no particular order):

Music I listened to

Books I read

Blogs I read

Series I watched

Software I developed

Gadgets I bought

  • iPod Classic - to replace my old 3G iPod that had given up
  • Wii - my first gaming console, ever
  • Sun Jar - to store a little of that precious sunlight for when it gets dark

Happy New Year 2008!

Friday, December 28, 2007

Free Code!

Oh, one more thing. There is FREE CODE to go with the Specifications article. Running code examples are available in the Subversion repository at Google Project Hosting. There is also a JAR-file ready to download and use as basis for your own specifications. If you hurry you can get one of the first ten JAR-files I give away (no, unfortunately they are not signed...)!

Specification Project at Google Code.

Specification Pattern as a Refactoring Tool

There was a time when this blog was about software development. Nowadays it just seems to be a lot of whining. So it is time to change that. I actually did write a post about the Specification pattern detailed in Eric Evan's book Domain-Driven Design. But formatting the code examples for this blog turned out to be more of a hassle than I could deal with; so instead you'll find it in the latest issue of PNEHM!, Citerus' newsletter on software development: Specification Pattern as a Refactoring Tool.

The Specification pattern is nothing revolutionary, but it offers a nice way of encapsulating business rule logic that tend to be sprinkled all over your average business application. It is useful as a modeling and implementation concept when building systems from scratch, but can also be a powerful refactoring tool. The article will show you how.

And while you're at it, make sure to read the other articles in this issue of PNEHM!. You'll find interviews with both Ken Schwaber and Jerry Weinberg as well as a piece on Grails (in Swedish). Some people say it's our best issue ever.

P.S. Don't miss our classes on Domain-Driven Design and Strategic Design this spring.

Monday, December 03, 2007

Domain-Driven Design classes spring 2008

I'm very happy to let you know that Eric Evans is returning to Citerus and Uppsala this spring to host a new set of Domain-Driven Design open enrollment classes.

New for 2008 is that we have extended the immersion workshop Putting the Domain Model to Work to four packed days of presentations, discussions, modeling exercises and coding! This year I will give this class together with Eric which I'm sure will be great.

Eric will also give the two-day class on Strategic Design.

New is also the venue; we will be hosting this event at the brand new Uppsala Concert and Congress Hall which I think will be excellent.

This time around we have discounted fees for early registration, so head over to Citerus now to sign up:

Wednesday, November 28, 2007

sventon 1.3 now available for download

Release 1.3 of your favourite Subversion web client is now available for download!

Read more and download at!

Thursday, August 30, 2007

The Customer Service Paradox

You could say that I am somewhat sensitive in the customer service experiences department. I don't think I demand too much, I just expect things to work and for any problem that may occur to be handled responsibly in a timely fashion. Although rare, sometimes that actually happens.

I ordered a few things from the Apple Store the other day. The actual buying experience was as dreadful as always, but fulfillment was fast and I was to expect my order to be delivered by UPS a few days later. I usually try to stay away from receiving shipments to my residential home address. The delivery truck typically shows up when you're not at home, and it is a pain to later try to track down the forwarder to get your stuff. But since I was at home on vacation anyway, I made an exception this time.

Carefully tracking the shipment on the UPS web site I suddenly noticed that the delivery was in an exception state; UPS had failed to find my delivery address. This was around five in the afternoon. So I looked up the UPS contact info on the site and gave them a call. Pretty much immediately a human picks up the phone and inquires how he can be of service. No waiting in a long phone queue, no ten-levels deep interactive phone menu of "press one for great deals on shipping", "enter tracking number followed by pound", "enter phone number", and definitely no embarrassingly worthless natural language voice recognition crap that never works and makes you feel like you're a total moron with no communication skills whatsoever. None of that. Just a friendly voice. A friendly voice that asked a couple of questions and promised to contact someone who could help me get the shipment back on track. "If you haven’t heard anything within one hour call us back, we're here until 8 p.m.”

After about ten minutes another person from UPS called and informed me that the driver, a bit embarrassed, had admitted that he had failed to find my house. She asked for directions and told me to expect the shipment to arrive soon. After another twenty minutes or so the UPS man arrived and delivered my packages.

They had me by the human answering the phone. This is what great service looks like. You make it easy to report issues, and when informed about a problem you take responsibility, you own the problem, until it is resolved. You promise to call back, and you call back. You promise to deliver something, and you do deliver. In theory this is very easy. In practice, apparently surprisingly hard.

Great customer service story, eh? Except it really isn't. After all, this is UPS, you'd expect them to be able to read a map. Or if not, they could at least try to call the receiver to get directions, it is a listed number. They really should have been able to deliver the package without any of this. Had they done that everything would have been OK. The service would have worked, I'd have my stuff and think nothing more about it. But now, after this, I sit here writing a blog entry praising UPS.

And herein lies the paradox. A quick and effortless resolution of a problem is actually better received and remembered than a problem that doesn't occur in the first place.

Never underestimate the power of great customer support and outstanding exception handling.

This and more great drawings from

Friday, June 29, 2007

The Patch Game

One problem with gadgets of today is that they seem to need constant patching. Barely a day passes without some automatic update service is telling me to download and apply a patch. Sometimes the patch provides new functionality, but most of the time it simply tries to fix functionality that were there from the start but isn't working properly. With more and more things shipping with small embedded computers this is starting to become quite the time-sink. It's also annoying. And it feels like it is only getting worse.

I'm really tired of patching my cell phone, the iPod, the other iPod, the digital camera, the GPS, the cell phone again, the computer, the Wii; even the damn car needs software updates! Why is it so hard to ship stuff with software that is actually working? Has technology grown too complex? Are products rushed to the market to beat the competition and the software development process isn't coping? Are product developers getting sloppy since they know they can fix most things very late in the product life-cycle? What is the problem here?

Monday, June 18, 2007

Enjoying an Ingenious Life

As it turns out, my friend, and Citerus consultant, Rickard Johansson has stopped boiling frogs, and started to enjoy an ingenious life.

Not a bad choice I'd say.

Wednesday, June 06, 2007

Fulhack Annotation 1.0

Introducing Fulhack Annotation 1.0 for Java - finally you can come clean with your fulhacks!

Download the Fulhack Annotation jar and drop it on your classpath. You can now annotate your fulhacks like this:

@Fulhack(blameDeveloper = "patrik",
badExcuse =
"Didn't have time to make it nice",
hack =
"Perhaps use same solution as for Cat, it looks OK.")
public void setBrownColor() {
color =

Using the Annotation Processing Tool (apt) shipping with Java 5, you can then create reports of your fulhacks by running:

apt -cp fulhack-1.0.0.jar <path-to-source-code>/*.java

Fulhack is licensed under the Apache License, Version 2.0.



Thursday, May 31, 2007

Laziness is not a virtue of a programmer

In the late 1980:s Larry Wall stated that one of the three virtues of a programmer is laziness (the other two being impatience and hubris). With that in mind he created Perl, or possibly the order of the two events were the other way around.

After about 10 years of doing software development commercially I would like to argue that laziness is not a virtue of a programmer. My intention here is not to dis Larry based on a line taken out of context. Larry is after all much of a hero to an entire generation of system administrators and programmers. Perl also came to drive many of the first attempts at e-commerce and interactive web application, making a large contribution to the development of the web as we know it today. So, with that in mind, it is apparent that laziness can help you go places. But being lazy can also get you into all sorts of trouble.

Laziness may not be a virtue, but it sure seems to be an integral part of human behavior. I have to fight my own laziness everyday. When you have a task to complete it is often very tempting to do a fulhack* here, add an extra if-statement there, and hardcode some piece of information over in that end, i.e. do things that you know are wrong, but are very appealing for some reason. The right thing to do in these situations is typically something along the lines of rewriting a few more lines of code, extract a method, move a scattered responsibility to the class where it really belongs, etc.

The shortcuts are quick wins; you fix a problem momentarily and you can move on to other tasks. But as these quick wins starts to accumulate, it becomes even harder to stay away from them: "The code is ugly anyway, another one of these won't really matter now, will it?" This is the Broken window theory in action. And soon, your code is full of ugly hacks. Hacks that make the code hard to read, hard to understand and hard to maintain. Hacks that increase the entropy, or Technical Debt. All these things lead to a system that is more difficult and expensive to maintain. A system that is hard to change and extend with new functionality. A system that smells and no-one wants to work on.

So just stop being lazy. Pair-programming is a great tool to help you out here. It is much harder to write intentionally ugly code when someone is looking over you shoulder (or even stealing the keyboard).

Tim Ottinger has written an interesting piece on code as a liability.

Larry Wall on the virtues of community: Diligence, Patience, and Humility

*a 'fulhack' is a Swedish term for an ugly piece of code that you know is bad. But despite this you write it and leave it in the system you are working on, usually because you're too lazy to do it the nice way. A fulhack is typically annotated with some sort of code comment where the author clearly states that it is a fulhack, admits guilt and that way tries to escape responsibility. Which of course doesn't work...

Monday, April 02, 2007

Till Hell Freezes Over

I actually didn't think we would see this one this soon. It is, of course, the logical step to take but I really did think that the record industry would rather go bankrupt proudly singing the DRM tune before something like this happened. But today Apple and EMI announced "Higher Quality DRM-Free Music" on iTunes.

No, seriously. It appears to be true.

I will stop myself from ranting along about the true evils of DRM, the anti-customer business model of big conservative record companies, how they deserve a punishment and how they have completely frozen in a business model so dated that it isn't even funny. I don't mind paying for music, but the attitude the recording industry shows their paying customers makes me sick.

Sure, I would like to have seen a truly lossless encoding and a price decrease. But I guess you can't have it all.

Anyway, interesting move, now let's see what happens.

Saturday, March 17, 2007

Quality Money Can’t Buy

We needed a user forum for the sventon project, so we went looking for suitable software to implement this. We found phpBB that looked like a nice fit for the environment our hosting service is offering. I decided to try it out and downloaded the distribution. I discovered a beautiful piece of software, at least on the outside. I have not looked at the code, but my experience tells me that the outside and the inside tend to go together (at least when it comes to software, I’m not sure the same can be said about humans). The installation was a breeze: Upload the files to the server, point your browser to the installation page, enter a few configuration parameters and you’re pretty much done. No messing around with database schemas and SQL create scripts, no searching for configuration files in weird places and trying to figure out what needs to be changed, no nothing. For security reason the application won’t even start until you have deleted the configuration and installation directories, everything to minimize the possible ways to mess up.

This is ease of use money can’t buy. Have you ever tried to install an Oracle product you know what I mean: After wading through oceans of OLAF wizard screens, only to get harshly interrupted by a Java stack trace, you end up with an half baked install, and Java 1.1.8 as the system default runtime. Yuck.

My guess is that phpBB grew so popular that the ease of use had to be top-notch for the developers not to drown in support requests (but then again, I have never used phpBB before, the installation procedure may have been this good since day one, and that is the reason for its popularity). Oracle and their colleagues in the closed source arena, on the other hand, really don’t mind taking support calls from frustrated users; on the contrary, it’s a core part of their business.

I know, this hypothesis doesn’t really scale well. Many, perhaps most, open-source projects are a pain to install (trying to install Linux on an AST laptop in 1997 was an experience I’d rather not go through again), but the really successful ones are easy to use, easy to install and well documented, including frameworks such as Hibernate and Spring as well as Linux of year 2007. And of course, there are commercial offerings that are great as well, Orion server comes to mind; unzip the download and the install is completed. Nice.

Regarding the sventon user forum, we finally settled on something even easier: Google Groups.

Conclusion: I don’t know. Whatever. Go code something.

Friday, January 19, 2007

More Domain-Driven Design

Eric Evans returns to Citerus spring 2007 for more open enrollment classes in Domain-Driven Design.

Last time Eric was here in the fall he gave the class "Putting the Domain Model to Work, 3-Day Immersion Workshop". The workshop was very well received by the participants and sold out weeks in advance. I got many questions on whether we would run the class again, and I am now happy to announce that Eric will come back to Citerus in March. Eric and I will host not only the workshop we did last time but also a new two-day workshop on "Strategic Design" targeted at architects and development managers.

Seats are limited, reserve yours by registering today!

Thursday, January 11, 2007

Simple and Powerful

I have the greatest admiration for designs that truly succeed in combining ease of use with power. This is extremely hard, and very few organizations and designers have succeeded. Some products and services start out good but fail to keep stuff simple as the feature set grows, but most just suck from the start.

If you are old enough you may remember the AltaVista search engine. It was launched by Digital (later Compaq, now HP) as a project much to prove the superiority of the Alpha processors. It indexed more web pages than anyone before, it returned search result faster than anyone before, and it had a pretty good, simple design: A one-row search field, and a Submit button. Sound familiar? It didn't even have a domain name of its own at the time since was already taken, but in spite of this AltaVista became the de facto standard for searching the web. Results ranking and speed could be improved, as we would later learn, but at the time it was pretty much the best search engine on the Internet.

But one day the age of the Internet portals arrived. Everything had to be a portal. Including AltaVista. Unfortunately the search functionality drowned in a sea of portal junk. This portal move really is ironic; with a really good search engine, why would you need a portal page with edited content?. The previously clean first page became so cluttered that you almost had to search the page to find the search functionality. Good thing Google came along to help you with that. AltaVista lost, both due to inferior interface design and inferior technology.

An other example. The iPod. Not particularly original as an example, I know, but this is for a reason. Apple designed the iPod as a music player, nothing else. They provided it with a simple to use piece of software to rip, organize and play music, as well as to transfer it to the iPod. They also gave it a very attractive design, being small, stylish and easy to use. The iPod really only did one thing, it played music. But did it really well. Every time a gadget blog or an online magazine writes about a new iPod model there inevitably has to be someone complaining loudly in the comments section of the article that the iPod sucks; it doesn't have a radio, the only supported way of transferring music to it is using iTunes, the battery performance is poor, it has no recording function, etc. But for the absolute majority, including myself, these things do not matter. We prefer the ease of use, the great sound quality, the small form factor. We rather not sacrifice the user experience the iPod provides for more features, as a matter of fact we are even prepared to pay a little extra for not having them. In this case less really is more. Sales figure speak on their own. There really isn't much of a competition. Yeah, sure, clever marketing didn't hurt either.

When a new iPod generation is released, the battery life is typically barely improved, instead the product is made smaller. Someone made a conscious design decision here: Battery life is good enough, size, however, is more important. Slowly new features are making it into the product line, first photos, later movies and games. But perhaps this isn't good enough in the long run. Perhaps the iPod users really want to consolidate their gadget collection, giving them less stuff to carry around? I sure do. This is nothing that escaped Apple, hence the iPhone. One would think that Apple is out on deep waters here, when they now enter a new market. Fortunately for Apple, there isn't much of a competition.

The Sony Ericsson p990i is the latest flag ship smartphone from Sony Ericsson. It is everything the iPod isn't. Sony Ericsson's design team has crammed pretty much every technology they could find into the p990i. It has support for GSM, WCDMA, WLAN, Bluetooth, an FM radio, USB, two cameras, and MemoryStick. It has a pen-based user interface and features software out of the box to make phone calls, send and receive SMS, MMS, and e-mails, synch with Exchange servers, read and write Office documents, read PDF files, play music and movies, surf the web, read RSS-feeds, a business card scanner(!), an alarm clock, and of course organizer tools such as calendars, contacts management, and tasks. And the list goes on. Looks good on paper huh? Too bad it sucks. It is badly designed, badly built and the software wasn't even half baked when the phone was released. The support documents even instructs you to reboot the phone (which takes 90 seconds by the way!) every now and then as a maintenance routine. And would you forget, the phone will do it automatically for you. When you least want it. We have suddenly moved more than 10 years back in time to the era of Windows 95 and pre OS X! Seriously, it is so bad it isn't even funny.

To add to it all, the arrogance shown by Sony Ericsson towards their customers that paid a premium price for this product is just sad. It shows every sign of a company that is immature in its customer relations and that has failed to embrace new CRM ideas and technologies that have emerged during the last few years. Things such as blogging and direct end user interaction. But that could be a good topic for a later post.

If the iPhone is even half as good as it looks, and if there is any justice in the world, Sony Ericsson will be in deep trouble over their smartphone product line.

Well designed products must be simple yet powerful for the novice user, but it must also prove effective with the experienced user. That's why the Wizard style of user interface programming doesn't work that great for everyday tasks. Consider the Google GUI as a wizard:

Step 1: Select what you are searching for 'a', a web page, 'b' an image 'c', a PDF document. [Next->]
Step 2: Enter a search string, then select 'Submit'. [Next->]
Step 3: The search string is presented to you, if it is correct, select 'Continue'. [Next->]
Step 4: Chose 'a' if you would like to show the first ten results for this search string, or 'b' to immediately go to the highest ranked item based on your search result. [Search]
Step 5: Show result.

This is not something that would be used that often... Come to think about it, it is not far from this: Award for the Silliest User Interface: Windows Search.

The AltaVista example shows us a design that started out good, but, as features were added, started to fall apart. So how do you expand the feature set without ruining ease of use and the user experience? Very carefully. This is what Apple has done with the iPod, this is what Google has done with its search engine.

Google has done a decent job with the search engine. Adding a few tabs for images etc is OK, the search is still the centerpiece, easy to use and extremely fast. Adding the 'Personalized Home' feature made me a bit worried, but it is still OK since you have the default option of not using it. Although, it did also add a bit of unnecessary clutter to the page. AltaVista, on the other hand, failed completely and eventually reverted their design to what it is today.

Carefully consider if a feature is worth adding, and how it fits with what is already there. Perhaps skipping a new feature is the best choice. I believe these are often the really hard choices to make.

I am not a designer. I believe I am pretty good at telling when a user experience works, unfortunately that doesn't mean I can design one from scratch. But it doesn't mean I wont try either. Read about how we try to apply these ideas when we develop sventon in part II.

"Perfection is achieved, not when there is nothing left to add, but when there is nothing left to remove."
-- Antoine de Saint-Exupéry

Saturday, January 06, 2007

The Year of 2006 in Music

When a year ends and a new one begins we're swamped with summaries and retrospectives of the old year. So, adding to that, these are a few albums that were released 2006 and I think deserves mentioning.

This really doesn't have anything directly to do with developing software, so it is a good candidate for trying out the label functionality of the new Blogger platform. I have really no idea how this work, but I'll label the post 'music', and we'll see what (if anything) happens. Oh, exciting!

Really good stuff (buy now):
Anna Ternheim - Separation Road
The Knife - Silent Shout
Peter Bjorn and John - Writer's Block

Good albums that didn't quite reach the level of previous releases (buy as soon as you have bought all the albums above):
KOOP - Koop Islands, good, but not as good as Waltz for Koop
Dub Sweden - Done With Loveless Days, good, but not as good as Welcome to Our World

2006 turned out to be a good year for Swedish music!

This year I look forward to new music from Timbuktu when OberoendeFramkallande is released February 21.