Re: The DCI Architecture: A New Vision of Object-Oriented Programming
Posted: May 11, 2009 9:03 AM
It is based on years of experience and reading.
It is not based on any of Fowler's patterns. Instead, it is based on hypermedia concepts as well as other theories, such as hierarchical state machines, behavior trees (used in game programming), agent-oriented programming, feature-oriented programming, adaptive object-oriented programming, aspect-oriented programming, theories from information science such as Codd's relational model and Darwen/Date's relational model, master data management, etc. The biggest value in all these theories is that they establish proven reasons for why I write a particular chunk of code. Every line of code should have a purpose. I don't believe in calling something "architecture" if it's mainly a bunch of shunts and shims holding things in place.
For hypermedia, I was always interested in the work of PJ Brown (GUIDE), Ted Nelson (Xanadu), Douglas Englebart (the mouse, among other hypermedia contributions), Roy Fielding (REST) and EJ Whitehead (WebDAV). There was also in the '90s a bunch of methodologies for blending Object-orientation with Hypermedia, although I feel the papers were somewhat hard to read without trying to prototype the ideas in code while reading the paper. Also, Wikipedia taught me a fair amount about fancy caching of hypermedia. Wikipedia is the world's largest "composite/structured application".
For object-oriented user interfaces, I first heard about these my freshman year in college when Allen Holub published a series of JavaWorld articles on them, and I later bought the book <em>Naked Objects</em> by Richard Pawson and Robert Matthews. Neither of these resources are particularly good, though. Why? (1) Pawson sounds too much like a CTO giving a high-level overview, and he never really discusses core architectural concepts, despite bashing others (2) Holub focuses too much on simply eliminating "Getters", and doesn't go into much detail on application structuring. In fact, his book <em>Holub on Patterns</em> has some rather non-exemplary code. I suspect part of the problem is the weight of Swing; it's simply too hard to do anything radically OO in Swing. Just look at the Naked Objects Framework created by Pawson to see how limiting Swing is. Don't just look at the screenshots; look at the underlying code and extensibility points. Swing simply requires solving too many problems at the wrong level of abstraction to ever build a OOHUI (Object-Oriented Hypermedia User Interface) with it. Thankfully, Sun is starting to zero out Swing's budget.
For state machines, there is a long list of books on this subject. They all take different approaches. The real value here is in a model for REST's "Hypermedia as the engine of application state" principle. Most people don't get this principle whatsoever, and even joke about it by referring to their incorrect usage of REST as "Lazy REST".
I don't publish.
> E.g. I would like to know if your domain classes are tied
> to a given presentation model,
Why would I do something silly like that. The moment you have to vary the user interface, such as by user role to restrict permissions, your presentation model becomes needlessly complicated.
For what it is worth, I don't like Fowler's explanations of GUI Architecture. He doesn't really do a good job explaining the consequences of going down a particular route. However, bear in mind he's not committing serious time to these articles, either. My basic observation though is that Martin simply breeds trust, and it sometimes leads to people using his patterns for the sake of using one of his patterns, because there is a feeling you'd look foolish if you didn't.
I personally reject three layered architectures. They make no sense whatsoever.
I also reject traditional n-tier SOA architectures, because they are not event-driven but simply services-driven. I suspect in 10 years time the industry will finally transition to better practices; things like Enterprise Message Bus technology is finally maturing in the proprietary sector, which means FLOSS will be soon to catch-up. The trail has been blazed.
> or if you can reuse your
> domain model with both a Swing and HTML GUI?
I strongly believe in Model-Driven Architecture. Currently, a domain model maps to two UI platforms. However, that's not challenging. What has proved technologically challenging is creating an infrastructure for consistent styling, but our customers don't seem to care. They just want fewer mouse clicks and clean UIs. There are things like Mesh for skinning Struts applications, but they are Web-only. Currently, we use a rather monolithic cascading stylesheet language subset, and have our own CSS-subset interpreter on the Desktop. However, the level of styling is sort of limited compared to the sexiness you could get out of not using OO MDA, and just writing an Ext.js application directly.
As always, MDA is not cheap up front. Just look at how much of a struggle it is for Jim van Dam on the Eclipse RCP project to move to model-driven architecture. Not only is it hard for him, but it will likely be hard for others as well. He is a UML weenie, so in order to use his MDA approach you are locked into UML for your models. I'm not bashing UML, only pointing out that Jim's work is for "Fortune 100" Eclipse users.
Despite not being cheap, effectively modeling your architecture will simplify every decision you make after the fact.