Alexander Beletsky's development blog

My profession is engineering

NDC2010 conference videos available on torrent

Huge amount of priceless information is not available on legal torrent server. It is a video from this year NDC2010.htm. Just check out a list of speakers, so you could imagine how interesting in should be.

Just a top from a list:

  • .NET Design Patterns for Agile Software Processes 16 Ju.mp4
  • 5 reasons why projects using DDD fail 17 Jun 10 440 PM.mp4
  • A Style of Programming 16 Jun 10 917 AM.mp4
  • Advanced Debugging with Visual Studio 17 Jun 10 1017 AM.mp4
  • Advanced Tips & Tricks for ASP.NET MVC 2 17 Jun 10 157 .mp4
  • Advanced Topics in Agile Planning 18 Jun 10 1240 PM.mp4
  • Agile Estimating 18 Jun 10 1038 AM.mp4
  • Agile Release Strategy 18 Jun 10 1237 PM.mp4
  • Architecting for the .NET Event Model 17 Jun 10 525 PM.mp4
  • Architecture of the Client Tier for WPF & Silverlight 1.mp4
  • ASP.NET MVC vs Ruby on Rails - The .NET Rocks Smackdown.mp4
and many more…

So, run your torrent clients and start to download. Torrent file is here.

GitHub Social coding

Programming has changed a lot thought last years, for sure. Solving a problem is no longer now, like sitting with a bunch of books or opened MSDN help and Visual Studio, trying a different approaches. It has began with specialized forums where developers shared the problems they met and expecting other developers to help them out. It worked. Maybe because of developers like to help someone by means of computer stuff, even if they could not talk to the person sitting next table. After, developers started to create personal blogs where written a problems and solutions they met every day. Google search helped a lot to get information from blogs.. and to make this information be helpful. So now, a term “solving a problem” turns to “googling a problem” and it is very likely that someone with blog, or someone in forum or group has already solved something similar. I hardly could image development now without google.. really.

Web 2.0 bring a new type of communication and collaboration people in internet - social networks. Social networks might be a kind of evolution from forums and groups, but participants of social network has more personality in it (with a rich profile, photos and bio, ratings and so on) and a community around yourself (friends, colleagues, groups etc). If you friend of someone, you are tracking someone’s activities.. as current status, shared links, new audio or video clips and so on. Social network is so popular now, so I can bet that there no person who uses internet more than several month, who do not have an account in any social network.

Have you ever hear a term “social coding”? If you try to google it you definitely be pointed to http://github.com. GitHub is a social network, for developers. What developers need from social network? They need the same profiles as in common social network, with information, link to blogs etc, but developer is someone who supposed to produce a code and GitHub makes it possible to submit your code, so other people could see it and comment. GitHub is based on Git source control system. It has a lot of differences with more widely used Subversion and I would say Git is more complex and mature than Subversion. You have to spent some effort to switch your mind from Subversion to Git, but it not really hard to do.

Within your account you are creating a Repositories. You can have as many open repositories as you like, and you can submit any code you want. Repositories are main artifacts of network. In a Repository it is not only the source files you can store, but also it provides you with issue tracking system, binary storage for builds, wiki pages. That mean that GitHub could be also treated like a open source project management/development site like a Code from Google or Codeplex from Microsoft or old good Sourceforge.

Like any other networks it gives you ability to follow and be followed by other participants. Following means you are start to track all persons actions in GitHub, like creation of new repositories, commits, forks, code commentaries. You can also watch some particular Repository of someone, so you will track all changes that happens in repository. If you find something interesting and want to participate you can do a fork of repository (analog of branch in svn) commit to you fork and do a pull request to author, so he can review what you did and merge changed to master branch. Of all that is done nicely in GitHub, with a intuitive dashboard and tools.

GitHub is implemented in Ruby on Rails in very popular in Ruby community. It currently hosts Rails, and lot of other Ruby project. Also, you will find Linux-2.6 kernel sources of git itself.. and jQuery and many many more.

GitHub really bring something new into open source development world.

How I use GitHub? Ok, first of all - my blog articles are there. I have a special repository to store html, so I commit drafts and as soon as I’m ready I put html to my blogspot. All code examples and projects I show in my blog is also in GitHub, so if you would like to check the code you are just following the link I give in post and do that. I’m educating myself in ASP.net/C#/MVC/JavaScript and so on, so now I also put my tests project there.. so they are accessible in any machine with Git. I follow several persons to see what they are doing. My network is tiny yet.. but let’s see how it goes!

