citerus / dddsample-core

This is the new home of the original DDD Sample app (previously hosted at sf.net)..

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class under the domain/model path is "Anemia model"?

johnlee175 opened this issue · comments

Like:
class Cargo { public TrackingId trackingId() { return trackingId; } public Location origin() { return origin; } public Delivery delivery() { return delivery; } public RouteSpecification routeSpecification() { return routeSpecification; } }

Additional, I‘m newer, and I found Entity interface, why no Aggregate interface?

The getters listed allow for private setters.

  • Location may only be set in the ctor.
  • Delivery is set in either the ctor or via specifyNewRoute().

This pattern relates to anti-corruption of the domain model.

In this example the aggregates are implied rather than explicit via interfaces. A matter of preference I suppose.

The domain layer is the heart of the software, and this is where the interesting stuff happens.
	There is one package per aggregate, and to each aggregate belongs entities, value objects, domain events,
	a repository interface and sometimes factories.

The domain layer is the heart of the software, and this is where the interesting stuff happens.

In this example the aggregates are implied rather than explicit via interfaces. A matter of preference I suppose.

The domain layer is the heart of the software, and this is where the interesting stuff happens.
	There is one package per aggregate, and to each aggregate belongs entities, value objects, domain events,
	a repository interface and sometimes factories.

The domain layer is the heart of the software, and this is where the interesting stuff happens.

I see, thanks very much!

The getters listed allow for private setters.

  • Location may only be set in the ctor.
  • Delivery is set in either the ctor or via specifyNewRoute().

This pattern relates to anti-corruption of the domain model.

specifyNewRoute() is ok. But here( application layer),
CargoInspectionServiceImpl.java:

public class CargoInspectionServiceImpl implements CargoInspectionService {
// ...
    if (cargo.delivery().isMisdirected()) {
      applicationEvents.cargoWasMisdirected(cargo);
    }

    if (cargo.delivery().isUnloadedAtDestination()) {
      applicationEvents.cargoHasArrived(cargo);
    }
// ...
}

is the following approach bad? (Law of Demeter, Encapsulate logic to the target object)

public class CargoInspectionServiceImpl implements CargoInspectionService {
// ...
    cargo.misdirectedIfNeeds(); // and publish event in domain
// ... or
    if (cargo.isUnloadedAtDestination()) { // should application know delivery?
      applicationEvents.cargoHasArrived(cargo);
    }
// ...
}