Download presentation
Presentation is loading. Please wait.
Published byDouglas Jefferson Modified over 8 years ago
1
Application generation Peter Bell SystemsForge Peter Bell SystemsForge Beyond Scaffolding
2
Overview Beyond Scaffolding A New Approach to Programming Key Concepts Anatomy of a Generator Software Product Lines Generating Web Applications
3
Let’s Start With Scaffolding Scaffolding is “free functionality” List, view, add, edit, delete Typically driven by DB schema Usually end up rewriting
4
Why Rewrite? Databases are dumb!... SSN is not just char(9) Form fields Advanced validation Display rules Business rules
5
A New Approach to Programming Language Oriented Programming “Building software around a set of Domain Specific Languages” - Martin Fowler Programmer as Language Designer
6
Language Oriented Programming OMG: Model Driven Architecture Microsoft: Software Factories Charles Simonyi: Intentional Programming JetBrains (IntelliJ): Meta Programming System MetaCase: MetaEdit EVERYONE is Doing It!!!
7
Language Oriented Programming Custom TagsUDFs CFCsAPIs YOU’re Already Doing It Property: Value FileXML Config File
8
API As Language Design... CODE... String = getDependentObjectList(ObjectName: String) Concept: getDependentObjectList Attribute: ObjectName
9
Language Oriented Programming Why do it?... Encapsulating Complexity (layered software) Key concepts...
10
Domain Specific Languages Limited form...... Specific domain Horizontal: - SQL - Reg-Ex - Objects - Notifications Vertical: - Newsletter - Shipping Rules - Insurance Quotes - Newspaper Workflows “Trade generality for expressiveness”
11
Three Types of Language Declaritive: What to do (requirements) Templating: Where to put (layout) Scripting: How to do (imperative)
12
Declaritive User @FullName: Name: Optional @Email: Email: Required @Password: Password: Required SELECT FullName FROM tbl_User Where UserID = 7
13
Templating #Title# $#Price#
14
Scripting For (Count = 1; Count lte listlen(ObjectDependencyList); Count=Count+1) { // Get current object name LoopObjectName = ListGetAt(ObjectDependencyList, Count); If (LoopObjectName NEQ "LightWire") { // Prepend it with ObjectName LoopObjectName=ListAppend(arguments.ObjectName,LoopObjectName,"|"); // Add it to the new object dependency list TempObjectDependencyList=ListAppend(TempObjectDependencyList,LoopObjectName) };
15
Three Types of Language Declaritive: Ideal for Reuse Templating: Simplify for designers Scripting: Use to implement
16
Abstract vs. Concrete grammar WHAT say vs. HOW say FirstName User @FirstName Boxes and Arrows
17
In-Language vs. External DSL In Language: CFC, UDF, Custom Tag Easy to create No validation Can use core language External: XML/custom file Store in database Harder to create Validation Can limit language
18
Types of Generation Passive Active Round trip Not much use Works great Not Required ->
19
Anatomy of a Generator Metadata Templates Iterator Orchestrator Extensions
20
Metadata Scripting XML Custom Syntax Databased
21
Templates Generating n-Getters: Template: > > Velocity - XSLT - CF Template Generate a File
22
Templates
23
Iterator One DAO per business object One template per screen In general: one file per instance of concept Possibly filter concepts Generate n-Files
24
Orchestrator Metadata (getObjectList) Template (ObjectDAO.cft) Iterator (Object: All) File name (#ObjectName#DAO.cfc) Generate m-Collections of n-Files
25
Extensions “Safe Code Snippets” Inheritance
26
Anatomy of a Generator Metadata Templates Iterator Orchestrator Extensions Generation NEQ Deployment
27
Software Product Lines Core Framework (scripts, DSLs, metadata) Feature Model Configurators
28
Generating Web Applications What is a website? Object Model+Interface Model
29
Object Model Objects: Attributes: Relationships Objects and Attributes: Content @LiveDate: Optional: Datetime: 1/1/2000 @KillDate: Optional: Datetime: 1/1/3000 @Status: Required: Status: approved Page: extends Content @Title: Required: Title Article: extends Content @Content: Optional: HTML Relationships: Page: Article: optional: multiple Article: Page: required: single
30
Object Model (2) Custom Data Types LiveDate @Transform: Date @Validate: IsDate @Field: DatePicker @Display: AsDate Status @Validate: IsDate @Field: Dropdown @List: StatusList Content @Transform: SafeHTML @Field: WYIWYG
31
Interface Model Screens: Actions: Steps Screens BaseList @Type=List @Paging = Yes @DefaultRecordsPerPage = 50 @RecordsPerPageList = 10,25,50,all ArticleAdminList extends BaseList @Type=List @AttributeList: Title,Status @OrderByAttributes: Title,Status @DefaultOrderBy: Title
32
Conclusions Programming as Language Design Horizontal and vertical DSLs Top down and and bottom up Generate everything: scripts, database, documentation, config XML, build scripts, etc. Layer software product line for higher levels of reuse Look out for CFGen, CF Template http://www.pbell.com Email: pbell@systemsforge.compbell@systemsforge.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.