Apr 21 2009

My first experience with Domain Driven Design.

Category: DDDfossmo @ 17:33

image These last months I have been learning Domain Driven Design. It’s often shorted to DDD. I have had plans to start looking into DDD for a while, but other things have always gotten in the way. I’m working as a consultant and some months ago I was assigned to a new customer, and they wanted to use DDD in their new project. Lucky for me :-)  Now I got the change to look into this DDD stuff and I must say that it will influence how I design my applications in the future.
I find this subject extremely exiting, so I have decided to write some posts about it. Some of the subjects I will cover is Ubiquitous language, Domain Model, Entities, Value objects, Services, Aggregates, Repositories, Factories, Bounded context to list some.

How to get started

I started out my DDD journey by reading some books:

Domain-Driven Design: Tackling Complexity in the Heart of Software. This book is written by Erik Evans. It’s considered the bible of DDD. I have heard people referring to it as “Lord of the rings” for developers because it uses so many references to references to references. You know; Legolas was the son of Thranduil, King of the Woodland Realm of Northern Mirkwood, son of … you get the picture? 
I use this book more as a reference, and I haven’t read it from page to page, but I have read a book which is a summary of Evans book; Domain Driven Design Quickly. It’s a good book and only a bit over 100 pages. It’s free and can be downloaded from InfoQ.

The book to blame for me learning DDD is written by Jimmy Nilssons and is called Applying Domain-Driven Design and Patterns: With Examples in C# and .NET. It’s a great book which is easy to read and he uses a lot of examples to explain the concepts in DDD. Nilsson uses TDD through the hole book to explain what DDD is. This makes it very easy from the reader to follow.

The last book I have looked into is a book written by Tim McCharty. It’s called .NET Domain-Driven Design with C#: Problem - Design - Solution (Programmer to Programmer). This book contains a lot of code. The code can be found at Codeplex. I got some hint on how to implement some of the patterns that DDD fronts from this book.

I you find videos and podcasts more easy to learn from, I can recommend listening to Alt.NET podcast show about DDD. Scott Hanselman also have a interview with Rob Conery where the topic is DDD. The last podcast I will recommend is one from Deep fried bytes. This is a conversation with David Laribee. 

If you want more links, you should go to this site. This guy have gathered some links to different DDD sources. You can also check my delicious bookmarks for updates to links.

Ubiquitous language and domain model

The first thing that pops into my mind when someone ask me about DDD is the domain model. That’s kind of obvious because we are talking about Domain Driven Design. DDD recommends that you start out by creating a domain model before you focus on anything else. Many developers would start out by focusing on the database when they create a application. This is not recommended by DDD. The reason for this is that you want to capture the domain in a model that the business person can understand. I’m referring to business person and domain expert in this post and I’m actually talking about the same person. The business person and domain expert is often the same person or at least, the business person is the product owner and should understand the domain model. You should sit down with the domain expert and try to create a shared language; the ubiquitous language. The reason for this is that you want a language that the business person and the developer understands. By doing this you will avoid many misunderstandings. What we did when starting to figure out the domain for the customer, was to get the domain experts to write down important concepts from the business we where trying to capture. We focused on using the same terms. They didn’t, for example, use the term order, but they used sale, so we called it sale in our domain model although it looked more like an order to me.  When we had talked about the terms and how the different parts of the application should fit together, we started to mold the domain. We also created some simple sketches of parts of the domain.

The nice thing with the domain model, from a developers perspective, is that the model is the code. You don’t try to model the domain with a strange notation or tool. The code is the model. The reason we can use the code as the model, is the ubiquitous language. You are capturing requirements in terms the domain experts understands. If the domain expert is a developer, this is even simpler.

I’ll try to keep these posts short and focus at one thing at a time, so I guess this is time to end this post. Next time I will explain what a entity and a value object is.

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Apr 21 2009

Speaking at Smidig utvikling 2009 Trondheim

Category: Speaker | Scrum | Presentation | DNDfossmo @ 14:23

