rights reserved. About me Masao Kanamori Ø Title/Role : PACE(Prototyping and Cloud Engineering) Team Solutions Architect Ø Favorite avengers: Hawkeye: Clint Barton
rights reserved. Domain Driven Design (DDD) Is a method to reduce complexity in large scale systems a) by reflecting the business domain in the system b) and decomposing it using Loose Coupling / High Cohesion principles Business Domain Model System reserve air ways itinerary user modeling reflect
rights reserved. Difficulties in implementing DDD Especially for beginners , 1. There are too many practices!! 2. Where should we start coding? 3. How can we combine DDD and frameworks? Can someone help me? Amazon Q Developer I’m here!!
rights reserved. Amazon Q Developer Reimagines the experience across the entire software development lifecycle (SDLC) Helps developers and IT professionals build and manage secure, scalable, and highly available applications Helps you write, debug, test, optimize, and upgrade your code faster Converses with you to explore new AWS capabilities, learn unfamiliar technologies, and architect solutions Amazon Q is built with security and privacy in mind from the start, making it easier for organizations to use generative AI safely.
rights reserved. Discuss about aggregate Auction created Start/end date set Item evaluated Customer tendered Customer won Create Auction Set start/end date Evaluate item Auction Tendered item Item Customer lose Determine Result Customer joined Join auction List item Auction context Business rules / invariants •Item can be listed to Auction •When Item have already been listed on the other Auction, it should be error etc etc… Item listed
rights reserved. Ask Amazon Q to write model •Item can be listed to Auction •When Item have already been listed on the other Auction, it should be error Write class diagram for below scenario. Approach: DDD practice like Entity, Value Object , Repository, Domain Service and Application Service. Tool: PlantUML Scenario: •Item and Auction are aggregates <Prompt for Amazon Q> Amazon Q Developer <UMLs (using PlantUML)>
rights reserved. Generate blueprint code from model <UMLs (using plantUML)> Amazon Q Developer Write Java code with test according to this sequence diagram class Item { private ItemId itemId; private String title; … } class Auction { … } class ItemAppService { … } <Blueprint codes>
rights reserved. Points - You can use those diagrams and codes that are generated by Amazon Q as an example of how to implement tactical design of DDD. - Gen AI is not perfect and nondeterministic. - You need to / can adjust those diagrams and codes when you needed.
rights reserved. Next Step -> TDD • Test Driven Development repeats § ①Write a test that fails § ②Write minimal code necessary to pass the test § ③Refactor Amazon Q Developer Yes! I can support to write test, code to pass the test , and refactor.
rights reserved. Difficulties in implementing DDD Especially for beginners , 1. There are too many practices!! 2. Where should we start coding? 3. How can we combine DDD and frameworks?
rights reserved. Amazon Q can support that… ? OK, I’ll ask that Amazon Q! Where should I put domain models of selected sequence diagram in this project? Amazon Q Developer ❌
rights reserved. By default… Amazon Q Developer doesn’t know what framework is used. Only the file that is currently open in your IDE is used as the context.
rights reserved. Introduce @workspace Beta Using @workspace in your prompt, Amazon Q Developer can use workspace as context. You can refer this blog to know more details like how it works. https://go.aws/46PrOhL
rights reserved. Summary • You can use Gen AI assistant as a teacher of DDD • Notice! Even teacher have mistakes • Letʼs go through trial and error!! Itʼs important for • finding good prompt • to become familiar with the DDD practice • The right tool for the job • For simple application, DDD may be too much • Amazon Q Developer inline code generation will help you