26. What did we see
• build parameters
• build context (on 2 places)
• build domain
• render different data, differently, based
on the domain entity
Wednesday, May 20, 15
29. ..sort of
• most of the bugs I introduced, were on
this behavior of the system.
• This class
• Concepts introduced by this class
• Integration with Confluence API
• especially ‘null’s
Wednesday, May 20, 15
31. What IF...
C’s responsibility
• Given a set of parameters...
• Build Model (service / repository)
• Render Template with model given
• and let other’s to figure out which
template to render
Wednesday, May 20, 15
32. Decorate / Exhibit
Controller
HTTP GET
Domain
View
Exhibit
1) build model
2) render
3) exhibit
View tmpl
4) render
Wednesday, May 20, 15
34. few design decision
done by me
• avoid nulls
• separate Read Model from Write Model
• 1st class collections
• Separated Query and Command
Controller (sort of CQRS)
Wednesday, May 20, 15
35. Domain Entity: Group
<if> ReadOrWriteModel
<if> ReadModel <if> WriteModel
GroupEntity GroupDescrGroupList
Wednesday, May 20, 15
36. Domain Entity: Group
<if> ReadOrWriteModel
<if> ReadModel <if> WriteModel
GroupEntity GroupDescrGroupList
Wednesday, May 20, 15
37. Domain Entity: Group
GroupEntity
* immutable
* final private prop
* behavior rich
GroupDescriptor
* public properties
* tiny behavior
AGroupThatDoes
NotExistYet
AGroup
Wednesday, May 20, 15
38. Domain Entity: Group
<if> ReadOrWriteModel
<if> ReadModel <if> WriteModel
GroupEntity GroupDescrGroupList
Wednesday, May 20, 15
41. Exhibit Characteristics
• Wraps a single model instance
• Is a true Decorator
• Brings together model and context
• Encapsulates the decision about how to
render an object
• May modify the behavior of an object
Wednesday, May 20, 15
45. REST view
HTTP PATH Contr#Action Domain Class
GET /foo(.:format) foos#index FooList
POST /foo(.:format) foos#create FooDescriptor
GET /foo/new foos#new FooDescriptor
GET /foo/:id/edit foos#edit FooDescriptor
GET /foo/:id foos#show FooEntry
PATCH/PUT /foo/:id foos#update FooDescriptor
DELETE /foo/:id foos#delete FooDescriptor
Wednesday, May 20, 15
46. Creating exhibits
public exhibit(ReadWriteModel model){
for_each( exhibit: exhibit_classes ){
if( exhibit.applicableTo( model )
// wrap model to exhibit and
serve exhibit as new model
}
}
Wednesday, May 20, 15
60. Did it work -
in retrospect
• No issues in production with this code
• It is not, by far, easy to grasp. Without
someone explaining
Wednesday, May 20, 15
61. What I did not show
• transformations of domain entities:
• Request -> Write -> Persistence
• Persistence -> Write (-> Read)
• Composite Exhibit - how to show 0, 1 or
many concepts, dynamically, based on
the ModelObject rendered
Wednesday, May 20, 15
62. What could I experiment
• Capabilities for exhibits
• Capability.mobile
• Capability.REST
• Capability.json
Wednesday, May 20, 15