How can we codify use cases more effectively?

Wednesday, July 21, 2010 gc 0 Comments

I have been sharing the DCI (data, context, interaction) architectural pattern with a few other software developers but thought I would share it with a wider group. I am not sure if DCI is great design. but it was developed by a great designer, Trygve Reenskaug, the inventor of the MVC pattern originally developed for Smalltalk. Trygve could have chosen better names for Data, Context, and Interaction. 

By the way, i
t is intended to be a complement to MVC not a replacement. Here is an article that explains the pattern:

The DCI Architecture: A New Vision of Object-Oriented Programming  



One other thing: Christian Horsdal from Denmark implemented an example framework in C# The C# example is a bit interesting and strange in its own right. It uses extension methods to add behavior to context interfaces. In C#, you cannot change the behavior of specified method in an interface, but you can add a method to an interface. Here is a better description of the rule from MSDN:
You can use extension methods to extend a class or interface, but not to override them. An extension method with the same name and signature as an interface or class method will never be called. At compile time, extension methods always have lower priority than instance methods defined in the type itself. In other words, if a type has a method named Process(int i), and you have an extension method with the same signature, the compiler will always bind to the instance method. When the compiler encounters a method invocation, it first looks for a match in the type's instance methods. If no match is found, it will search for any extension methods that are defined for the type, and bind to the first extension method that it finds.
Enjoy. Hope you find it interesting.



You Might Also Like

0 comments: