Angel “Java” Lopez on Blog

September 12, 2008

Layered architecture in Domain-Driven Design

This time, let explore the concepts of a layered architecture, as proposed by Eric Evans in its classic book Domain-Driven Design, Tackling Complexity in the Heart of Software. In the chapter four of the book, Evans presents this diagram:

 

Evans writes:

For a shipping application to support the simple user act of selecting a cargo’s destination from a list of cities, there must be program code that (1) draws a widget on the screen, (2) queries the database for all the possible cities, (3) interprets the user’s input and validates it, (4) associates the selected city with the cargo, and (5) commits the change to the database. All of this code is part of the same program, but only a little of it is related to the business of shipping.

He proposes that the domain model resides in a layer, the Domain Layer. In this way, the domain model is protected from technicalities as concrete persistence implementation, and presentation duties. I like to say that the domain is as an organism, that receives stimula, actions from the outside, and reacts to such commands. The domain should run without detailed knowledge of the rest of the application. Serialization between physical tiers, presentation details and database access, should be clearly separated from the domain implementation.

The layers could be described as:

UI (User Interface): the easiest to understand, this layer is the responsible of displaying information to the user, and accept new data. It could be implemented for web, desktop, or any presentation technology, present or future. For example, it could be a voice application, that interacts with the user via a phone. The acid test for our design is that a radical change in user interface should have minimal (or controled, at least) impact in the rest of the system.

Application Layer: it’s in charge of coordinating the actions to be performed on the domain. There are no business rules or domain knowledge here. No business state resides in this layer. It delegates all domain actions to the domain. It could coordinate many actions (possibly in many domains). It could prepare the infrastructure to be ready to work with the domain for an specific action (for example, preparing transaction scopes).

Domain Layer: In this layer resides the heart of software, according to Evans. Business rules and logic lives inside this layer. Business entity state and behavior is defined and used here. Communication with other systems, persistence details, are forwarded to the infrastruture layer. Evans discuss the patterns he uses in this layer, as Entities, Value Objects, Services, Repositories and Factories. We would explore the patterns and implementations in future posts.

Infrastructure Layer: God and devil are in the details, and in the infrastructure layer. Its main responsability is the persistence of the business state, most frequently, using a relational database.

My idea is to take an example (possibly a domain from Jimmy Nilsson), and develop it using these ideas, showing concrete code in Java and .NET. At some point, I will discuss about code generation from an abstract model, but it will not be the focus of these posts.

Sources:

Domain-Driven Design, Tackling Complexity in the Heart of Software, by Eric Evans.
Applying Domain-Driven Design and Patterns: With Examples in C# and .NET, by Jimmy Nilsson
.NET Domain-Driven Design with C#, Problem, Design, Solution, by Tim McCarthy. (There is a section in Tim’s blog dedicated to this book).

You can download freely

Domain-Driven Design Quickly

from InfoQ.

Angel “Java” Lopez
http://www.ajlopez.com/en

August 29, 2008

The Six Faces of IT Complexity

Filed under: Software Architecture, Software Development — ajlopez @ 10:19 am

I received an email from Roger Sessions, announcing his most recent issue of the ObjectWatch Quarterly Newsletter. ObjectWatch Newsletter is now in its thirteenth year of publication. He has written seven books including Simple Architectures for Complex Enterprises and many articles. In each issue, Sessions comments about one topic. This time, the topic of the Issue #57 (August 2008) is “The Six Faces of IT Complexity”. You can download the PDF version from:

Issue #57 (August 2008)

He has been studying IT complexity for several years now. Sessions has concluded that the vast majority of IT complexity falls into six categories. According him, if you can control these six categories, you can dramatically reduce the complexity that is choking your IT projects and preventing them from delivering business value.

These are the six causes of IT complexity Session enumerates (I take description from his articles and posts):

  1. Decompositional Failures – that is, systems that have not been decomposed into small enough subsets.
  2. Recompositional Failures – that is, systems that have been decomposed into subsets that are too small and have not been recomposed appropriately.
  3. Partitioning Failures – that is, systems in which either data and/or functionality has been divided into subsets that do not represent true partitions.
  4. Synergistic Failures – that is, systems in which functionality and/or data placement does not pass the test for synergy.
  5. Boundary Failures – that is, systems in which the boundaries between subsets are weak.
  6. Removal Failures – occur when there is functionality in a system that is unnecessary.