If you liked idea’s of GitHub, please create your account and let’s join.

See you on network!

Bookmark and Share

MSDTC on server is not available exception

During implementation of Linq to SQL of Entities application you can see such exception:

System.Data.SqlClient.SqlException : MSDTC on server ‘SRV\5118CF33-D353-46’ is unavailable.

Generally it means that there are several transactions is being created in application and they have to be managed by a special service, called “Distributed Transactions Coordinator” that is by default is not started. So, the quickest solution is just to start the service manually. Go to Start -> Control Panel -> Administrative Tools -> Services and start “Distributed Transactions Coordinator”. If it is required by your configuration you can set it as “Automatic” startup type, to run at as your server up.

But please be sure what you are doing, because this exception could also show some issues in application. As soon as it is appeared after some code changes, you have to clearly understand that involvement of Distributed Coordinator is expected behaviour.

What happened to me with my Linq to SQL application is following: there are two classes that create instance of DataModel class, first one is DbSetup that responsible for some preparation of data for tests, second is Repository object. DbSetup was also opening a TransactionScope object, to rollback all data that is being created during tests. This what created a problem - as soon as TransactionScope opened in scope of DataModel within DbSetup class, DataModel created in Repository was treated by runtime as a part of another transaction. That’s why runtime starting to request “Distributed Transactions Coordinator” to manage transactions. So, in unit test code I changed the constructor of Repository to accept DataModel created in DbSetup as constructor argument, so only one “transacted” DataModel object used in application. That solved my problem, without starting up coordinator.

Interesting from my Reader this week

My weekly update is what is going on in my Reader:

Bookmark and Share

Using of Mutation Testing in real project

TDD

Recently I’ve been shared with a very interesting article by Jeremy Jarrel about a mutating testing. I was really exited about that cause I really like different techniques and approaches that could help to gather better level of code quality (and tests quality). I would like to share my experience of first try it on project I’m working on now.

What Mutating testing is all about?

The idea is fairly simple. As soon as you have a code that is being tested by a series of unit tests and all of these unit tests are currently in green state, you are able to validate how good your unit tests are, by changing a tested code a bit a see the results. This “changing” procedure is actually called - mutation. In ideal case all green tests have to be turned red, if some of tests are still green that means that testing code is not good enough to react on mutation, so actual test code must be reviewed and corrected. This is something that is called - mutation testing analysis.

The project to try on

I’m currently working on project that has been developed for some time, but with no tests. So a lot of legacy code has to be supported. We started to do tests where and thought about 4 months created nearly 300 tests. It is good time to try mutation on those cases. I’ve assured once more that all tests are good and no failures at this moment. Let’s go!

MutantPower application

In the article that I referenced above Jeremy not only gave a theoretical aspects but also provided with a simple mutation tool, called MutantPower. This is also what I’m going to use throught. So, I’ve downloaded sources and reviewed them. Code is a really simple, uses Mono Cecil framework to load assembly, get all instructions and change instruction Brtrue_S to Brfalse_S, and otherwise. So, I’ve built application and was ready to start experimenting.

First failure

I have a one big assembly with a tested code, so what I need to do is to mutate this assembly and re-run all tests to see results. But on a first run of MutantPower I got a NullReferenceException. I’ve checked out in debugger and the problem was that MutualPower use the Body of MethodDefinition object, but not always methodDefinition contains a Body, so check for null is missing. After some corrections it started to work and I could successfully instrument the assembly.

Re-signing of tested assembly

I’ve successfully mutate my assembly and tried to re-run unit tests. It failed at the very beginning, since it was a strong named, run time detects failure of digital signature and refuses to load library. It has to be resigned each time after mutating. It could be easily done by sn.exe tool.

sn.exe -R tested_assembly.dll C:\Work\rd\Testing\TestApplication\bin\Debug\Company.snk

* This source code was highlighted with Source Code Highlighter.

First unit tests results

After resigning assembly successfully loaded and unit tests started. Some tests were passing and a lot of tests were failing (that is have to be during mutation testing). I was quite happy to see first results. But with mutation you have to be really careful and understand real reason of failures. I found out that most of tests failed with NullReferenceException somewhere from deep parts tested assembly. After a bit of investigation I found out that one of the vital application classes could be instantiated. Sure, MutualPower does not distinguish between “code need to be tested” and “infrastructure code” that makes application able to run at all. So these first results had no sense at all, since the testing not even started.

