Sergey's profileSergey ShishkinBlogLists Tools Help

Sergey Shishkin

software + people
6/8/2009

Architecture.NET Open Space

The last weekend I participated in my first open space (anti)conference – Architecture.NET Open Space in Düsseldorf. And I must say: It was my best conference experience ever!

There are some results in the conf’s wiki in German. Here I just want to write down some of my observations.

A couple of things came up in almost every session:

  • Clean code and agile design principles. Software architecture consists of decisions that are hard to change. Agile software architecture aims to make changeable as many decisions as possible. So clean code and agile design principles is the absolute minimum that we don’t want to trade off. This statement is not a dogma – it’s the cornerstone that makes other decisions changeable, it makes agile software architecture possible.
  • Asynchronous communication and messaging. This is a very hot topic now. Messaging is what enables the Open/Closed Principle on the architectural level. And O/CP is what enables architecture to evolve and does not let it rot.

Discussions were sometimes heated and controversial, but always very inspiring and thought-provoking. I already count days till Archnet Open Space next year.

Technorati Tags:
5/5/2009

Intentional Software Demo

I just watched a great demo of Intentional Domain Workbench presented at DSL DevCon about a month ago. Beside the fact that the demoed software frightengly looks like a “silver bullet”, "The Holy Grail” or at least “the future” of software development, it is the first demo of a RAD tool I saw that mentioned automated tests integration. See for yourself, it looks a lot like FIT acceptance tests:

IntentionalDomainWorkbench

Enjoy the full video at MSDN. It’s just awesome!

4/8/2009

Messaging Talk @DNUG Cologne

Yesterday I gave a talk on asynchronous messaging at .NET User Group Cologne. It was a lot of fun for me to speak about one of my favorite topics, and I would like to thank Albert Weinert for this opportunity. The audience was great, we got an interesting discussion afterwards. Unfortunately, I could not manage to attend the “after-party” and continue the discussion ;) I know the topic is very hot now, so feel free to ask your questions and give me your feedback in comments.

Here are the slides:

Asynchronous Messaging @DNUG Cologne, 07.04.2009 
View more presentations from guestfb013b.

And a couple of references:

Demoed StockTrader news module with messages (see revision 12)
http://code.google.com/p/messagingwpf/source/browse/trunk/src/StockTraderRI/

Original composite WPF guidance aka “Prism”, StockTrader RI
http://compositewpf.codeplex.com/

Some OSS messaging frameworks
http://code.google.com/p/masstransit/
http://www.nservicebus.com
https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/esb/

Fallacies of distributed computing
http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing

Four tenets of service orientation
http://msdn.microsoft.com/en-us/magazine/cc164026.aspx

Enterprise integration patterns
http://www.enterpriseintegrationpatterns.com/toc.html

12/3/2008

Data Access Patterns @DNUG Cologne

Yesterday, during the 30th meeting of .NET UG Cologne, I gave a mini demo-talk on the Repository and Specification patterns for Data Access. There were no slides, just code.

What Is It All About?

I like to write as little code as possible and be able to write as simple code as possible. Especially when it comes to Data Access. This is what I want my Data Access code looks like:

var price = new ProductPriceRangeSpecification(300m, 500m);

var name = new ProductNameSpecification("Road Frame");

 

var products =

    (from p in repository.FilterBy(price.And(name.Negate()))

    orderby p.Name

    select p)

        .ToList();

How It Works?

The main character here is the Repository. I tried to keep its interface as small as possible (and it is still the biggest interface in the system):

public interface IRepository<T>

{

    void Save(T entity);

 

    void Delete(T entity);

 

    T Get(object key);

 

    IQueryable<T> AllEntities();

}

That's really it. The rest of querying functionality will be added through extension methods. Here is where the FilterBy method comes from:

public static IQueryable<T> FilterBy<T>(

    this IRepository<T> repository,

    ISpecification<T> specification)

{

    return specification.Filter(repository.AllEntities());

}

I use extension methods extensively and don't think I abuse them. In this case I clearly separated the contract needed to be implemented and the publicly available functionality built on top of it. Extension methods basically help to build a DSL around a very simplistic object model. And whenever I wonder where a method comes from, I hit F12.

Specifications appear on scene in supporting roles every here and there:

public interface ISpecification<T>

{

    Expression<Func<T, bool>> GetPredicate();

}


public
class ProductNameSpecification : SpecificationBase<Product>

{

    private readonly string query;

 

    public ProductNameSpecification(string query)

    {

        this.query = query;

    }

 

    public override Expression<Func<Product, bool>> GetPredicate()

    {

        return p => p.Name.Contains(query);

    }

}

The beautiful thing in this design is the fact that Specifications are not coupled to the database. They are expressed in terms of the Domain Model and belong to the Domain Model as well. And of course they can be tested against an in-memory implementation of the Repository.

Onion Or Cake?

All the code sits in a single C# project for simplicity, though is layered well.

CodeStructure

In classic Domain-Driven Design the Repository abstraction belongs to the Domain layer. I however separate one additional Framework layer, which is a reusable part of the Domain layer across multiple applications and multiple Domains. Both Domain and Framework are kept clear of any infrastructure concerns.

The Infrastructure layer is where all that dirty NHibernate details are hidden. But the IRepository interface and Linq do a very good job to protect the application from NHibernate leaking into the Domain layer.

