Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A love story starring Symfony and Domain-Driven...

A love story starring Symfony and Domain-Driven Design

This is the story of how I discovered Domain-Driven Design, what happened when I tried to apply it to a Symfony framework project, and what are the key takeaways.

Talk given at SymfonyCon Amsterdam 2019, unconference

Romaric Drigon

November 22, 2019
Tweet

More Decks by Romaric Drigon

Other Decks in Programming

Transcript

  1. What went wrong? 2 pre-requisite for DDD: • an itera)ve

    process is in place • domain experts are available and coopera)ve
  2. Automa'c glossary $metadatas = $this->doctrine->getMetadataFactory()->getAllMetadata(); foreach ($metadatas as $metadata) {

    $fields = []; foreach ($metadata->getFieldNames() as $fieldName) { $property = $metadata->getReflectionClass()->hasProperty($fieldName) ? $metadata->getReflectionClass()->getProperty($fieldName) : null; $fields[$fieldName] = [ 'doc' => $property ? $this->cleanPhpDoc($property->getDocComment()) : null, 'isIdentifier' => $metadata->isIdentifier($fieldName), 'name' => $fieldName, 'isNullable' => $metadata->isNullable($fieldName), 'type' => $metadata->getTypeOfField($fieldName), ]; } $entities[] = [ 'doc' => $this->cleanPhpDoc($metadata->getReflectionClass()->getDocComment()), 'name' => $metadata->getReflectionClass()->getShortName(), 'properties' => $fields, ]; } $doc = $this->twig->render('doc.html.twig', ['entities' => $entities]);
  3. Does Symfony love DDD? Doctrine ORM ❤ Messenger ❤ Workflow

    ❤ App structure ⁉ Validator ⁉ Forms !
  4. “A pa&ern is not a cookbook. It lets you start

    from a base of experience to develop your solu;on, and it gives you some language to talk about what you are doing.” — Eric Evans, Domain-Driven Design
  5. Final word Read books! You can improve a lot quality

    of your so4ware by improving processes and communica9on around Do not be a DDD groupie