Configuration for MutualPower

I came up with one simple idea. Extend MutualPower with a configuration file that would say what exact types must be included for mutating to leave infrastructure code as is but affect the rest of code (BLL, DAL, pages etc.). So, I’ve changed the application to take such configuration into account. After inspection of all test cases created so far I came up with such configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<types>
 <!-- ASP.net pages types -->
 <type included="ard_ardrequest"/>
 <type included="ard_periods"/>
 <type included="ard_closingsheet"/>
 <type included="ard_copyfinancecodes"/>
 <!-- DAL types -->
 <type included="Company.src.AnnualReport.DAL.ArdCompanyData"/>
 <type included="Company.src.AnnualReport.DAL.ArdDepartmentData"/>
 <type included="Company.src.AnnualReport.DAL.ArdPeriodData"/>
 <type included="Company.src.AnnualReport.DAL.ArdPeriodData.ArdRequestData"/>
 <type included="Company.src.AnnualReport.DAL.ArdPeriodData.ClosingSheetData"/>
 <type included="Company.src.AnnualReport.DAL.ArdPeriodData.CopyFinanceCodesData"/>
 <type included="Company.src.AnnualReport.DAL.ArdPeriodData.PeriodsData"/>
 <!-- BLL types -->
 <type included="Company.Ard"/>
 <type included="Company.ArdCacheClosingSheetData"/>
 <type included="Company.ArdUpdateBalance"/>
 <!-- Forms and control types -->
 <type included="Company.ArdReportTemplate"/>
 <type included="Company.EditTypes.ReportDesignerTemplateTypes"/>
 <type included="Company.EditTypes.TemplateGroupField"/>
 <type included="Company.FormArdCompanyReport"/>
 <type included="Company.FormArdTemplateCopy"/>
 <type included="Company.FormArdTemplate"/>
 <type included="Company.FormCompanies"/>
 <type included="Company.FormCompanyGroup"/>
</types>


* This source code was highlighted with Source Code Highlighter.

Now MutualPower will change only types mentioned in configuration file as “included”.

Next run and Timeout exception

After re-mutating and re-signing assembly again I got first more or less meaningful results. Yes, a lot of failures and even more.. my tested hanged out in a middle! This is something that is never have to be happen as soon as you do good unit tests.

System.InvalidOperationException : Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

* This source code was highlighted with Source Code Highlighter.

Skipping the details, I found that there is a huge bug in my testing framework that doesn’t dispose connection to database in case of exception in constructor, so then you have a lot of failures the connection pool is quickly overused and you got TimeOut. Bingo. That might be first valuable result from mutating. Of cause, it is not a but in some production code, but keeping testing code in good shape is also very important. So I fixed the problem and ready to go for next iteration.

Analysis of passed

Finally, I’ve got some results for analysis. Only 27 tests are passing, so all of them should be reviewed for actual reason.

I'll do high-level breakdown of "why tests passed"..

  • Tests from a 3rd parties - we are using HttpSimulator and with a sources, test cases was also included to project. Since we are not modifying and it just works as expected, no need to keep it in test assembly. Should be removed.
  • Tests on code that has not been mutated - tests are passing because you forget to include tested class into MutantPowerConfiguration. Should correct configuration and run again.
  • Empty test cases - test that have no asserts in it. These are not the tests, so it might be either refactored to do asserts either removed at all.
  • Smoke test - the type of test I just to prefer start development with, it just creates a tested object and expects that no failures happened.

That’s it! Nothing that could show a dumb mistakes either in code or tests that I really wanted to archive. So, I’ve cleaned up tests a bit and came up with only 8 passing ones.

Analysis of failed

So, why tests are failing? 99.9% of all failures came from DAL level with a ArgumentOutOfRangeException exception. Meaning that MutantPower changed the assembly so badly that no data could be even retrieved. If no data retrieved -> logic does not start to work -> tests are failed. That turns out to something not mutation, but breaking. MutualPower in its initial version is to simple and for sure required more fine tuning except configuration file. Another aspect related to our architectural/design problem. Currently code of business logic is high cohesion of data access layer, namely all testing is goes on SQL database with no mocks. So, since the lowest layer is corrupted all upper layers just could not stay alive. OK, this conclusion might be a second valuable result gave by mutation.

