Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Object-oriented Programming for CFML Developers

Similar presentations


Presentation on theme: "Introduction to Object-oriented Programming for CFML Developers"— Presentation transcript:

1 Introduction to Object-oriented Programming for CFML Developers
Josh Adams

2 About Me Josh Adams Phone: (678) Developer Evangelist for BlueDragon at New Atlanta CFML Developer Past President of the Atlanta ColdFusion User Group, Inc. Regular speaker at CFML conferences and at User Groups

3 Q&A Protocol Please ask questions!
Feel free to ask questions at any time during the presentation Time permitting, we'll do Q&A at the end of the presentation I will address as many questions as possible Due to time constraints some questions may go unanswered today If I do not answer your question today, I will get back to you with an answer if you give me contact information

4 OO Background OO (and OOP) = Object-oriented programming
Motivation (a.k.a. why it exists, why it is used): provide flexibility and maintainability to code Ease of code reuse Ease and reliability of application modification through decreased code modification and instead increased code addition Guiding principle: code modularity Great…but my code isn't OO and it's pretty flexible, maintainable, and modular…

5 Functional/Procedural Programming
Let's start with what we know… Functional/procedural programming paradigm: collection of functions/procedures We don't have procedures per se in CFML but a function that returns no result is effectively a procedure Functions can be thought of as actors; they act on variables Functions do the work of the program Let's take a look at a simple example…

6 OO Programming OO programming paradigm: collection of objects

7 Objects An object is a thing
More precisely, an object is a representation of a thing Has characteristics We call these "attributes" or "properties" Properties are just variables rebranded! Those things which the thing has Has behaviors We call these "methods" Methods are just functions rebranded! Those things which the thing does

8 Methods Functions still do the work in OO! But now they…
…just know what they need to know! …generally contain less code!

9 Objects in CFML A CFML object is an instance of a CFC
An instance is a particular representation in memory

10 CFC Background CFC = ColdFusion Component
A text file with the extension cfc, the contents of which are CFML surrounded by <cfcomponent> opening and closing tags The <cfcomponent> opening and closing tags are not required by CFMX but they are required by BlueDragon

11 CFCs The "building block" of OO CFML Blueprint for objects
In the same way that a blueprint for a physical object defines what the object will look like and what it can do, a CFC defines what a virtual object "looks" like and what it can do Just as one blueprint can be used to create multiple physical objects, a CFC can be used to create multiple virtual objects CFCs are essentially the CFML equivalent of the classes found in many other OO languages

12 CFC Contents Specification of the properties of objects that are created from the CFC Think of a CFC's properties as what objects created from the CFC have Definition of the methods of objects that are created from the CFC Think of a CFC's methods as what objects created from the CFC do Let's take a look at a simple example…

13 OO Concepts (Part 1) Abstraction Encapsulation
Grouping together in a CFC those properties and methods that define an object Encapsulation Information hiding Putting properties and methods in a CFC and exposing only those that need to be accessible outside the CFC and otherwise hiding all implementation details For simplicity, our CFC examples use the "this" scope, making all properties accessible externally to the CFC; in practice, properties are generally in the Variables scope and getter and setter methods are used to access them

14 The Power of OO Code flexibility, maintainability, and modularity
But how is that different from functional/procedural code?

15 Functional/Procedural Code Maintenance
Let's look back at our simple functional/procedural example Before we had only one light source but now we want to add another… And then another…

16 OO Code Maintenance (Part 1)
Let's look back at our simple OO example Before we had only one light source but now we want to add another…

17 OO Code Maintenance (Part 2)
There has to be a better way! There has to be a way we can reuse code efficiently There has to be a way we can associate similar/related objects

18 OO Concepts (Part 2) Inheritance Polymorphism
Derivation of CFCs from other CFCs; the derived CFCs inherit the properties and methods of the base CFCs These can be overridden, which means that they can be redefined in the derived CFCs Aids code reuse Keyword for inheritance in CFML: "extends" A CFC can only extend one other CFC Polymorphism Different objects having the same methods (which may do different things) which can be substituted for one another

19 Abstract CFCs Can the base CFC merely define that a derived CFC should have particular methods and leave the details of the implementation of those methods up to those derived CFCs? Yes—use an abstract CFC! Cannot be instantiated directly Defined using <cfcomponent type="abstract"> Contains one or more abstract methods Defined used <cffunction … type="abstract"> Can also contain fully implemented methods New feature of BlueDragon 7.0!

20 Interfaces But can I use multiple inheritance? Yes—use an interface!
Cannot be instantiated directly Defined using <cfcomponent type="interface"> Contains one or more abstract methods Defined used <cffunction … type="abstract"> Contains ONLY abstract methods New feature of BlueDragon 7.0! Objects validate as the type of any interface(s) they implement

21 OO Code Maintenance (Part 3)
Let's look back at our simple OO example Let's use an abstract CFC and then see how easy it is to add another light source… Then let's use an interface…

22 Introduction to New Atlanta: We are Web Application Server Technology Experts
BlueDragon is our 3rd generation web-scripting technology FileMaker Web Companion (Lasso) Web Publisher for FileMaker Pro databases Built in 1995, sold to Apple in 1997 Over 10 Million licenses since initial release ServletExec - Servlet/JSP Container First servlet engine on the market for Microsoft IIS and Netscape Enterprise Server with Servlet 1.0 Specification support Charter members of Servlet and JSP Expert Groups (Sun's JCP) Ten of thousands of licenses since 1997 BlueDragon CFML Runtime with native deployment and integration on J2EE and .NET platforms New Atlanta has over 12,000 customers in 100+ countries

23 New Atlanta Customers Land's End MySpace.com
Over $1 billion in e-sales MySpace.com Over 110 million users ESRI – ArcIMS: web-based GIS ServletExec ships on ArcIMS CD American Airlines Worldwide reporting of safety incidents Yahoo! Resumix hotjobs.yahoo.com

24 BlueDragon Editions Standalone Native .NET Native J2EE
BlueDragon Server & Server JX Standalone (including "Free version") BlueDragon .NET Native .NET No need to write ASP.NET. Direct .NET platform advantages within your CFML applications BlueDragon J2EE Native J2EE Any J2EE app server

25 BlueDragon Background
Oldest Java-based CFML application server 1998: created by a consultancy in Scotland 2002: purchased and productized by New Atlanta 2006: established a partnership with BEA through which BEA licenses BlueDragon from New Atlanta for sale as their own product Native .NET version: released in 2005 New Atlanta is a Microsoft Gold Certified Partner BlueDragon.NET is a Microsoft Certified Product (Windows Server) BlueDragon.NET is a .NET Connected product BlueDragon is a SQL Server 2005 Frontrunner

26 What BlueDragon Is & Does
CFML ≠ ColdFusion CFML is ColdFusion Markup Language CFML is code ColdFusion is Adobe's CFML application server ColdFusion is a software application Interprets CFML and generates output (HTML, PDF, etc.) You can deploy your CFML applications using ColdFusion BlueDragon is New Atlanta's CFML application server BlueDragon is a software application You can deploy your CFML applications using BlueDragon

27 BlueDragon 7.0 beta2 currently available Link on New Atlanta home page Feature complete: only bug fixes & performance tweaks anticipated prior to final release Release Candidate expected within at most a few weeks Final release expected several weeks thereafter See the "What's New in BlueDragon 7.0" document on the New Atlanta website for full feature details

28 BlueDragon Future Expect another major release in second half 2007
Windows Vista and IIS 7 integration Microsoft ASP.NET AJAX integration Ajax-based Rich Internet Applications Image processing (CFIMAGE enhancements) Administration and configuration enhancements Other features from Scorpio (CFMX8) (?) Visual Studio plug-in (?)

29 Q&A Got questions? Ask away!

30 Swag Giveaway Let's give away some swag!

31 My Contact Info Josh Adams Phone: (678)


Download ppt "Introduction to Object-oriented Programming for CFML Developers"

Similar presentations


Ads by Google