Presentation is loading. Please wait.

Presentation is loading. Please wait.

RAD OO Web Maniacs 2008 Peter Bell SystemsForge Peter Bell SystemsForge.

Similar presentations


Presentation on theme: "RAD OO Web Maniacs 2008 Peter Bell SystemsForge Peter Bell SystemsForge."— Presentation transcript:

1 RAD OO Web Maniacs 2008 Peter Bell SystemsForge Peter Bell SystemsForge

2 Who Am I? Programmer - 30-40 projects/yr. Researcher - Published academic papers DSM forum/ooPSLA Entrepreneur - Profitable/practical SystemsForge - 10,000 custom apps/yr. Writer - CFDJ, Fusion Authority Quarterly Presenter - cf.objective(), CF United, Frameworks, Code Generation 2007, ooPSLA, Domain Specific Modeling Forum, CFCamp...

3 RAD OO... Patterns - quickly build OO apps Proven (> 50 projects) Collection of tools

4 RAD OO... IS NOT...  Standard approach  Suitable for all projects  Hack job IS...  Fast  DRY  Maintainable

5 RAD OO Uses XML Config Base Classes Optional Classes Iterating Business Objects RAD Controller Smart Views RAD Views Custom Data Types

6 XML Config ProductCatalog viewCategory

7 XML Config Product extends: BaseObject tableName: tbl_Product Identity: ProductID Properties: Title title required Price money optional default:0 Description WYSIWYG optional ClassMethods: AdminList: Title,Price OrderBy Title DefaultAdd: Title,Price,Description QuickAdd: Title,Price multiple:5 DefaultEdit: ID, Title,Price,Description Relationship has-many Category associated optional

8 Base Classes Most code similar Replace code with configuration Samples: BaseService, BaseDAO, BaseController

9 Optional Classes Only create CFC’s with code All others instantiate base classes

10 Lightwire Config BusinessObjectList = ApplicationConfig.get("ObjectList"); For (i = 1; i lte listlen(BusinessObjectList); i = i + 1) { // Get current object name BusinessObjectName = ListGetAt(BusinessObjectList, i); // Configure Business Object Service Classes If (FileExistsinApplication("com.model.#BusinessObjectName#Service")) {addSingleton("lb.com.model.#BusinessObjectName#Service");} Else { If (FileExistsinLibrary("com.model.#BusinessObjectName#Service")) {addSingleton("lightbase3.library.com.model.#BusinessObjectName#Service");} Else {addSingleton("lightbase3.framework.com.base.BaseService", "#BusinessObjectName#Service");}; }; addConstructorDependency("#BusinessObjectName#Service","#BusinessObjectName#Metadata", "Metadata"); addMixinDependency("#BusinessObjectName#Service","#BusinessObjectName#DAO"); addMixinDependency("#BusinessObjectName#Service","DBProvisioner"); };

11 Iterating Business Object Encapsulates recordset Handles iteration Generic get/set - can overload Pattern - not implementation E.g. Can drop generic get/set

12 Traditional view (initial) #ProductID# #Title# #Image# #SKU# #Price# #SalePrice#

13 Traditional view (after time) #Title# #SKU# On sale - only $#Numberformat(SalePrice, "9.99")# Price: $#Numberformat(Price, "9.99")#

14 Traditional view (not DRY) Product list (multiple?) Product detail (multiple?) Admin product list Cart display Order display....

15 IBO (initial) #ProductList.display("ProductID")# #ProductList.display("Title")# #ProductList.display("Image")# #ProductList.display("SKU")# #ProductList.display("Price")# #ProductList.display("SalePrice")# #ProductList.displayProductID()# #ProductList.displayTitle()#... OR

16 IBO (over time) #ProductList.displayProductID()# #ProductList.displayTitle()#... OR #ProductList.display("ProductID")# #ProductList.display("Title")# #ProductList.display("Image")# #ProductList.display("SKU")# #ProductList.display("Price")# #ProductList.display("SalePrice")#

17 The Concept

18 Using the IBO CREATE: var ProductList = beanFactory.getbean("Product"); ProductList.load(GetProducts); ITERATE: #ProductList.get("Title")# PERFORMANCE: - Single bean - quick to create

19 M-V-C Model:  Business logic and persistance View:  Display templates and helpers Controller:  Actions, model calls, selects views

20 RAD Controller Front controller  index.cfm?action=. Page controller  about-us/history.html becomes  page.cfm?filepath=about-us/history Remote controller  remote.cfm?object= & method= &p1=v1&p2=v2&...

21 Smart Views View can access model Not true MVC DRYer - for right use cases

22 Smart Views Regular Controller:  Data = getProductList()  View = product-list.cfm Smart View:  Great for:  Ancillary data  one off screens

23 RAD Model For each business object:  Service a) remote api b) aggregate methods c) factory  DAO a) All data access (uses data mapper)  Business object a) Business logic

24 RAD View Site Templates Screen Templates Includes View Helpers (IBOs) Custom Data Types

25 Site Templates Complete HTML page 1..n/project Template chooser

26 Screen Templates Populates content area May have includes/helpers

27 View Helpers CFC methods for simplifying templates E.g. list paging

28 Custom Data Types Displaying form fields Processing form fields Displaying formatted values

29 Custom Data Types.display().field().process()

30 Conclusions Proven in over 50 projects Extremely productive Removes unnecessary flexibility Your milage may vary

31 Questions? Blog:  www.pbell.com www.pbell.com Email:  peter@pbell.com peter@pbell.com Yahoo:  freshstartsw freshstartsw AIM:  appgeneration appgeneration


Download ppt "RAD OO Web Maniacs 2008 Peter Bell SystemsForge Peter Bell SystemsForge."

Similar presentations


Ads by Google