Domain Driven Design reference card

Spotted this handy online reference for Domain Driven Design:

http://www.scribd.com/doc/21997741/DZone-Refcard-76-Domain-Driven-Design

Upgrade from Windows 7 beta/RC to Windows 7 RTM

Finally got around to upgrading to Windows 7 RTM, only to be greeted with the following:

You cannot upgrade this prerelease version of Windows 7. Go online to see how to install Windows 7 and keep your files and settings

A quick Google found these instructions.   Should save you the hassle of rebuilding your PC :)

TrueView Maintenance Release 1.3.0908.21

The latest release has some UI fixes for TrueView, and mapping fixes for DataBridge.  Download it here.

TrueView Fixes

  • UI now shows changes if entities are modified inside constructors
  • Corrected treenode selection when removing a previously selected node
  • Fixed race condition when opening Entity property nodes
  • Entity Property treenode no longer renders with the Entity’s style
  • Fixed window layout for magnetic windows
  • Fixed window positioning when overlaying windows
  • Correctly identifies the top-most window in multi-monitor mode
  • Exceptions when retrieving Summary value are no longer fatal
  • Fixed Search Results window ownership in MyApplication.Load<T>(query, parameters)
  • Shortcut key presses are now handled for multi-monitor mode

Enhancements

  • ‘Short’ values now have smaller widgets (Strings)
  • Improved ‘Version Check’ dialog messages

DataBridge Fixes

  • Corrected writing of Component properties
  • Fixed Foreign Key names for Entity properties of the same type

Multi-monitor support and popup Search Queries

The latest release includes 2 very useful UI features:

Multi-monitor support

This option is specially useful when you’re demoing to others, and can be enabled from Tools->Options->UI Settings->Allow MultiMonitor Use. All subsequent windows will open outside of the Workbench, allowing them to be dragged to other monitors.

Popup Search Dialogs

Although drag & drop is very powerful, not all users are comfortable with it, instead preferring to select items from a list.  With this is mind, a new context menu item was added:

popup-search-dialog-for-entity-property

Selecting this will open a Search Dialog, where the user can query and select an Entity.  It also works for EntityList properties (multiple Entities can be selected in this case):

popup-search-dialog-for-entitylist-property

It’s also possible to pre-load the popup search dialog using Query Specifications.  See the section “Pre-filtered Search Query Dialogs” in the user guide to learn more.

TrueView Release 1.3.0908.09 – ServiceLocator and Dependency Injection

The latest release adds Dependency Injection to the mix.  The default behaviour uses a simple Service Locator, but you can inject your own dependencies as you wish.  See the user guide for more info.

BREAKING CHANGES:

The following interfaces now implement IServiceDependent:

  • IEntity
  • IFactory
  • IRepository
  • IService

Enhancements

  • Added MyApplication.ServiceLocator (for locating Factory/Repository/Service classes)
  • Added IServiceDependent for DependencyInjection services
  • Added IService interface (similar to IFactory and IRepository)
  • Services are now shown in the Class Library treeview
  • MyApplication now raises EntityCreated event when entities come into scope
  • MyApplication now raises EntityDisposed event when entities are no longer required
  • MyApplication now raises ApplicationInitialised event at startup
  • Many delegates moved out of classes (reduce API clutter)
  • Added EntityListAttribute.HasUniqueItems, to determine if duplicate items are allowed
  • Drag/Drop tip now detects duplicate items
  • Replaced Class Library CheckBoxes with ToggleButton
  • Added Search box to Class Library to allow easy finding of Entity classes
  • Increased scrolling speed when using Drag/Drop on treeview
  • ListView numeric columns are now right-aligned
  • Re-instated “Explore” context-menu option for root Entities
  • Added support for parameterised Methods
  • Window buttons bar is now visible by default (to reduce flickering)
  • Added AddRange & RemoveRange methods to TransientEntityList
  • Added AddRange & RemoveRange methods to EntityList
  • Search Form now shows Query text as query is built
  • Boolean editor now changes value immediately
  • Hitting F2 over a listview opens the editor beneath the mouse cursor
  • ‘Short’ values now have smaller widgets (Numbers, Enums, Dates)
  • Added new “Replace/Add” context-menu items for context sensitive queries
  • “Open File” option renamed to “View File”
  • Changed internal async command processing
  • Added “Allow multi-monitor use” option for non-MDI interfaces
  • Query List no longer shows “Type” in first header
  • Entity treeview no longer scales when window is resized
  • Changed error message when trying to execute HQL using MemoryCache provider

Fixes

  • Reduced flickering when rendering/repainting controls
  • Corrected header style for each window
  • Correction in MyApplication.Start() to allow repeated calls
  • Saving object graphs with unmapped entities now always forces NHibernatePersistence
  • Corrected UI updates when setting Parameters
  • Applied [Visible=false] attribute to all public interface members
  • Exceptions no longer thrown if Providers aren’t defined in app.config
  • Correction in collection/list count
  • Correction in identifying parent widgets
  • Fixed margin settings for collapsible panels
  • Corrected identification/caching of icons for sub-classes
  • Corrected icon for Namespace nodes
  • ListView “Auto-resize” option now overrides user defined widths
  • Window button tooltip is updated for Search Forms
  • Corrected culture setting for DateTimePicker
  • Better handling of exceptions when editor controls are rendered
  • Now uses correct DateTimePicker rendering for Windows 7
  • Corrected background colour in Enum editor
  • Empty Category headers are no longer displayed
  • Disabled “Explore” option for primitive types
  • Corrected multiple argument injection in EntityList Add & Remove methods
  • Reduced Drag/Drop tip flickering
  • ListView “Property” column is now sized to fit
  • Selected TreeView node is now scrolled into view
  • Corrected border colour for Boolean editor
  • Corrected Entity Relationships for properties in super classes
  • Corrected event handler disposal in a few controls

