This is a slightly revised version of the slides I used for my talk at BMSD 2015, titled "Domain-Specific Language for Generating Administrative Process Applications". In these slides I present our current version of the AdminDSL language, from which we can produce Django web apps.
Machine Learning Software Engineering Patterns and Their Engineering
BMSD 2015 slides (revised)
1. Intro Proposal Results Conclusions
Domain-Specific Language for Generating
Administrative Process Applications
Antonio García-Domínguez, Ismael Jerez-Ibáñez and
Inmaculada Medina-Bulo
July 8th, 2015
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 1 / 12
2. Intro Proposal Results Conclusions
Motivation
Situation
Univ. of Cadiz (Spain), IT webdev+support group (5-8 people)
Need to handle demand for many “small” internal apps
Similar needs: data collection and simple processes
Restrictions
Varied backgrounds: recently standardized on Python/Django
Limited time/budget for training/consulting
Developers are moved frequently between apps
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 2 / 12
3. Intro Proposal Results Conclusions
Existing approaches
Full-fledged BPM systems (e.g. Bonita)
Pros: standards-based (BPMN), general-purpose
Cons: complexity, dependency on engine, seemingly “minor”
customizations are costly
Domain-based code generators (e.g. EMF Forms / Apache Isis)
Pros: simpler, easier to customize
Cons: do not take into account the underlying process
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 3 / 12
4. Intro Proposal Results Conclusions
Proposed approach: process category-specific DSL
Modelling requirements
1 Manage both domain and process
2 Provide role-based access control per process state
3 Support decision- and date-based transitions
4 Support process isolation between users with same roles
Technical requirements
1 Allow generator-specific annotations
2 Manageable with regular editors and VCSs
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 4 / 12
5. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
Steps
1 Student starts process
2 Exam is in 2 parts
3 Part 2 opens after date
4 Evaluation by teacher
5 Exam closed, read-only
Implementation
Parser + editor: Xtext
Code generator: Epsilon
Target framework: Django
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
6. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
options {
django_base_template
= "template/base.html";
django_extra_apps
= "template = https://.../";
}
Site-wide generation options
Key-value pairs
Keys not restricted by grammar
Allows generators to provide
extra functionality
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
7. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
entity Ans3 { string answer; }
Data entities
Objects that can be reused
across process instances
Can be site-wide or
process-specific
Example: possible answers for
question 3
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
8. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
section personal {
fullName studentname;
identityDocument(label="National ID:") nid;
email(label="Email") mail;
}
Sections
Divide the form for access control or
presentation.
Fields
Types are domain-specific,
beyond those of the framework
“fullName”: forename, last name
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
9. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
section test {
group part1 {
string(blank="True") q1;
choice(values=". . . ",blank="True") q2;
choice(table="Ans3",blank="True") q3;
}
group part2 { . . . }
. . .
}
Groups
Contain one or more fields.
Optionally, can be repeated
(e.g. order line items).
Also useful for access control.
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
10. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
state initial {
permissions student { editable personal; }
transition(decision_by="student",
start_date="2015/03/01−14:00:00",
end_date="2015/03/07−14:00:00",
max="1") part1;
}
Initial state
Implicit state while unstarted
Who can start the process,
when and how many times?
Here, students could start the
process once from March 1st to
March 7th at the part1 state
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
11. Intro Proposal Results Conclusions
Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
state part1 {
permissions teacher { viewable all; }
permissions student from initial→part1 {
editable personal, test.part1;
}
transition(start_date=". . . ") part2;
}
Permissions per state + role
View or edit form data
Delete process instance
Optional: required transitions
Restrict to participants of a specific
transition in that instance.
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 5 / 12
12. Intro Proposal Results Conclusions
Generated website: main page
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 6 / 12
13. Intro Proposal Results Conclusions
Generated website: full form
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 7 / 12
14. Intro Proposal Results Conclusions
Generated website: generated code
Metrics
DSL-based description: 66 lines long
Produced:
1000+ lines of Python code
400+ lines of HTML templates
264 lines of docs/support scripts
Features
Generates models, views and controllers
Generates process-oriented UI as starting point
Partial form saving (drafts)
Integrates useful Django features (admin panel, data
versioning, chained selectors, i18n...)
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 8 / 12
15. Intro Proposal Results Conclusions
Current status
Availability
In-house with IT staff and local contractors
Currently used to prototype four internal apps:
Budget plan tracking
Degree improvement plan tracking
Job postings management
Strategic plan definition/tracking
Maturity
Metamodel mostly stabilized, but not frozen yet
Editor is being refined with OCL constraints
Generator verified through automated functional testing
Collaborating with users on defining “protected regions”
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 9 / 12
16. Intro Proposal Results Conclusions
Conclusions
Proposal
Small IT group working on repetitive web apps
General purpose BPM engines too complex, form-based
frameworks do not consider the processes
Proposed middle ground: a process category-specific DSL
Results obtained
DSL (parser + editor) implemented through Xtext
Code generation with Epsilon targeting Django
Being used currently to develop four in-house apps
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 10 / 12
17. Intro Proposal Results Conclusions
Future work
Improvements on DSL
State preconditions/postconditions
Nested groups
Improvements on tooling
Extend current Xtend validation with OCL
Create more generators (Symfony2, BPMN?)
Graphical visualizations of the process
Create graphical editor (backed by DSL instead of XMI)
Validation
Refinements based on user feedback
Planned open source release in summer/fall 2015
Future studies on productivity/usability
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 11 / 12
18. Intro Proposal Results Conclusions
End of the presentation
Thank you for your attention
@antoniogado, @antoniogado_es
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
19. Abstract syntax — Application
Application Element
Options Role
name : EString
Site
name : EString
Option
name : EString
values : EString
Entity
name : EString
Process
name : EString
[0..*] elements
[0..*] elements
[0..*] properties
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
20. Abstract syntax — Process
State
name : EString
Relation
relname : EString
ProcessElementProcess
name : EString
Entity
name : EString
Section
name : EString
[0..*] elements
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
21. Abstract syntax — Sections/Entities
Field
type : EString
Group
SectionElement
name : EString
Relation
relname : EString
EntityElement
Option
name : EString
values : EString
Section
name : EString
Entity
name : EString
[0..*] elements
[0..*] options
[0..*] reloptions[0..*] options
[0..*] elements [0..*] elements
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
22. Abstract syntax — States
Permission
type : EString
PermissionAllPermissionWithTarget
State
name : EString
StateElement Transition
Points to section,
group or field.
RolePermissionsDef RequiredTransition
[0..*] elements
[0..1] name
[0..*] permissions [0..*] transitions
[0..1] from
[0..1] to
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
23. Abstract syntax — Relations
Relation
relname : EString
RelationReferenceTarget
RelationTarget
RelTailRef
RelTailRef2
ProcessOrEntity
SectionOrEntity
Group
LiteralClass
value : EString
[0..*] targets
[0..1] tail
[0..1] tail
[0..1] target
[0..1] element
[0..1] element
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12
24. Example: examination process
site School;
options { . . . }
role student;
role teacher;
process exam {
entity Ans3 { . . . }
section personal { . . . }
section test { . . . }
section evaluation { . . . }
state initial { . . . }
state part1 { . . . }
state part2 { . . . }
state evaluation { . . . }
state closed { . . . }
}
state closed {
permissions teacher { viewable all; }
permissions student { viewable evaluation; }
permissions student from initial→part1 {
viewable all;
}
}
Final state(s)
States with no outgoing
transitions
A. García-Domínguez et al. Domain-Specific Language for Generating Administrative Process Applications 12 / 12