[DevoxxFR2012] Practicing DDD in a Flash – Sculptor, the DDD Code Generator for Java
Ulrich Vachon is a DDD and agile practitioner with experience at software vendors. He promotes expressive modeling and rapid feedback.
This article expands the live coding demo of Sculptor, a DSL-based code generator for DDD applications in Java. Domain-Driven Design is powerful but verbose. Sculptor accelerates bootstrapping while preserving DDD principles. Using a simple DSL, developers define aggregates, value objects, services, and repositories. Sculptor generates Spring, JPA, REST, and MongoDB code.
Sculptor DSL and Code Generation
A live demo built a blog application:
Application Blog {
Module posts {
Entity Post {
@Id String id;
String title;
String content;
@ManyToOne Author author;
}
ValueObject Author {
String name;
String email;
}
Service PostService {
Post save(Post post);
List<Post> findAll();
}
}
}
Sculptor generated entities, repositories, services, controllers, and tests.
Customization with the Gap Mechanism
The gap keyword allows hand-written extensions without regeneration conflicts.
Links
Relevant links include the Sculptor Project at sites.google.com/site/fornaxsculptor and the original video at YouTube: Practicing DDD in a Flash.