In ideal case all tests my be clearly separated on BLL tests, DAL tests. It has no much sense to mutate DAL code, as for me. BLL tests must use mocks, so be completely independent on database, database testing should be part of integration testing. By doing this it might happen that mutation give a valuable feedback.

So, just initial analysis of failures showed architectural drawbacks of application that must be some how corrected to get more benefits of mutating testing.

Conclusion

  1. Mutation testing is definitely something interesting but requires an effort to get benefits from it.
  2. It would give more meaningful results if application is created with a good separation of layers and usage a mocks in unit tests.
  3. It helped out to see behavior of tests in more stressed conditions and find a recourse leakage in tests.
  4. Some areas for improvements exists to update MutantPower with fine tuning.
  5. It is not seems to be daily based practice, but more likely once for iteration of two. Also thinking about criteria related to tests number like, as soon as next 100 tests added, run mutation testing to check quality.

Finally I’ve put sources and binaries on github.

Source code - http://github.com/alexbeletsky/MutantPower
MutantPower application - http://github.com/alexbeletsky/MutantPower/downloads

Spell checker for VS2010

I’ve noticed that I do a lot of spell mistakes in my posts, so I started to think about some online tools that would do spell checking before submit post to blog. There are several good enough, but the problem is that they work with a plain text, but I do posts in HTML first.. so checker was giving a lot of mistakes on HTML tags, that is pretty annoying.

As I do my posts in VS initially I started to look for some pluggins that would do spell checking just within Visual Studio, so you don’t need any other tools. I came up with very nice one, so I want to share it with you:

Checker for VS 2010 by Noah Richards

Easy to install and use.. Spell checking for HTML/ASP.net code, as well as source code (commentaries). So, I hope are not going to see spell any bugs in my posts any more.

Interesting from my Reader this week

This week I liked such things came up from my reader.

  • Enforcing a Base Controller. K. Scott Allen using very interesting technique for assert that some particular class is derived from expected class using reflection. That could be reused not only for case of Controllers (as Scott use) but any other classes.
  • New Embedded Database Support with ASP.NET. Announcement by Scott Gu of new DBMS by Microsoft that is positionized as brand-new, lightweight, no-install-require database system. It really looks interesting, so please welcome - SQL Server Compact Edition 4.
  • Introducing IIS Express. One more big annoucement by Scott Gu. IIS Express is new web server aimed to make life of ASP.net developers easy and fun. It should combine easy-of-use features of ASP.net development server and power of IIS server. Sure it is integrated with VS 2010.
  • MicroTut: How CSS Positioning Works. As usually a vey good tutorial by Martin Angelov. Explains something that you always forget and very nice to fresh up memory from time to time.
  • The Weekly Source Code 52 - You keep using that LINQ, I dunna think it means what you think it means. Very nice article by Scott Henselman about a pitfalls you will never know during coding with Linq (or any other ORM with generation of SQL). I remember a talk with my collegue from Denmark, Christian, then I was asking about his thoughts about "Is is good to start to use Linq for our project?” he said, “It is good till you keep eye on a actuall SQL that is being generated by framework”. Now I undrestand what he meant.

Happy reading!

DDD, Implementation of Repository pattern with Linq to SQL

Lets review first and one of major DDD pattern - Repository. Repository is something that provides access to an entities objects (domain objects). Here what DDD patterns guide says on Repositories:

For each type of object that needs global access, create an object that can provide the illusion of an in-memory collection of all objects of that type. Set up access through a well-known global interface. Provide methods to add and remove objects, which will encapsulate the actual insertion or removal of data in the data store. Provide methods that select objects based on some criteria and return fully instantiated objects or collections of objects whose attribute values meet the criteria, thereby encapsulating the actual storage and query technology. Provide repositories only for aggregate roots that actually need direct access. Keep the client focused on the model, delegating all object storage and access to the repositories.

Preparation


Suppose we are having a database with table Users in it. First of all we have to create a Data Model class. To do that you can add “New item” to you class library (or application) and select Linq to Classes.



This will add new .dbml file your project. There are 2 ways of addition new entities to model. Either by designer (easy to use) or manually by coding .dbml file (harder to user by more flexibility). We will just use first way as more quick one. Just open you db in Server explorer and drag-and-drop Users table to .dbml designer. You will see something like that,



