php - The right way of starting Behat feature/story -
i'm starting bdd , after readings found out goes ddd.
now have domain, institution
have places
, added institution
assignee
user
assigned manager of organization.
i still can't wrap head around how should be, feature sounds like: as assignee of institution must able add places organization
the code i'm thinking (sorry code-first approach) this:
if ($institution->isassignee($user)) { $institution->addplace(/* properties*/); }
now how should write feature , scenarios? should leave as assignee part , leave it? or should there multiple scenarios? how scenario like?
edit:
so left user permission check , started first feature followed specifications of implementation. code found here.
isn't feature simple? of course core of domain does, did not mentioned case in feature place same location not added, have done in institutionspec
?
moving forward: if edit place
of institution, better approach:
$place = $institution->getplace($placeid); $place->editwhatever(/***/);
or
$institution->editwhateverinplace($placeid, /** edits **/);
the check user have permission add place institution
seems another's bounded context
(bc
) problem authorisation
. check done in anticoruption layer
in application layer
outside institution aggregate
querying authorisation bc
create assignee
user have role of "assignee"
.
in bc there assignee
, possible implemented ad value object
have userid
, possible name
.
p.s. bdd
tests should split bc
, furthermore aggregate
.
Comments
Post a Comment