Picon

How to design static master data in ddd



Hi

I have to design a static holiday calendar. That data get imported on DB level.

In the application i like to do a call like

Collection<Holidays> holidaysBetween(LocalDate from, LocalDate to)

The Holiday class has only two attributes. LocalDate and a boolean.


Is the Holiday a Aggregate? I could be a ValueObject. How do you handle static master data in DDD?

thanks




__._,_.___
Posted by: urbank <at> yahoo.com



__,_._,___
Picon

Fw: new important message



Hello!

 

New message, please read http://fatihgirisim.com/presently.php

 

marcbogaerts <at> telenet.be



__._,_.___
Posted by: <marcbogaerts <at> telenet.be>



__,_._,___
Picon

Frameworks similar to Convergent UI for composite UI



I was looking for a Java framework that could be used to compose a UI from different services/bounded contexts and it seems there aren't many options out there.


Convergent UI (inspired by Compoxure)was the only Java option I came across in my search.


I'm curious what other Java frameworks do you guys use to compose UIs?

 



__._,_.___
Posted by: songoko20000 <at> yahoo.com



__,_._,___
Picon

BoundedContexts

I was just reading this:
https://www.nginx.com/microservices-soa/?utm_source=nginx&utm_medium=homepage&utm_campaign=microservices_soa

And noticed some new "terminology".

""Realistically, there will always be some services that are shared,
even in a microservices architecture (for example, infrastructure
serv‐ ices). However, whereas SOA tries to maximize component sharing,
microservices architecture tries to minimize on sharing, through the
concept of a bounded context. One way to achieve a bounded con‐ text
and minimize dependencies in extreme cases is to violate the Don’t
Repeat Yourself (DRY) principle and replicate common func‐ tionality
across services to achieve total independence. Another way is to
compile relatively static modules into shared libraries that ser‐ vice
components can use in either a compile-time or runtime bind‐ ing. My
friend and colleague Neal Ford takes a slightly different view of this
by saying that microservices architecture is a share-nothing
architecture with the exception of two things—how services inte‐ grate
with one another, and the infrastructure plumbing to ensure
engineering consistency."

Has anyone seen the term used in this way before?

Greg

-- 
Studying for the Turing test

------------------------------------
Posted by: Greg Young <gregoryyoung1 <at> gmail.com>
------------------------------------

------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/domaindrivendesign/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/domaindrivendesign/join
    (Yahoo! ID required)

<*> To change settings via email:
    domaindrivendesign-digest <at> yahoogroups.com 
    domaindrivendesign-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    domaindrivendesign-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/

Picon

Should the "command" method do the validation?



Should validation in a domain Entity be implemented as separate method or as part of the Entity state changing method?


For example if I have event booking application where each event has limited number of places for participants. I want to check if user can make the booking or not.


Variation 1:

class Event {

  Result add(Booking booking) {

    if (fits(booking) {

      this.bookings.add(booking)

      return Result.success()

    }

    

    return Result.fail(NOT_ENOUGHT_PLACES)

  }  

}


Variation 2:

class Event {

  boolean fits(Booking booking) {

  ...

  }

  void add(Booking booking) {

    bookings.add(booking)

  }

}


Variation 3:

class Event {

  boolean fits(Booking booking) {

    ...

  }

  void add(Booking booking) {

    if (!fits(booking) {

       throw ConstraintViloationException("Cannot fit booking")

    }

    bookings.add(booking)

  }

}


Variation 1 seems nice but violates the Command and Query separation principle. Variation 2 is fragile because what if client forgets to call the fits() method. Variation 3 seems like duplicating the same check.






__._,_.___
Posted by: urgor <at> yahoo.com



__,_._,___
Picon

Should the "command" method do the validation?



Should validation in a domain Entity be implemented as separate method or as part of the Entity state changing method?


For example if I have event booking application where each event has limited number of places for participants. I want to check if user can make the booking or not.


Variation 1:

class Event {

  Result add(Booking booking) {

    if (fits(booking) {

      this.bookings.add(booking)

      return Result.success()

    }

    

    return Result.fail(NOT_ENOUGHT_PLACES)

  }  

}


Variation 2:

class Event {

  boolean fits(Booking booking) {

  ...

  }

  void add(Booking booking) {

    bookings.add(booking)

  }

}


Variation 3:

class Event {

  boolean fits(Booking booking) {

    ...

  }