Now if you open corresponding .cs file of Data Model you can easily see what code is actually generated by Linq to SQL. Let’s quickly review it. So, most improtant class is DataContext.

  [global::System.Data.Linq.Mapping.DatabaseAttribute(Name="trackyourtasksdb")]
  public partial class TrackYourTasksDataContext : System.Data.Linq.DataContext
  {
    
    private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();

* This source code was highlighted with Source Code Highlighter.


DataContext is something that suppose provide access to tables and objects and track the state of these objects. It uses SubmitChanges() method to flush the data to database. It is lightweight object and you should instantiate in in method of class scope, there are no reasons to keep a single copy of object for whole application. It is not only possible to work with tables within DataContext, but stored procedures as well.

Besides of that the object represenation of table record is generated. The class is called User (please not that Linq to SQL is removing plural -s suffix by itself).

  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Users")]
  public partial class User : INotifyPropertyChanging, INotifyPropertyChanged
  {
    
    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    
    private int _Id;
    
    private string _Email;
    
    private string _SecretPhrase;
    
    private string _Password;
    
    private System.Data.Linq.Binary _Timestamp;
        
        //...


    public User()
    {
      OnCreated();
    }
    
    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true, UpdateCheck=UpdateCheck.Never)]
    protected int Id
    {
      get
      {
        return this._Id;
      }
      set
      {
        if ((this._Id != value))
        {
          this.OnIdChanging(value);
          this.SendPropertyChanging();
          this._Id = value;
          this.SendPropertyChanged("Id");
          this.OnIdChanged();
        }
      }
    }
    
    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Email", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false, IsPrimaryKey=true, UpdateCheck=UpdateCheck.Never)]
    public string Email
    {
      get
      {
        return this._Email;
      }
      set
      {
        if ((this._Email != value))
        {
          this.OnEmailChanging(value);
          this.SendPropertyChanging();
          this._Email = value;
          this.SendPropertyChanged("Email");
          this.OnEmailChanged();
        }
      }
    }

        //...


* This source code was highlighted with Source Code Highlighter.



So as you see it incapsulates fields of table as corresponding properties of object.

Interface


As it said above Repository have to add, remove as well as search and update objects. Note, that we work work with db record (entities classes) as we just work with in-memory objects.

It is always good idea to work with such structures as Repositories, Factories, Services etc. throught interface. First of all, because it conforms to common object oriented design guidlines and make us possibility to have different implementation classes that would provide different behavior. Second, that with interfaces you can substitute real object with mock object during testing. Moreover with interfaces it is easy to use Dependency Injection pattern, that improves application flexability and testability.

User repository interface looks like,

using System;
using System.Linq;
using System.Text;
using Trackyourtasks.Core.DAL.DataModel;

namespace Trackyourtasks.Core.DAL
{
  public interface IUsersRepository
  {
    User FindUserById(int id);
    User FindUserByEmail(string email);

    void SaveUser(User user);
    void DeleteUser(User user);
  }
}

* This source code was highlighted with Source Code Highlighter.


Now let’s implement this repository with Linq to SQL tools. We would review all methods, one by one.

Construction of Repository:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Trackyourtasks.Core.DAL.DataModel;

namespace Trackyourtasks.Core.DAL
{
  public class UsersRepository : IUsersRepository
  {
    TrackYourTasksDataContext _context = new TrackYourTasksDataContext();

* This source code was highlighted with Source Code Highlighter.


As you see I instantiate DataContext object as a member of UsersRepository class. So, it will be alive and tracking objects since UserRepository class is alive.

Find methods:

    public User FindUserById(int id)
    {
      return (from user in _context.Users where user.Id == id select user).SingleOrDefault();
    }

    public User FindUserByEmail(string email)
    {
      return (from user in _context.Users where user.Email == email select user).SingleOrDefault();
    }

* This source code was highlighted with Source Code Highlighter.


Impelementation is just a simple Linq query that selects object either by Id or Email. I use SingleOrDefault() that returns object if found and default if not (null in my case).

Save and Update methods:

    public void SaveUser(User user)
    {
      if (user.Id == 0)
      {
        _context.Users.InsertOnSubmit(user);
      }
      _context.SubmitChanges();
    }

* This source code was highlighted with Source Code Highlighter.


So, if are created user entiry by new operator it will contain Id == 0 (meaning no Id, yet), as we passing it to Save method it will check is this object persistant or not and if not it will be add it to storage. Since context object is not disposed after, it still continue track object changes, so if we decieded to change some object fields and store it all we need to do is call SubmitChanges() method and corrsponding record will be updated. I’ll put some tests here to see how it works:

    [Test]
    public void InsertUser()
    {
      //INIT
      var register = new UsersRepository();

      //ACT
      var user = new User()
      {
        Email = "email",
        SecretPhrase = "sec",
        Password = "pass"
      };

      register.SaveUser(user);

      //POST
      var actual = register.FindUserByEmail("email");
      Assert.That(actual, Is.Not.Null);
    }

    [Test]
    [ExpectedException(typeof(DuplicateKeyException))]
    public void InsertUserTwice()
    {
      //INIT
      var register = new UsersRepository();

      //ACT / POST
      var user = new User()
      {
        Email = "email",
        SecretPhrase = "sec",
        Password = "pass"
      };

      register.SaveUser(user);

      var newUser = new User()
      {
        Email = "email",
        SecretPhrase = "sec",
        Password = "pass"
      };

      register.SaveUser(newUser);
    }

    [Test]
    public void UpdateUser()
    {
      //INIT
      var register = new UsersRepository();

      var user = new User()
      {
        Email = "email",
        SecretPhrase = "sec",
        Password = "pass"
      };

      register.SaveUser(user);

      //ACT
      user.SecretPhrase = "newsec";
      register.SaveUser(user);

      //POST
      var foundUser = register.FindUserById(user.Id);
      Assert.That(foundUser, Is.Not.Null);
      Assert.That(foundUser.SecretPhrase, Is.EqualTo("newsec"));
    }

* This source code was highlighted with Source Code Highlighter.


Delete Methods:

    public void DeleteUser(User user)
    {
      _context.Users.DeleteOnSubmit(user);
      _context.SubmitChanges();
    }

* This source code was highlighted with Source Code Highlighter.


So object is marked as to be deleted by calling DeleteOnSubmit() and it will be actually deleted on SubmitChanges() call.

Conclusions



It is really easy to start up with Repositories keeping its implementation as simple as possible. Of cause, typicaly data structure in databases are bit more complex than plain table. But it is still possible to work with this pattern, combining with Repositories, Aggregates, Entities and Values.

DDD, Domain Driven Design

DDD
There is one great book by Jimmy Nilsson Applying Domain-Driven Design and Patterns (russian translation of that book is just awful, so now I’m looking for orignal copy). Jimmy is describing DDD with a very nice examples and concepts, also he gives a good attension to TDD and refactoring. If you want to start with DDD (and you have to) you should check DDD website http://domaindrivendesign.org/ and I really liked personal blog of Jimmy Nilsson.

I already did use DDD in my previous posts while I designed registration functionality for web application. I believe that many of you are using DDD in your development practice but it could be rather implicit practice.

DDD is not something strict like methodologies or technologies are and give no strict rules how to do things, but rather a way of thinking how to work with domain specific within software development. What I personally like in DDD that it goes with a set of patterns that also helps to form common vocabulary for developers. There is a document that gives short summarize on DDD patterns, you can get is here.

Let’s review triangle of What/Why/Where for DDD.

What ?


Domain Driven Development is a way of thinking for development of software that do focus on:
  • Core domain - Understanding of domain is vital for any software product. Proper representation of domain with tools and languages you have is vital for any software project.
  • Patterns - If I met some problem I’m really sure that I’m not first person who did, and probably this problem is alredy solved (probably well enought). Such “solved” problems forms so called patterns, something “know-how” that could be reused for another partcular needs. There are no reasons to reinvent wheeel.
  • Collaboration - Collaboration between developers and domain experts as more extensive as possible. Experts could be a customers (customer on site as XP says) or other representive who in charge of product (product owner as Scrum says).


Why ?


Software is something that suppose to solve problems we met in life. DDD focused on these problems and tries to desing software as closer to problems as possible. Personally I think that DDD is a native way of software development.

Where ?


Everywhere actually. DDD is not for some specific areas. So, Web, Desktop, Fun or Science.. everything is applicable.

Conclusions


As I said on a beginning DDD is something that every developer shound aware about it (I would highlight word “aware” meaning it is not expected to be an expert on it, that always good, but know that it is exists and know key priciples). You will easy found a start up materials in internet. Meanwhile if I meet some examples of DDD patterns implementation I’ll do blog about it.