views:

425

answers:

6

Just for discussion, to me it seems that 2 different terminologies actually are saying the same thing. Is there any tangible differences between this 2 design approaches?

+6  A: 

To me, Domain-Driven Design (DDD) is more "all emcompassing"; where as Use Cases are just a tool that focus on a specific view: how a something responds to stimulus and are used to capture or document behavioral requirements.

To me, the term "domain" is a loaded one - it infers a wider view of all the concepts relevant to a specific problem area.

When describing how parts of the domain interact - specifically how they respond to stimulus then you might use Use Cases.

As far as an approach goes: Use Cases are the "additional" view in the 4+1 Architectural View Model, but they aren't a design approach on their own.

Another distinction is that DDD is often very closely tied to an Object Orientated model or system; in this way DDD captures / respresents (amongst other things) the structure of a system - some thing Use Cases don't do.

Adrian K
But aren't use cases a guided tour through that model that domain-driven-design claims to be building? And doesn't a drive-through case help you find the problems in the DDD that you wouldn't find if you didn't also use some use-cases in your design phase?
Warren P
I'm not sure about UC's being a "guided tour" - although that sounds like a useful concept. A UC focuses on behavioural requirements and is scenario driven - so yes it would certainly help you "test" the domain model, and explain how it works in certain scenarios. I see UC's as a part of a DDD - not an equivalent.
Adrian K
+2  A: 

This is my personal interpretation based on experience.

Use case driven design uses use case as a tool to discover the entity, interface, interaction message and the workflow on how certain business operation is being conducted. This is used often in more analysis or design stage to gather or understand the requirements and establish some initial designs. DDD on the other hand is more oriented toward implementation with strong focus on the domain entity and context. It focuses in more details than the use case in term of defining the model (such as classes, interfaces) and defining its boundary, aggregations, operations and domain specific logic. It generally follows some standard practice on how to approach them in implementation.

DDD is more suitable when you are dealing with project that target a specific domain such as accounting, engineering, where you can foresee that some or most of the models in the business can have complex interrelation and embodied logic. Choosing between use case driven design or DDD also depends on the availability of the domain experts. If you have stakeholders with business needs (only some access to the domain experts), then use case driven design is more suitable if compared to DDD.It is high risk to adopt DDD if you do not have domain experts participating directly in the development of the project.

Personally I think they can both complementing each other in some projects where you can start with use case driven design and approach the detail design and implementation using DDD approach

Fadrian Sudaman
+4  A: 

Use Cases focus on Users, Actions, and Processes. This is great from a business perspective, because everyone can see an abstracted view of what the system will provide.

DDD focuses on creating software that solves problems. The 'Who can solve this?' and the 'What process will they follow?' come afterwards.

DDD really gets to the core problems earlier in the design process, and helps you structure your solution (i.e. identifying Entities, Value Objects, Respositories, Domain/Application/Infrastructure services, Bounded Contexts, Specifications, etc).

Use Cases don't cater for this at all, or how to manage your development (Anti-Corruption Layers, Separate Ways, etc)

In my experience, DDD offers more flexibility (changing requirements anyone?), and provides the foundations for your Use Cases. Once you've got your Domain Model in place, Use Cases can be implemented using Controllers/Workflow Engines/UIs that connect with your Domain Model. Quite often, I've identified gaps in business requirements just by building Domain Models.

And having attended a talk by Ivar Jacobsen some years ago, I would also say that DDD is better suited to Agile.

Vijay Patel
Exactly, DDD is about modelling the business world as accurately as possible. If that model is accurate, then supporting Use Cases, and supporting change becomes a lot easier. But, even if your model is not perfect first time, a clean model is much easier to change and fix than a solution lacking in such a foundation.
saille
In a recent talk (http://domaindrivendesign.org/node/198) Eric Evans highlights that your first domain model will almost always be wrong, and it's more likely to be correct on the _last_ day of your project! Knowing that the model *will* change over time, flexibility is absolutely crucial.
Vijay Patel
So use-cases aren't "in the driver seat" from a metaphorical point of view, though the use-case is very important as a piece of the whole? Isn't this a case where DDD and UCDD are just elevations of one aspect of a whole software methodology, giving one or the other an artificial primacy that NEITHER truly enjoys?
Warren P
I agree to large extent. However when you start by DDD, first you have to discover the Domain using Ubiquitous Language and by setting some Context. This might be non-trivial and I think that Use Cases are a great tool for this. By describing use cases, you exercise the Ubiquitous Language and set some Context. After writing some use cases you can start extracting the Domain Model. This is essentially similar to ideas of Dan North on BDD+DDD, but uses use cases instead of user stories.
Gabriel Ščerbák
@Gabriel - If - during the process of building the Ubiquitous Language - I find that the customer is more comfortable with Use Cases, I would definitely use them. Whatever the approach, having the right conversations with the right people is the goal.
Vijay Patel
+1  A: 

Domain-driven design essentially tries to act as if you knew all the possible use-cases in advance. By definition, the "problem" domain is the set of specific problems that are considered members of that domain.

Ira Baxter
Ouch. So you don't like Domain Drive Design then? Is it considered harmful?
Warren P
I didn't mean this in a negative sense. I think DDD is a really good idea. But the hard part really is determining the "complete" set of use-cases in advance. Usually what happens is you get an approximation (you can only have so much clairvoyance), implement that, and then you discover cases you didn't consider. The DDD guys don't talk much about *evolution* of a domain after implementation, but it always happens. I don't have any good answers for this. Non DDD IMHO is actually worse, though... because you haven't thought through the general use cases.
Ira Baxter
A really good example where DDD will work well is when you are reengineering an old product using new architecture and dev platform. I was involved in reengineering of a large domain specific product (develop about 15 years ago) from C to .NET using DDD
Fadrian Sudaman
+2  A: 

Use case driven approach works fine if you have only one client for product and client has already told you about all problems that needs to be solved by product. This is possible in service oriented companies in general. It becomes difficult to manage when you have multiple clients for same Product. This happens generally in Product developing companies. In such cases (Product Driven Companies ) DDD comes to handy. You develop a product using DDD (you call it as base).Then check, are all use cases for new client are applicable, if not then form a layer over base for client specific changes.

YoK
I don't think use-case based design needs to assume that the use cases define all the possible uses: they may merely be representative uses.
poolie
+1 for pointing out the idea that some people are developing a product used by 100,000,000 people they can not individually interview and discuss things with. Nevertheless, you can use Use Cases there too. You just have to do some role-playing (think like the customer), and dog-fooding (using your own product), to come up with good ways to use Use Cases in your Product driven process.
Warren P
+1  A: 

I'm not expert on this, and these terms can be fuzzy, and mean different things to different people. But..

I would have said that a Domain Design was where there was an existing system (paper based, manual, whatever) and the software models the actual entities in the system. So in a Library system you look at a library, and see that there are books, and shelves, and cupboards, and rooms. And based on that you model the real domain in the software.

With Use case you start with 'what are we trying to do' It may be that you don't need different rooms in your model, because they are not needed in the use cases. That makes your system simpler (and less error prone) but if you are not modelling the 'real world' then you lose some flexibility.

Jon