Tuesday, December 22, 2009

What I Learned from PDC - Domain Technologies

The domain is the brain or personality of the application and is usually built with the help of a Subject Matter Expert (SME).

I like to think of the domain as having the real knowledge of the application and the Client and Server components as providing input/output services. Think of the case where a text box control is doing input validation. The code in the control can be kept simple, it just needs to verify that the text typed in by the user conforms to a validation rule, and if it does not, display some type of message.

An implementation that binds the control to a text string might also execute validation logic in the On-Click code behind method. An implementation that binds the control to a property lets the code in the control stay generic, and keeps all the validation logic in the domain model where it can be easily maintained. This separation of concerns is the ‘S’ of the ‘SOLID’ design principle and you can learn about the other components (OLID) here.

When you create a domain model that uses the vocabulary of your SME, and solves problems using the processes the SME would use, then the rest of the application becomes easier to build. The Client and Server layers become tools to visualize your domain model or persist your domain model.

Domain Model: The Domain Model executes the formal business logic and should be the primary location for all the application state transition rules. Very few talks have time to develop a Domain Model, however if you watch talks that focus on language features, LINQ, Rx or parallel computing they are full of examples showing how domain modeling is becoming more declarative and less imperative. That is, software design is evolving into describing what you need the computer to do instead of traditionally telling the computer how to do it. .NET is evolving to merge dynamic, functional and object oriented programming models into the platform. The declarative slant in coding allows the .NET platform to make decisions about how to execute the code at runtime, to take advantage of system resources like multiple CPUs or resources in the Cloud.

Talking Points: Microsoft talks do not focus on the domain model at all. The only talk I found that fits the definition is Cl36: Deep Dive on Bing Maps Silverlight Control because it focuses on the domain of mapping, however the domain is so well defined it is delivered as a GUI control and a service. Instead look to the language features to help you model your domain: FT11: Future Directions for C# and Visual Basic. Developers should be aware of a new (or maybe very old if you know LISP) way of programming FT20: F# for Parallel and Asynchronous Programming , languages for Data Modeling FT34: Microsoft Project Code Name “M”: The Data and Modeling Language, Parallel Computing Platform: P09: Manycore and the Microsoft .NET Framework 4: A Match Made in Microsoft Visual Studio 2010 and Erik Meijer VTL04: Rx: Reactive Extensions for .NET. Rx technology was the language innovation of the show. Learn about Rx in 15 min here.

I will cover the Controller Model and Data Proxy in the next post.

No comments: