ColdFusion Fw1 (FrameWork1) introduction

33 %
67 %
Information about ColdFusion Fw1 (FrameWork1) introduction

Published on July 24, 2014

Author: jsaravanamuthu



ColdFusion Fw1 (Framework1) introduction presentation prepared 3 years back for my Valtech dev team

FW1 introduction SaravanaMuthu.J @cfmitrah

2 Agenda ColdFusion Frameworks • MVC • Dependency injection • ORM MVC • What is MVC • MVC Architecture FW 1 • What is FW1 • Action = Section & Item • Folder structure • Views • Layouts • Views & Layout functions & variables • Controller & services intro • Controllers • Services • Request Context • Method execution sequence • Configuration variables • Subsystems • Bean Factories

3 ColdFusion Frameworks

4 MVC Frameworks • Fusebox - - Oldest MVC framework - XML config files used to define application settings in old versions. - Not been updated since March 2008 - Fuseaction, circuit.xml, fusebox.xml - Current Version: Fusebox: 5.5 • Mach II - - It was the first Object-Oriented framework for CFML. - Event based. listeners and filters defined in XML file - Current Version: Mach II: 1.8 • Model-Glue - - Event-based implicit invocation OO framework - direct integration with ColdSpring, Transfer and Reactor - Scaffolding functionality available with ORM - Current Version: Model-Glue: 3.2 RC

5 MVC Frameworks continues.. • ColdBox - - More than an MVC, it is a development kit and event driven remote framework - Rich documentation, CFB & cfeclipse tools - Current Version: ColdBox : 3.1 • CFWheels - - MVC framework inspired by Ruby on Rails - It implements the Active Record Pattern for the built in Object- relational mapping. - Current Version: CF Wheels 1.1.5 • FW1 - - It is Convention over configuration MVC Framework. - Light weight - Current Version: FW1: 2.0 RC

6 DI Frameworks • LightWire - - LightWire is optimized to create transient objects as well as singletons and allows for programmatic AS WELL AS XML configuration. • ColdSpring - - ColdSpring is a inversion-of-control framework/container for ColdFusion Compontents. • DI 1 - - DI 1 is very lightweight, convention over configuration DI framework. - Development phase, can easily integrate with FW1

7 ORM Frameworks • Transfer - Main focus is to automate the repetitive tasks of creating the SQL and custom CFCs Developed by Mark Mandel, Great CFML contributor Current version 1.1 • Reactor - Used to generate ColdFusion objects which are used to access data in your database • built-in ORM- Hibernate is high performance OR persistence & query service. Introduced in CF 9 & Railo 3.2


9 What Is MVC • Architectural Pattern often used by applications that need the ability to maintain multiple views of the same data. • Models for maintaining data. • Views for displaying all or a portion of the data. • Controllers for handling events that affect the model or view(s) • Usage Clarity Maintainability Reusability Teamwork

10 MVC Architecture Our Code ;)

11 Framework One

12 What is FW1 • Lightweight MVC framework developed by Sean Corfield • Convention over Configuration . No XML • Installing - Just extend your Application.cfc to FW1 core file • SES URLs support + =

13 Section & Item • All functionality are based upon the Action value • Action consists of a section and an item • Section is group of items Ex. Blog, comment • Item is a specific task inside a section Ex. List, Add, Update Index.cfm?action=blog.list (or) Index.cfm/blog/add/ (SES URL) • Default section is “Main” & default Item is “Default”

14 Folder Structure • Controllers • Views • Layouts • Services • gsfgsfgsfgsfg

15 Views • View is a User Interaction. [Form or UI] • View = html/css/js • Very little dynamic code Loops Sets IFs • View Contain full page content or Fragment • Folder per section with files named for item • All files and folders must be in lowercase.

16 View Demo Application - 1

17 Layouts • Layout is a Wrapper. It may render Header, Footer, Navigation. • Provided a variable named body • Generated output that the layout should wrap • Layout request is a cascaded action. A request can have 3 layouts executed • FW/1 looks for layouts in the following places: layouts/section/item.cfm layouts/section.cfm layouts/default.cfm • To stop the layout cascade, use request.layout = false. It is helpful for returning XML/JSON or AJAX calls

18 Layout Demo Application - 2

19 Views & Layout functions & variables Commonly used functions Variables view() body buildURL() rc[] layout() local[] getBeanFactory() framework[] request.layout

20 Controllers & Services • May contain a CFC for each section • Each CFC contains a method for each item • Caution: Cached in FW/1’s application cache! We can clear that cache using “?reload=true” querystring. Configurable using 3 options. reload = 'reload’ password = 'true’ reloadApplicationOnEveryRequest = false - Suitable for development phase • Methods Cached, so function local variables is not thread safe. So declare local variables using var

21 Controllers • Contain the high-level "traffic cop" logic • Validation and Control flow • commonly used functions variables.fw.redirect() variables.fw.service() variables.fw.setView() variables.fw.customizeViewOrLayoutPath()

22 Services • Intended to be agnostic of and decoupled from FW/1 conventions. • Inside controllers you can use the service() method to manually queue calls to service • Methods, passing the results back into the

23 Controllers and Services Demo Application

24 The Request Context • The main “data bus” through the application. • Contains URL and FORM variables. • Controller methods receive an rc argument. • Service methods receive as argument collection. • All Views / layouts have access to rc.

25 Method execution sequence • Called by FW1 when asked for section.item: • Application.cfc : before() • controllers/section.cfc:before() • controllers/section.cfc:startItem() • controllers/section.cfc:item() • services/section.cfc:item() return value stored in • additional service calls added via service() API • controllers/section.cfc:endItem() • controllers/section.cfc:after() • Application.cfc : after() • All Methods are optional, if that do not exist are not called.

26 Controllers methods - 4

27 Configuration variables • All config is in a simple structure in Application.cfc variables.framework = { home = "main.default", defaultSection = 'main', defaultItem = 'default', usingSubsystems = true, defaultSubsystem = 'user', subsystemDelimiter = '-', siteWideLayoutSubsystem = "common", generateSES = true, SESOmitIndex = true, base = '/cfml', cfcbase = '/cfc' };

28 Config variables - 5

29 Simple form submit - 6

30 Subsystems • Drop an FW/1 app into an existing one • Used as modules with no parent app dependencies • Must enable in parent application’s Application.cfc • usingSubsystems = true • FW/1 Examples can be run standalone or as subsystems in another application

31 Sub systems demo

32 Bean Factories • Supports any bean factory (IoC Container or DI factory) with the following API methods containsBean(name) - returns true if factory knows of named bean getBean(name) - returns fully initialized bean identified by name IoC - Inversion of Control DI - Dependency Injection

33 UserManager Demo Application

34 Resources

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

ColdFusion FW/1 MVC framework – No, I am better than that!

ColdFusion FW/1 MVC framework. ... As I mentioned in my previous post, in the ColdFusion courses I teach the two final lectures are on ORM and Frameworks.
Read more

ColdFusion: Reviewing the Application Framework | lynda ...

This specific tutorial is a single movie from chapter two of the ColdFusion ... ColdFusion: Reviewing the Application Framework ... Introduction ...
Read more

GitHub - seancorfield/fw1: THIS IS A FORK: SEE https ...

THIS IS A FORK: SEE FOR RELEASES ETC! FW/1 - Framework One - is a lightweight, convention over configuration, MVC ...
Read more

F/w1 | LinkedIn

View 20 F/w1 posts, presentations, experts, and more. Get the professional knowledge you need on LinkedIn.
Read more

Pradeep Viswanathan (@PradeepVizz) | Twitter

The latest Tweets from Pradeep Viswanathan (@PradeepVizz). Web development, Gadgets and Tech. Dubai, UAE
Read more