Here is what NDepend has to say on that matter:

DomainDataDependencyMatrix

Notice that Unit and Integration tests are separate. Unit tests don't require any infrastructure to be in place, they can be run against pure Domain code.

What About Transactions?

I intentionally left the Unit Of Work out of the talk. Two reasons for that are the limited time of the talk and some technical problems that I have with the current implementation. So you also won't find UoW and transactions in this code sample. I'm going to make transaction work in the next version. Stay tuned ;)

Requirements

The code sample is built against the AdventureWorks database. I use NHibernate as an O/R Mapper and Linq to NHibernate for queries. To make NHibernate mappings a bit simpler Fluent NHibernate is used. xUnit.Net is my testing framework of choice.

What About Feedback?

Download the code and tell me what you think.

11/18/2008

TechEd 2008 EMEA Retrospective

I'm now back from TechEd 2008 EMEA Developer at Barcelona. TechEd for me is always great experience and Barcelona is probably the best place in Europe to be at in November.

This was my third TechEd and, although it wasn't the best one I've been at, I must disagree with people who say this year's TechEd was bad.

TechEd vs. PDC

This year was special because Microsoft held PDC earlier this year. Although TechEd and PDC overlap in content their goals are different. PDC is primarily for Microsoft to get feedback from the developer community about their new product evolution wave. TechEd on the other hand is aimed to help developers build on Microsoft platform.

Taking that into account TechEd is a wrong conference to learn what's new in the Microsoft ecosystem. To learn new buzz-words you should be attending PDC, or just glance over recorded PDC sessions as I did. TechEd is there to get a pragmatic look at Microsoft's landscape from industry leading experts.

But anyway PDC steeled from TechEd in terms of content, speakers and attendees.

Choose Sessions Wisely

When I asked some people at TechEd how do they like it, many have said they could not find interesting sessions to go to, or were disappointed after attending such. Well, that differs from my own experience and would answer: "Choose sessions wisely!"

Here is a list of some of my tips to choose a session to go to:

  • Choose Speakers, Not Titles
    Speaker matter. Really. People like David Chappell, David Platt, Pat Helland, Udi Dahan and Roy Osherove made TechEd this year in my opinion. Their content is always unique and presentation skills are outstanding.
  • Look At The Level
    There are sessions of levels 200, 300 and 400 at TechEd. If you did read a couple of blog posts about XYZ, don't expect to lean something new about it from a 200-level session, except the speaker is David Chappell or the track is ARC. Architecture track is too abstract to assign any level to it, IMHO.
  • Look For Experience, Avoid Marketing
    I personally consider TechEd too expensive to learn what's new in the version Z of product Y. In contrast it is the best opportunity to learn from the experience of the experts.
  • What Do You Want To Ask?
    When choosing between two sessions I tend to go to the one where I'm going to ask questions. The other one I can watch recorded.
  • Do Your Homework
    Try to read as much blogs on the topics of your interest before the conference as possible. Then you can skip introductory sessions at all.

Here is what I've attended (except the keynote and lunch sessions):

  • David Chappell
    • An Overview of the Azure Services Platform
    • Claims-Based Identity: An Overview of "Geneva"
    • A First Look at "Oslo", "Dublin", and WF 4.0
  • Pat Helland
    • When You Have Too Much Data, “Good Enough” is Good Enough
    • Building on Quicksand
    • RIAs and Emissaries
    • Metropolis: Buildings and Applications
    • Green Computing through Sharing: Reducing both Cost AND Carbon (General Session)
  • Miha Kralj
    • Architectures: The Good, the Bad, and the Ugly
    • How IT will change in next 10 years and why you should care
  • Udi Dahan
    • Intentions & Interfaces - Making Patterns Concrete
    • Web Scalability via Asynchronous Systems Architecture
    • Reliability, Availability and Scalability - How to have your cake and eat it too
    • Avoid a Failed SOA: Business and Autonomous Components to the Rescue
  • Roy Osherove
    • Designing for Testability: Bridging the Gap between Design and Testing in Object-Oriented Software
    • The future of unit testing
  • Rockford Lhotka
    • How to manage technology and not have it manage you
  • Mario Szpuszta
    • Security Architecture for Heterogeneous Environments in the Real World - The Identity Meta System and Federated Identity applied to a Real-World Scenarios
  • Vittorio Bertocci
    • Identity and Cloud Services

Drawbacks

In general, this year's TechEd looked a bit cheaper, either because of PDC or the economy situation in the world, I don't know exactly why. Less well-known names, boring exhibition and ask-the-experts booth, poor lunches, etc.

Another drawback is communication. For some reason all the portal and communication tools MS builds for TechEd fail. Attendee search was counter-productive. Almost nobody used community groups. There were thousands of interesting people and no way to find somebody you would like to talk to. Some additional Open Space-alike activities would bridge the gap, I think.

The German Country Drinks party on Wednesday was my worst time at TechEd. It was a buffet in a bar with very loud dancing music so that everyone had to shout. There was no introduction, no activities. German Microsoft just brought a lot of German-speaking people in one place and provided some food and drinks. Maybe it was a cultural impedance mismatch, but I would expect some networking out of such event, and not just drinking with people you already know. Not surprisingly most of the people gone before 22:00.

Summary

Anyway, the week at TechEd was great. I learned a lot, talked to many interesting people, and had fun!

 

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© 2007 Sergey Shishkin