dry-ing magritte - esug magritte.pdf · • magritte framework describes domain objects and how to...

20
Dry-ing Magritte Stephan Eggermont & Diego Lont

Upload: others

Post on 18-Aug-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Dry-ing MagritteStephan Eggermont & Diego Lont

Page 2: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Do it yourself

• Gofer new

• url: 'http://smalltalkhub.com/mc/DiegoLont/QCMagritte/main';

• package: 'ConfigurationOfQCMagritte';

• load.

• ConfigurationOfQCMagritte project development load: #( 'Demo' ).

Page 3: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Introduction

• Magritte framework describes domain objects and how to show them

• Very abstract

• Hooks not very obvious

Page 4: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Hexagonal architecture

• Use a domain model

• Use ports and adapters for all concerns

• UI

• Validation

• Persistency

• Network

Page 5: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

This presentation

• Extend Magritte

• With as little duplication as possible

• Without having to write parallel hierarchies

• Without having to subclass everything

Page 6: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Example

• We use Twitter Bootstrap as a case

• Model is small

• Hard to extend

Page 7: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Custom rendering

• Default: renders table

• You can change table layout (a bit) in css

• Next option:

• Custom components

• Custom descriptions

• Custom renderer

Page 8: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Custom Component

• For displaying a field different

• E.g. a European date format instead of US

• Problem

• Needs to be set for each field

Page 9: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Custom descriptions

• each domain type needs its own description

• birthdate may be different from other date types (history/future, defaults)

• Only usefull for different types

• You need to make a component as well

Page 10: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Custom renderer

• Allow different layout than a table (i.e. div)

• Does not allow different components

• Problems:

• Needs to be set for each domain object

• Does not propagate (on “add / details”)

Page 11: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

DescriptionBuilder

• Problem:

• Each description needs same settings

• Solution:

• Custom description builder

• Root class

• Different package (monkey patch)

Page 12: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Multi language labels

• Editor for several languages

• Default is “toString” of the key

• Languages can be added

• Translation can be exported / imported from/to csv

• => DescriptionBuilder

Page 13: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Ajax

• Rendering is easy

• use custom renderer

• generates ajaxLabels

• Problems

• memento doesn’t apply domain rules

• description isn’t updated

Page 14: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Memento

• Generic dictionary, no domain class

• Setting one value doesn’t affect others

• firstname change <=> fullname change

• no domain validation in the memento

• solution: AjaxMemento

• allows domainrules to be set (influences)

Page 15: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Dynamic descriptions

• Hide fields based on state

• Options based on state

Page 16: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Reports

• Part of ToManyComponent

• A table, generated from a description

• User wants to be able to

• Filter content dynamically (AJAX)

• Add / Remove columns

• Save settings to profile

Page 17: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Dynamic reports

• Quite easy

• Use custom report renderer

• Add custom columns to allow AJAX filter

• Enable filters in to many component

Page 18: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

User settings

• Easy to incorporate in component

• Problem

• Components are hard to re use

Page 19: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Queries

• Basis of report (possible)

• More precise filtering

• Allows for user settings

Page 20: Dry-ing Magritte - ESUG Magritte.pdf · • Magritte framework describes domain objects and how to show them • Very abstract • Hooks not very obvious. Hexagonal architecture •

Thanks

• Friedrich Dominicus (Q-Software)