Introducing Bix: The Business Mix

I've got a new project called Bix that I'm working on during what free time I can carve out. The idea is that rather than inheriting all of the infrastructure for a framework from base type, you can use .NET attributes to pick which framework behaviors you want mixed in with your class. These behaviors are then mixed in using post-compilation code weaving with mono.cecil, which is an aspect oriented programming (AOP) technique. This frees you up to focus solely on domain modeling.

It also allows you to pick and choose the behaviors that you want to use per-type (or per base-type). And I really hope to provide good support for Domain Driven Design by making the domain model the core of the application. Frameworks that I've used often feel like wrapping behavior around a core of relational database tables. Ugh.

Then there's this: a pet peeve of mine is mixing infrastructure inheritance and domain inheritance. These are not standard terms, so I should explain.

Say you're using CSLA (which is a fine framework, btw). You would inherit a domain type from the base business object type. This is an infrastructure inheritance in that your Foo is-a business object. That's a perfectly legitimate relationship. That the base business object has no meaning within the domain is not consequential because you're interested in grabbing shared behaviors.

Now say that you have a domain type Bar that, in the domain model, is-a Foo. So you implement that relationship with inheritance. This is also legitimate. Because Bar and Foo are both meaningful within the domain, this is domain inheritance.

But wait, Bar also is-a business object directly in the same way that Foo is-a business object, so why is one the child of business object while the other is a grandchild.

I understand that Bar still gets all of the business object behavior, and that there is probably nothing wrong here. But it still bothers me. I feel like type inheritance is being used for two very different things in the same hierarchy. One use is plumbing and one use is conceptual within the domain. Having worked on an in-house framework for several months in the past, I've also run into some of the more pragmatic issues that this mixture of inheritance types creates, but though dealing with them added some complexity, none of them were blocking.

Still: it bothers me. So I'm happy to be trying my hand at creating a Better Way.

You can see what exists of my plans on the Bix Trello board.