DevLOVE Beautiful Development - 第一幕 陽の巻

  • 4,476 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
4,476
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
45
Comments
1
Likes
15

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. DDD Pt.IIBuilding Blocks ~DDD ~ ( ) - tricreo.jp / Jiemamy Project - jiemamy.org 2011.04.09 @
  • 2. • (@daisuke_m)• Jiemamy / java-ja• Apache Mahout• Java / OO / DDD•
  • 3. works• @IT — Jiemamy• • Java • Java• Java: The Good Parts ( )• DDD ( )
  • 4. DDD http://d.hatena.ne.jp/daisuke-m/20110407/1302156870• Jiemamy Project••• DDD•• Jiemamy version 0.3• baseunits library (timeandmoney)
  • 5. Jiemamy• ER • Eclipse (UI ) • DB , SQL ( ) • SQL… • XML I/O, DDD ( )
  • 6. Agenda• DDD overview• Isolating the Domain• Model• LifeCycle
  • 7. §0 DDD overview• DDD • GoF • PoEAA
  • 8. DDD PATTERNS• STRATEGY • OPEN HOST SERVICE• COMPOSITE • CORE DOMAIN• BOUNDED CONTEXT • GENERIC SUBDOMAINS• CONTINUOUS INTEGRATION • DOMAIN VISION STATEMENT• CONTEXT MAP • HIGHLIGHTED CORE• SHARED KERNEL • COHESIVE MECHANISMS• CUSTOMER/SUPPLIER DEVELOPMENT TEAMS • SUGGESTED CORE• CONFORMIST • ABSTRACT CORE• ANTICORRUPTION LAYER • EVOLVING ORDER• SEPARATE WAYS • SYSTEM METAPHOR• OPEN HOST SERVICE • RESPONSIVILITY LAYERS• PUBLISHED LANGUAGE • KNOWLEDGE LEVEL• INTEGRATION • PLUGGABLE COMPONENT FRAMEWORK
  • 9. DDD PATTERNS• UBIQUITOUS LANGUAGE • FACTRIES• MODEL-DRIVEN DESIGN • REPOSITORIES• HANDS-ON MODELERS • SPECIFICATION• LAYERED ARCHITECTURE • INTENTION-REVEALING INTERFACES• THE SMART UI "ANTI-PATTERN" • SIDE-EFFECT-FREE FUNCTION• ENTITIES• VALUE OBJECTS • ASSERTIONS• SERVICES • CONCEPTUAL CONTOURS• MODULES • STANDALONE CLASSES• AGGREGATES • CLOSURE OF OPERATIONS
  • 10. ••••( )
  • 11. • • •
  • 12. Domain or Not••• HISTORY••••
  • 13. • UI• DB•• DB
  • 14. ••••
  • 15. • →• →• ® • •• ® • •
  • 16. •••
  • 17. •• •• Model Driven Design ( ) •
  • 18. Model or Not• LibHTTP • User• Search • File• FacebookLogin • String• Translation • StringBuilder• FoobarLogic • YearMonth
  • 19. §1•• • • UI
  • 20. LAYERED ARCHITECTURE•• ;•
  • 21. Jiemamy DiagramEditor TableView DbObjectEditPart maven-jiemamy-plugin UI jiemamy eclipse plugin ExecuteMojo Application jiemamy-diagram JmDiagram JmNode / JmConnection SqlStatement jiemamy-sql Domain Token JmTable / JmView JmColumn jiemamy-core JmForeignKeyConstraint woodstoxSqlExecutor / UUIDProvider XMLInputFactory Infrastructure XMLValidationSchema jiemamy-commons apache commons
  • 22. THE SMART UI "ANTI-PATTERN"• DDD• •• light MDD
  • 23. UI DBUser#save(); → DBtoString() ! "<span>...</span>"
  • 24. §2••• 3 • ENTITY (E) • VALUE OBJECT (VO) • SERVICE
  • 25. • •• • Table knows Columns / Column knows Table • Emp knows Dept / Dept knows Emps
  • 26. class Emp { class Dept { String name; String name; Dept dept; List<Emp> members;} } Dept tech = new Dept(" "); Emp kato = new Emp(" "); kato.setDept(tech); tech.addMember(kato);
  • 27. • Declaration & Reference• Repository
  • 28. ENTITY (E)••• vs• (SE) vs ( )
  • 29. • 31 32 31 (File / DB) 32 (On Memory)•• Serialize / Deserialize clone…
  • 30. ENTITY• Table • Order• Column • Customer• ForeignKey• Employee• Department
  • 31. ENTITY••• ID• equals hashCode ID
  • 32. • ENTITY• ID• • •
  • 33. EColumn col = ...; // ← ENTITYtableFoo.addColumn(col);tableBar.addColumn(col);// somethingtableFoo.getColumn(...).setName("AAA");tableBar
  • 34. • ID• (v0.2)•
  • 35. VALUE OBJECT (VO)••• new String("foo") vs new String("foo")• man.getName(): String• equals hashCode property
  • 36. VALUE OBJECT• Integer• BigDecimal• String• Color• Date / TimePoint• Status (OPEN / PROGRESS / CLOSED)
  • 37. VALUE OBJ.••• Immutable • Flyweight
  • 38. SERVICE• E VO• E VO Service • E VO •
  • 39. SERVICE•• (UL)•• →
  • 40. • E / VO• E / VO• E / VO • Transaction Script •
  • 41. • Infrastructure Service ( ) • E-mail •• Application Service • Excel export •• Domain Service ••
  • 42. MODULE••
  • 43. Java package•• 1•
  • 44. MVC• com.example.foobar •com.example.foobar • model • foo • FooModel • FooModel • BarModel • FooView • view UL • FooController • FooView • bar • BarView • BarModel • controller • BarView • FooController • BarController • BarController
  • 45. MVC• com.example.foobar •com.example.foobar • model • foo • FooModel • FooModel • BarModel • FooView • view UL • FooController • FooView • bar • BarView • BarModel • controller • BarView • FooController • BarController • BarController
  • 46. §3 LifeCycle• Object • new GC • INSERT DELETE•
  • 47. §3 LifeCycle
  • 48. E• LifeCycle Object LifeCycle• User• JVM
  • 49. AGGREGATE•• …
  • 50. •• Table• Column Entity• Column Table• ObjColumn → Table
  • 51. FACTORY••• new• Object Object•
  • 52. • Obj.• Object LifeCycle• • Object
  • 53. Obj.• • Obj. • Obj.• Factory Obj.
  • 54. REPOSITORY• • • • • Repository
  • 55. • Entity LifeCycle• LC Entity• new • On Memory Collection • Database
  • 56. Repos. Collection• DB• Repository Collection• store / delete / find (resolve) ...
  • 57. Declaration & ReferenceCREATE TABLE FOOBAR ( FOO INTEGER, BAR VARCHAR(32), Decl. = Entity PRIMARY KEY (FOO), FOREIGN KEY (BAR) Ref. = VO (ID) REFERECE BAZ (QUX)); Table has-a Column(s) and ... PrimaryKey has-a ColumnReference
  • 58. • /• ENTITY / VO / SERVICE• FACTORY / REPOSITRY• DDD