image In the beginning of May I’m going to speak at a agile seminar in Trondheim. The topic for my talk is called “Electronic storyboards are pacifying!” and is based on a blog post I wrote some months ago. The seminar are arranged by Dataforeningen and XPmeetup. I’m looking forward to presenting my topic and the seminar.

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Apr 13 2009

Ten steps on how to store Git repositories in Live Mesh!

Category: Software | source controlfossmo @ 17:30

I probably don’t need to tell you that you shouldn’t code without having a source control system. In some of my later projects I have used Git to handle my source control. What is great about Git is that it’s a distributed version control system, but it’s also a centralized version control system.

You can use github.com or another service to host your git repositories, but you only get 300 MB if you choose the free account. If you want more space, you have to pay for it. If you are like me you probably have more than 300 MB of source code. So, what are your choices if you don’t want to pay for hosting?

One solution can be to to use Live Mesh to host your repositories. It gives you over 5 GB of space and it’s completely free. If this sounds cool, keep reading on.

I have created 10 steps on how to use Live Mesh as a centralized repository for Git:

1)
First I download Git for Windows from Google Code. The URL is http://code.google.com/p/msysgit/
The version I’m running is Git 1.6.2.2

2)
Then I install the software. I use the default settings (next, next, next)

3)
The next step is to create a Live Mesh account (you can, of course, use your old account).  The URL is http://www.mesh.com
I follow the steps on the webpage and finally install the software.  image

 

4)
Then I create a folder called Git on my Live Desktop.

image 

And the folder shows up on my local desktop.

image

5)
Then it’s time to create a local repository. My project is called Time Tracker. I navigate to the folder I want to add to Git and right-click on the folder and chooses Git GUI Here. A dialog pops up and I choose Create New Repository

 image

Git GUI shows up on the screen.

image

As you can see from the screenshot, files I don’t want in my repository are shown (like files generated by ReSharper). I need to remove them and this is what I will do in the next step of this guide.

6)
In the folder where I keep my code, a directory called .git shows up. I navigate into that folder and further into the info folder. Then I open the file called exclude in my favorite text editor.
In this file I can add files and folders I don’t want in my repository. The file looks like this:

image

7)
Then it’s time to add the project to my local git repository. This time I’m going to use the command prompt. I right-click on the Time Tracker project folder and choose ‘Git Bash Here’ and write: ‘git add .’.

The explanation of this command, cut from the help file, is:

“This command adds the current content of new or modified files to the index, thus staging that content for inclusion in the next commit.”

8)
The next step is to commit the files to the repository. That is done like this: ‘git commit –m “The first commit” ’
Ok, so now I have the files in my local repository. It’s time to add them to Live Mesh.

9)
At the command prompt I write git clone --bare . C:/Users/<user>/Desktop/Git/TimeTracker (I’m using Windows Vista).
The –bare keyword I use in the clone command means that I want to create a directory that contains the contents of the .git directory and not the actual workspace.

10)
Now I can work on my local repository and when I want to update the repository in Live Mesh I can simply use this command:
git push C:/Users/<user>/Desktop/Git/TimeTracker master

Changes done in the local repository are now reflected to Live Mesh and I can work on the project on an other computer (as long as Live Mesh and Git are installed) or share the mesh folder with other project members.

Hope you enjoyed this walkthrough of how to use Git with Live Mesh!

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Apr 1 2009

Visual C# MVP 2009!

Category: fossmo @ 11:41

image This is insane. I got a MVP award in Visual C#. I must say I feel a bit humble when I browse through the list of other Visual C# MVP awardees. Names like Roy Osherove, Jeremy Miller, Oren Eini and Derik Whittaker, to mention some of them, come up.

If everything goes according to the plan I’m going to talk at the NNUG meeting in Trondheim in May. I guess the reason for me getting this award is because I have been active in the local community for some years. I’m going to continue to be active in the years to come.

Thank you, Microsoft!

EDIT: I forgot to mention that my friend and colleague Joar also got a MVP award today. He got the award in the category Connected System Developer. Congratulations, Joar, you really deserve this award.

Tags:

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5