Read the article to a more detailed discussion, with real examples.

I know Sessions’ work since his book: Software Fortresses (I commented the book in an Spanish post), where Sessions gave us a new way to think about Service-Oriented and Enterprise Architectures.

Sites to visit:

http://www.objectwatch.com/

The whitepapers at:

http://www.objectwatch.com/white_papers.htm

(I have to read one comparing enterprise architecture methodologies, like Zachman Framework)

Newletters index at:

http://www.objectwatch.com/newsletter_index.htm

(there are issues dedicated to SOA, complexity, Software as a Service, Enterprise Architecture…)

and Sessions’ new blog:

Simple Architectures for Complex Enterprises

promoting and discussing his new book of the same title:

(at Amazon)

Angel “Java” Lopez
http://www.ajlopez.com/

June 21, 2008

Messages everywhere

Recently, I wrote a post about Message Passing Interface:

Message Passing Interface, CCR, DSS, and Pure MPI.NET

I used to pass message between agents in my example of a web crawler:

Distributed Agents using DSS/VPL

The passing of messages between components, agents, objects, is a feature that deserves more study. I guess we could write new kinds of applications, using one-way message passing, so we could abandon the call-a-method current way of doing things. Let’s explore first, some message passing applications (not only one-way style).

In the Wikipedia entry about Message Passing:

http://en.wikipedia.org/wiki/Message_passing

we can read Alan Kay opinion:

Alan Kay has suggested that he placed too much emphasis on objects themselves and not enough on the messages being sent between them. Message passing enables extreme late binding in systems.

If you develop systems with Smalltalk, Self or alikes, you’ll notice that the message is a first citizen, in many implementations, a full object, not only a way of call a method.

There is another place for use message passing. For 25 years, QNX operating systems uses the message passing paradigm to run a real time kernel.

I found this interview at Dr. Dobb’s to Sebastien Marineau-Mes, VP of engeneering at QNX:

Real Time OS in Today s World

Sebastien talks about the use of QNX in current market, and the challenge that multi-core machine could create on legacy code.

Remember: all the QNX kernel is based on message passing, although its messages are not one-way, and the passing is optimized to not incurr in loss of performance (more details, see QNX at Wikipedia). I see that many of these challenges and opportunities could be translated to the use, not only to multi-core, but to “multi-machines” in a grid. There many forces that are conspiring to bring these topics to current arena:

- We have a better understanding of agents, message passing and other ideas

- Normal hardware is cheap

- Each year, there are more application with higher level needs of scalabity (the user base will be the whole Internet in the near future, for non-trivial app)

- Many application must interact with other application in the same enterprise or in the net, and messages are an effective way to do that.

- In order to face that challenges, we must begin to abandon n-tier-only apps, to a cloud, grid or “something alike” schema.

I could imagine languages and technologies, based on message passing features. That is one of the reasons I’ve been involved exploring simples and crazy ideas with AjMessages, AjAgents, and Distributed Software Services during last months. I hope to write more about these subjects:

- Another example of distributed agents using DSS/VPL

- AjMessages ported to DSS (I had an implementation last year, but I never published it, I published the WCF only version)

- One-way messages implemented as primitives in AjTalk (Smalltalk-like interpreter)

- Deferred/Concurrent/LazyEvaluation/SomethingAlike implemented in AjBasic (using CCR?)

- Blog about a better-finished app running in a grid of DSS hosts (my team was working hard on this, last months).

Incidentally, you can read more about use cases applied in the real world using CCR/DDS, in Arvindra Sehmi’s post:

CCR/DSS Use Cases in the Enterprise

So many ideas…. only one life…. Should I begin to parallized myself? ajlopez-in-a-grid…. ;-)

Angel “Java” Lopez
http://www.ajlopez.com/en

January 18, 2008

QCon London 2008

I’ve received an email, from Floyd Marinescu, announcing this “mega” conference. They’ll cover all-about-software-development: agile, DSLs, SOA, SaaS, Cloud computing (I guess grid computing related), .NET, Java, Ruby, Rich Client, Scrum, XP, F#, REST…. It will be the DisneyWorld of all software developers! ;-)

