Showing posts with label ddd. Show all posts
Showing posts with label ddd. Show all posts

Wednesday, April 7, 2010

Reflections on J.P.’s Nothing But Net Course

I took JP’s course in 2008 in Philadelphia and found it to be the most valuable but most draining course I have ever taken. By my nature, I am not somebody who will survive a boot camp of ANYTHING well. It also takes me a long time for me to absorb things. It is important to note that J.P. has announced plans to cut back from days that run until 2 or 3 in the morning to ending by 10 pm. I think it has taken me about 18 months but, I have finally absorbed most of the course. I still have some work to do in grokking Behavior Driven Design. During the class I made reference to the students as “Boodhoosattvas”. A bodhisattava is an enlightened learner on the way to Buddhahood. J.P. is an inspiring teacher encouraged his students to become a continuously evolving (and continuously integrated :) )passionate developer.


One key takeaway from the course was the concept of developing a solid core of knowledge. For me, focusing on Domain Driven Design through the work of Eric Evans (one of JPs recommendations) has been an area of focus for me. The idea of an ubiquitous shared language between users and developers has been a key tenet in my efforts to do stealth agile development. Evans focus on container shipping as a system example worked great for me, since I worked on a system that involves booking container shipments. I probably have taken even more, though, from some of Evans’ post-book webcasts that cover strategic design. Often forgotten amidst the tactical design DDD topics of value objects, repositories, and aggregate roots are some real wisdom in Evans’ approach to strategic design. Another pair of books that I have focused on are Jon Skeet’s C# in Depth and Jeffrey Richter’s CLR via C#.


Another thing J.P covered is how to develop a reputation as a developer. He encouraged the class to blog and work on presenting at user groups. I have started blogging this year and have my first user group presentation in a couple of weeks.


A third important takeaway was to take a broader view of a developer community. A great deal of the course is spent working with different groupings of fellow students. Prior to the course, I had been somewhat isolated from a sense of a developer community apart from the 7 or so people directly on my development team. In my own little community, I was content to dominate the discussion without any real technical debate or challengers. This week broadened my developer world view tremendously.


A fourth, very specific, takeaway was to embolden my renounciation of WebForm development. JP criticized WebForms development in favor of pattern-based approaches in the ballpark of the Model View Controller pattern. This has given me the kind of expert opinion and intellectual support for me to pursue the goal of eliminating WebForm server control based pages from the applications I work on.


This reflection really doesn’t relate to specific coverage of topics, although I can assure you that JP did cover the very ambitious syllabus in the course. I also blog about one approach he utilized to represent type-safe enums here.

Thursday, March 18, 2010

Steve Bohlen on Practical DDD in .NET and Value Equality

I recently had the chance to see an excellent presentation by Steve Bohlen on Practical Domain Driven Design. It was given to the Philly ALT.NET user group. He has slides and example code available here. ). For numerous discussion points, he emphasized the range of options available. It was refreshing to hear this approach which wasn’t dogmatic in how to approach DDD.


He talked about his Proteus open source library which has some very useful code in it. I want to illustrate in this post one of the classes he uses for DDD category of classes know as value objects. Value objects don’t have a unique identifier for equality checks. Instead, value objects are equal when all fields match. Steve uses a ValueObject base class that allows any type to have its fields compared using reflection. This allows the creator of a value object to have the functionality of equality comparison without writing out all of the tedious plumbing code to compare two objects field by field and without the code clutter within the class. There is more to his class than this but this is a very significant method.


 public virtual bool Equals(TObject other)  
{
if (other == null)
{
return false;
}
FieldInfo[] fields = base.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
foreach (FieldInfo info in fields)
{
object obj2 = info.GetValue(other);
object obj3 = info.GetValue(this);
if (obj2 == null)
{
if (obj3 != null)
{
return false;
}
}
else if (typeof(DateTime).IsAssignableFrom(info.FieldType) || typeof(DateTime?).IsAssignableFrom(info.FieldType))
{
DateTime time = (DateTime) obj2;
string str = time.ToLongDateString();
string str2 = ((DateTime) obj3).ToLongDateString();
if (!str.Equals(str2))
{
return false;
}
}
else if (!obj2.Equals(obj3))
{
return false;
}
}
return true;
}