command-query-separation

How To Implement The Query Side Of CQS in DDD?

I have implemented the command side of DDD using the domain model and repositories, but how do I implement the query side? Do I create an entirely new domain model for the UI, and where is this kept in the project structure...in the domain layer, the UI layer, etc? Also, what do I use as my querying mechanism, do I create new repositor...

CQRS and CRUD screens

One of the basic tenets of CQRS, as I understand it, is that commands should be behaviour-centric, and have a value in the business or the UL, and not data-centric, ie., CRUD. Instead of focusing on updating a customer, we have commands like CustomerHasMoved. What if you have CRUD screens which are there to correct certain data. For exam...

Communicating Concurrency Conflicts to the Application Layer

When communicating concurrency conflicts to your application layer, is there an alternative to using exceptions that also respects the principle of Command-Query Separation, or are exceptions the best mechanism we have (in languages that support exceptions)? In the bowels of my application, I have optimistic locking logic that executes ...

CQRS - Should a Command try to create a "complex" master-detail entity?

I've been reading Greg Young and Udi Dahan's thoughts on Command Query Responsibilty Separation and a lot of what I read strikes a chord with me. My domain (we track vehicles which are doing deliveries) has the concept of a Route which contains one or more Stops. I need my customers to be able to set these up in our system by calling a...

Good Data Tier Dev & Design: What are the common bad practises in data tier development?

I am currently researching the best practises (at a reasonably high level) for application design for highly maintainable systems which result in minimal friction to change. By "Data Tier" I mean database design, Object Relation Mappers (ORMs) and general data access technologies. From your experiences, what have you found to be the com...

CQS and ASP.NET MVC Actions

Hello, Those who have read about CQS principle know that: CQS states that every method should either be a command that performs an action, or a query that returns data to the caller, but not both. Speaking of ASP.NET MVC Actions, does CQS indicate that we shouldn't have an Action like this? public PartialView InsertOrder(...

How would one apply command query separation (CQS), when result data is needed from a command?

In wikipedia's definition of command query separation, it is stated that More formally, methods should return a value only if they are referentially transparent and hence possess no side effects. If I am issuing a command, how should I determine or report whether that command was successful, since by this definition the functi...

Abuse of Closures? Violations of various principles? Or ok?

Edit: fixed several syntax and consistency issues to make the code a little more apparent and close to what I actually am doing. I've got some code that looks like this: SomeClass someClass; var finalResult = DoSomething(() => { var result = SomeThingHappensHere(); someClass = result.Data; return result; }) .DoSom...