Here’s the announce:

You are receiving this email because you opted-in to receive notifications related to QCon London, from the QCon London website. QCon London is taking place in just 8 weeks, March 12-14 and the conference editorial is nearing final. Since our last update in December, a number of important changes have been made to the conference:

  • Google, Yahoo!, Amazon, Salesforce.com now presenting in the Cloud Computing Track
  • MySpace.com, eBay, Magus confirmed in the Architectures you’ve always wondered about Track
  • XP founder Kent Beck, and Analysis Patterns & Refactoring Author Martin Fowler keynoting
  • Banking Architectures Track adds sessions from Merrill, Betfair, Credit Suisse
  • GoF Patterns Author & Eclipse Architect Erich Gamma presenting
  • and much more…

QCon is an enterprise software development conference for team leads, architects, and project managers covering Architecture & Design, Java, .NET, Ruby, SOA, Agile methodologies and other timely topics such as DSLs, cloud computing, and bank/finance architectures. Last year’s QCon London had almost 500 registrants, and was covered very heavily in blog space see QCon London blogger coverage & key take aways).  

The track themes for QCon London & track hosts are as follows:
Architectures You’ve Always Wondered About -  Hosted by Redmonk’s James Governor
The last 2 QCon’s featured: Amazon, Linked-In, Yahoo!, eBay, Second Life, and Orbitz architecture case studies
Domain Specific Languages in Practice – Hosted by ThoughtWorks’ Neal Ford
Takes DSLs to the next level by practical applications and tools that are useful today.
Effective Design
Translate a set of abstract ideas into working and functional software in an effective way.
Architectures in Agile – Hosted by POSA author Kevlin Henney
How to integrate the trade-offs related to aspects such as performance, security, scalability and modifiability into an agile process
Banking: Complex high volume/low latency architectures  – Hosted by John Davies & Alexis Richardson
The latest innovations as well as time-proven best practices that architects of banking & finance systems need to know.
The Cloud as the New Middleware Platform – Hosted by EAI Patterns Author Gregor Hohpe
Is the internet becoming the computer?
Implementing Scrum and XP- Hosted by Patterns Almanac author Linda Rising
Leading practitioners will present and explain how Scrum and XP are implemented in the most effective way.
Java Emerging Technologies – Hosted by Java Concurrency Author/spec lead Brian Goetz
The previous QCon covered: JRuby, Grails, Server-side OSGi, DSL development, Batch Processing
.NET in the Enterprise – Hosted by Matt Deacon
.NET has brought Microsoft’s platforms into many business-critical applications, back-office, and server-side solutions.
Programming Languages of Tomorrow
Erlang, F#,, Intentional and Scala. How can we best leverage them in our next software project?
SOA, REST and the Web – Hosted by InfoQ’s Lead SOA Editor Stefan Tilkov
REST & SOA, Internet Scale Integration, REST & WS Myths
Browser & Emerging Rich Client Technologies – Hosted by InfoQ lead RIA/Java editor Scott Delap
Silverlight vs. JavaFX/Consumer JRE vs. Adobe Flex/AIR vs. Google’s Ajax RIA stack
The Rise of Ruby
Learn how to best take advantage of what Ruby has to offer
The first two QCon were well received, below are some comments from bloggers who attended our most recent QCon:

  • David Forbes – Exhilirated after gorging on brain candy this week, I have a moment to reflect on what just happened. QCon was the right place to be. I can’t imagine where else I would have rather been. If I had the week to do again, I would probably march right down to the Westin…again.
  • Denis Bregeon – I was very happy with it. Most of the talks tickled my imagination and that is the primary thing I was looking for. Many others gave me details on more technical subjects that I wanted to learn about.
  • Srini Penchikala – I was at the QCon conference in San Francisco last week. It was a great experience to be there. I learned a lot not only from the presentation speakers and panelists but also from the attendees who came from different countries (England, Syria, Australia to name a few) and companies.
  • Alex Olaru – Great conference: excellent speakers, very relevant topics, just enough product pushing without it becoming annoying. All in all a conference I would highly recommend to any architect or project manager.
  • Ola Bini – Last week I attended QCon San Francisco, a conference organized by InfoQ and Trifork (the company behind JAOO). It must admit that I was very positively surprised. I had expected it to be good, but I was blown away by the quality of most presentations.
  • Martin van Vliet – All in all, this was a good conference and more than enough reason to look forward to the next QCon, next year in London.
  • Pete Lacey – A wonderful conference made better by being able to meet many people face to face for the first time…

See also past QCon/JAOO talks available online on InfoQ:

Registration for the 3 day conference is 1180£ until Feb 22nd, and 1220£ after March 11th. The conference will be held at the Queen Elizabeth II Center, like last year.  Join us at QCon London!

Angel “Java” Lopez
http://www.ajlopez.com/en

December 21, 2007

The role of an Architect: call for papers

Filed under: Software Architecture — ajlopez @ 10:04 am

The Microsoft Architect Journal is preparing an issue 14 about The role of an architect. They are calling for papers about that subject, to be selected and published. More info at Simon Guest blog (the only guy at Microsoft allowed to login as guest…. ;-) :

Microsoft Architecture Journal Issue 15 – Call For Papers

If you think you could write a great article for the Journal, here is your chance! Follow the instructions below to send an abstract before the cut-off date and you could see your thoughts and ideas shared with over 60,000 readers, translated in 5 languages, and distributed at multiple conferences around the world!

The end date for abstract submissions is January 14th 2008. It is the opportunity to share your ideas and knowledge about that great job, the software architect life.

More information about writting for the Microsoft Architect Journal:

Become a Contributor

If you don’t read the journal, please, go and read it. There are lot of interesting articles, and it’s not only focused on Microsoft technologies.

Thanks to Ezequiel Jadib, for sending me this info.

Angel “Java” Lopez
http://www.ajlopez.com/en

December 26, 2006

SOI, Service Oriented Infraestructure, at Microsoft

Filed under: .NET, Software Architecture — ajlopez @ 9:28 am

The architecture site at Microsoft is an interesting site to visit, to every software architect, using or not MS technologies:

 http://msdn2.microsoft.com/en-us/architecture/default.aspx

(Microsoft site is in constant flux, so, today this is the URL for architecture, tomorrow, who knows… :-)

There is a section with topics under Special Coverage

http://msdn2.microsoft.com/en-us/architecture/aa982688.aspx

where you’ll found information about:

Software as a Service
Service Oriented Architecture (uauuu….. now Microsoft use the term “Enterprise Bus”….)
Service Oriented Architecture
Service Oriented Infraestructure
Software Factories
Security by Design

A new product from Redmond, is codenamed Alchemy, see:

Service-Oriented Infrastructure (SOI)

Alchemy Business Overview

Line-of-business applications have often been designed and built in an isolated and monolithic manner, making it difficult to share information between applications. Over a period of more than four years, Microsoft Information Technology (Microsoft IT) has addressed this problem, using web services to integrate line-of-business application services and data. This paper provides an overview of Microsoft IT’s solution, codenamed Alchemy.

Alchemy Technical Overview

Microsoft’s enterprise services needed the support of a true enterprise architecture. Incompatible development standards, lack of change management processes, limited operations management, and insufficient automation were problems in need of an enterprise, production ready solution. Microsoft IT developed the Alchemy infrastructure upon which an enterprise reference service architecture could be constructed. The initial architecture integrated business data from four core Microsoft line-of-business applications. When fully deployed, Alchemy managed Microsoft IT’s fifteen critical line-of-business application services and data.

There is a Alchemy Common Platform (ACP), that, according to MS “provides a secure, consistent, enterprise-wide infrastructure for developing, deploying and managing services across a diverse range of Microsoft business applications.

There are many interesting points to comment. But now, I comment that your application must be ACP-enabled to be viewed as a Service Provider for the rest of Alchemy. You must:

- Add the ACP required DLLs to your project
- Update the application configuration file with ACP entries
- Insert ACP start code, to initialize the application
- Adjust IIS virtual directory settings
- Add ACP-enabled verification

Then, your application will be discovered as a managed service provider, that are monitored services, and expose capabilities via interfaces.

The initial installment of Alchemy supports Web Services, but in the future, it will adopt full Windows Communication Platform (WCF).

Angel “Java” Lopez
http://www.ajlopez.com/en

Blog at WordPress.com.