Optimisations

  • Improved string building performance
  • Optimised widget detection at mouse co-ords
  • DynamicMethods are now created lazily
  • Entity Relationships are now resolved lazily

Eric Evans: “What I’ve learned about DDD since the book”

Eric Evans talks about the most essential parts of his book, having practiced it over the last 5 years.

One of the topics that caught my attention was Exploration and Experimentation (3m 25s into the video).  Evans suggests that teams should be exploring & experimenting even after a useful domain model is created.  His quote:

What are the odds that [the first good model] is the best you could have done?

So why aren’t teams doing this already?  Typically, it’s because of fear and cost of change. Traditionally, software has never been easy to change (read expensive).  And for all of the new technology being spewed out, not all of it is designed to make change easy.

This is the void that TrueView attempts to address.  It’s not about UI design, or database design, or Web Service contracts.  It’s about creating interactive domain models that Domain Experts and Software Experts can explore, discuss, and help refine the ubiquitous language.

If you haven’t tried it already, you can download it here. I hope you find it useful.

Eric Evans: Why do efforts to replace legacy systems fail?

Gojko Adzic has an interesting piece by Eric Evans about replacing legacy systems.

In summary, focus on the core domain – the part of the software that brings competitive advantage to the business – and use an anti-corruption layer to interface with the old system.

Tips for Domain Driven Design and TrueView

Here are some tips for DDD newbies.  It’s easy to fall back to doing ‘what you know best’, so use these tips to stay focused. Hopefully your design skills will get better (and faster) as a result. :)

  1. Don’t start with the User Interface
    Instead of asking “How will the user solve this problem?“, ask “What is the problem?
  2. Design Domain Models, not database schemas
    Most business users don’t understand database schemas – so don’t make them
  3. Design your Domain Model incrementally
    Defining too much detail early on is the fastest way to get side-tracked
  4. Get constant feedback from your Domain Experts
    Take advantage of TrueView’s auto-generated prototypes to get instant feedback
  5. Separate business concerns from technical concerns
    Writing technical infrastructure code can be counter-productive during the modelling phase
  6. Unit testing wisely
    Focus on testing non-trivial behaviour and complex business logic, possibly using BDD
  7. Think agile, be agile
    Your clients don’t have time to wait, so don’t make them

You can read the detailed version here.

When should you use a Value Object?

Whilst in the middle of writing about “Entities vs Value Objects“  I discovered this post by Dylan Beattie.

I’ve observed that a lot of DDD newbies get hung up on Value Objects, persistence, how to normalise the database, and other implementation concerns.

Value Objects stem from the actual domain problem, not from  persistence.  Read Dylan’s post to understand why.

TrueView Release 1.2.0905.22 – Maintenance release, performance improvements

This release has some major UI rendering improvements, and a couple of enhancements to aid usability. TrueView DataBridge also has a couple of small fixes.  Download them here

Enhancements:

  • Drag/drop tip now explains the drop action
  • Drag/drop tip now tries to stay on-screen, regardless of curson position
  • Now allows new entities to be added to unsaved parent entities
  • “Save This” tooltip now shows reason for being disabled (where applicable)
  • Removed duplicate results in Search window
  • Friendly names are now generated for generic lists
  • Improved icons bitmap scaling quality
  • Removed error messages when using IQuerySpecification with FilePersistence provider class

Fixes:

  • UI refresh now updates all Entities
  • Fixed stack overflow when tracking dirty entities in circular object graphs
  • Corrected tracking of entities that are removed from lists
  • Dynamic listbox ensures that property value is automatically loaded
  • Fixed NullReferenceException when pressing Enter in an empty Queries List
  • Fixed DataTimePicker background colour on Windows Vista
  • Removed system beeps when entering/exiting edit controls (NumericUpDown is still a problem)
  • Correct sizing of PropertyGrid columns
  • Corrected enabled state for “Save This” menu item
  • Corrected bold text clipping in Search treeview
  • Allow NHibernate to use reflection-optimizer if configured to do so
  • Menu and toolbar items are now updated if Undo/Redo fails
  • Better alignment of Boolean radio-buttons
  • Better sizing of bitwise(flag) enum listbox
  • String compacting algorithm no longer creates null-terminated strings

Optimisations:

  • Massive improvements to UI rendering performance
  • Reduced startup time in MyApplication.Initialise (i.e. for unit testing)
  • FilePersistence now flushes to disk less frequently
  • Improved string building performance

Known issues:

  • NumericUpDown editor still beeps when Enter is pressed
  • Search Query Editor window doesn’t hide Boolean editors immediately (need to hit Escape twice)