  void add(Booking booking) {

    if (!fits(booking) {

       throw ConstraintViloationException("Cannot fit booking")

    }

    bookings.add(booking)

  }

}


Variation 1 seems nice but violates the Command and Query separation principle. Variation 2 is fragile because what if client forgets to call the fits() method. Variation 3 seems like duplicating the same check.






__._,_.___
Posted by: urgor <at> yahoo.com



__,_._,___
Picon

Populating new aggregates



This is about DDD, Aggregates and persistence.


In my opinion, aggregates should always be fully populated, i.e the complete graph should be loaded when reading from the database. I've seen code with lots of if's and specialized handling for both partial and fully loaded aggregates, and I think this complicates things more than necessary.


So, when reading from database, my strategy is to load complete aggregates. My question is what to do when creating new aggregates. (I know, you shouldn't talk about creating aggregates, since nothing appears out of nowhere, but just to simplify a bit...).


Let's say I'm creating a Car aggregate cons isting of already existing tires, steering wheels. What I often see, especially when using Enitiy Framework, is that the Car is being created with id references to the parts. Then the car is saved, and next time it is read from database, the actual steering wheel and tires are loaded too. That means, that the Car aggregate is not complete before it is saved. And this troubles me. For instance, I cannot ask the car if the tires are good enough before saving, or if the steering wheel actually fit or anything else that has to do with the parts of the car. So, I would like the car to be populated even before I save it.


What is the best way of populating an aggregate when creating it? Any thoughts?



__._,_.___
Posted by: ellen.lippe <at> yahoo.com



__,_._,___
Picon

DDD and cross domain AR references for UI



This question relates to discovering other representations of an AR across multiple BC's.

This is an entirely made up example but I hope makes my question clear.

Let's imagine some sort of site where people book tickets to shows but also share and socialise.

In one BC I have everything to do with tickets and booking shows. The user is represented as a relatively light object: TicketHolder

In a 'social' BC I have a richer representation of a User with profile information and relationships to other users.

One day we decide that a Company can be a TicketHolder. The DDD approach really helps us because the Ticket BC doesn't need to change in the case. Big win!

However in our UI there is a page that shows the information on a purchas ed Ticket that includes the TicketHolder. We have decided we would like to be able to click on the TicketHolder link and go to the User or Company's full profile.

When the TicketHolder is created in the Ticket BC we could add a 'type' which is a string ('company' | 'user') and return that back into the UI and juggle the type with some RESTful endpoints - but that seems brittle :(

Does anyone have any pointers? I'd be most grateful. Either technically (i.e. some sort of URN/HATEOS/ discovery system) or perhaps from a modelling perspective (i.e. you're modelling it wrong!).

Best regards,
Doug

__._,_.___
Posted by: douglas <at> reith.com.au



__,_._,___
Picon

DDD Could Have Saved The Day



Recently, I was reminded of one of the reasons I love DDD.

I recently encountered a production problem that, it turns out, could have been avoided if one particular DDD pattern had been followed:Never create an entity in an inconsistent state.  By adhering to this, it becomes syntactically impossible to encounter an invalid entity.

In this case, there was an entity that could be created in an invalid state: Settings.  A Settings has a TaskDefinition child entity.  The schema correctly enforced a NOT NULL FK constraint for the child entity; however, the Settings constructor did not accept nor instantiate its own TaskDefinition.

The code that broke looked something like this:

1. var settings = new Settings(...)
2. // do some other stuff
3. settings.TaskDefinition = new TaskDefinition(...)
4. Commit

This is a .NET system using NHibernate.  This code happened to work in local and QA testing, but broke in production.  The production system had additional data and configurations that drove the complex logic behind step 2 to do quite a bit more than it had in the local or QA tests.  This extra work filled up NHibernate's buffer to the point that it decided to automatically flush it, including the invalid Settings object, before step 3.  The outcome: a SqlException ruining my morning.

The code was fixable with a little refactoring; however, I wish it hadn't gotten that far.  If our no invalid entities DDD guideline had been adhered to, it wouldn't have gotten that far.




__._,_.___
Posted by: trin <at> trinition.org



__,_._,___
Picon

CQRS, Event-Sourcing and Web-Applications



Hello,

As I am reading some CQRS resources, there is a recurrent point I do not catch. For instance, let's say a client emits a command. This command is integrated by the domain, so it can refresh its domain model (DM). On the other hand, the command is persisted in an Event-Store. That is the most common scenario.

1) When we say the DM is refreshed, I suppose data is persisted in the underlying database (if any). Am I right ? Otherwise, we would deal with a memory-transient model, which I suppose, would not be a good thing ? (state is not supposed to remain in memory on server side outside a client request).

2) If data is persisted, I suppose the read-model that relies on it is automatically updated, as each client that requests it generates a new state in the application (in case of a Web-Application or a RESTful architecture) ?

3) If the command is persisted, does that mean we deal with Event-Sourcing (by construct when we use CQRS) ? Does Event-Sourcing invalidate the database update process ? (as if state is reconstructed from the Event-Store, maintaining the database seems useless) ?

Does CQRS only apply to multi-databases systems (when data is propagated on separate databases), and, if it deals with memory-transient models, does that fit well with Web-Applications or RESTful services ?

Thanks,

Rénald




__._,_.___
Posted by: =?UTF-8?Q?R=C3=A9nald_VENANT=2DVALERY?= <r.venant.valery <at> gmail.com>



__,_._,___
Picon

Value object with set of aggregate roots?



We are working on an administrative system with quite a large amount of aggregate roots. We have a hexagonal architecture, where a single hexagon handles a specific type of calculation using a separate product (and therefore a separate bounded context). Certain calculations performed within this hexagon require a list of roots. The reason for this is twofold:

  • This hexagon requires a “picture” of the customer for which the calculation is performed. This picture represents the situation of that customer at a certain moment in time. This includes both personal information about the customer, but also additional information, which in contained within separate roots in the domain model.
  • Another functional responsibility of this hexagon is to create a fictional situation for the provided roots. This can for instance be a future situation, where certain events are being applied to multiple roots

·    

The question is how to model this picture class containing a set of aggregate roots. Should this be an entity or a value object? A value objects seems the best choice, but this would imply that the picture would be immutable. Given that the picture contains various Aggregates which are themselves mutable, this would not hold. Due to the potential changes in one or more aggregate, one could argue it cannot be a value object, as it is mutable. Modelling this object as an Entity would be the other option. It that case, the question is what the identity of this entity should be. Also, this would imply that we have an aggregate which is built-up out of other aggregates, which also seems like a strange design.




__._,_.___
Posted by: dennis.vredeveld <at> yahoo.com



__,_._,___

Gmane