Presentation is loading. Please wait.

Presentation is loading. Please wait.

Leveraging ColdSpring To Make Better Applications

Similar presentations


Presentation on theme: "Leveraging ColdSpring To Make Better Applications"— Presentation transcript:

1 Leveraging ColdSpring To Make Better Applications
Kurt Wiersma

2 Goals Show how ColdSpring can be to build better enterprise grade applications. Introducing a quick start application: Appbooster Using the Mach II and ColdSpring frameworks allows you to build robust enterprise web applications quickly. Mach II - Model View Controller framework ColdSpring - a container or factory that provides dependency injection for assembling and managing service objects, and more… Enterprise environment - teams of developers building applications which need to have high availability and be easy to maintain over time as the business evolves. Using the Mach II and ColdSpring frameworks allows you to build robust enterprise web applications quickly. In this session you will learn how to use these two frameworks to build an application that can grow as your business evolves. By using these two frameworks together you can get your team of developers to produce applications that are structured in a way that makes it easy for new developers to come up to speed on the application.

3 Introduction ColdSpring - a container for your model objects
ColdSpring holds your objects like a box of Legos ColdSpring is transparent Toy box with legos inside them (services) AppBooster - sample/starter application which illustrates best practices Dependency injection is just means giving an object its instance variables.

4 Typical App Architecture
Domain/business objects for each entity Data Access objects (DAO) which read and save objects Gateway objects which return queries Service objects - your API Controllers which talk to the service layer It is about layers! Sean: People places and things - domain objects Services - concepts and processes

5 Life Before ColdSpring
Used createObject() a lot in my code Had lots of user services objects floating around in memory Wrote remote services manually Unit testing was difficult

6 Life After ColdSpring No more hard coded createObject() calls
Took advantage of Aspect Oriented Programming (AOP) for caching Automatically generated remote services for Flex 2 Easier testing More time with my wife

7 ColdSpring Part 1 ColdSpring's core focus is to make the configuration and dependencies of your CFCs easier to manage. ColdSpring consists of a container which can create and hold any object Dependency Injection aka inversion of control (IOC) The “Hollywood Principle” - don’t call me I will call you Auto-wiring of dependencies By default all objects are singletons and are cached in the application scope. ColdSpring is a inversion-of-control framework/container for CFCs (ColdFusion Components). Inversion of Control, or IoC, is synonymous with Dependency Injection, or DI. Dependency Injection is an easier term to understand because it’s a more accurate description of what ColdSpring does. ColdSpring borrows its XML syntax from the java-based Spring Framework, but ColdSpring is not necessarily a “port” of Spring. A dependency is when one piece of a program depends on another to get its job done. Dependency injection is just means giving an object its instance variables.

8 ColdSpring Part 2 The first Aspect-Oriented-Programming (AOP) framework for CFCs. Support for generating remotely accessible objects Plug-ins for Fusebox 4+, Mach-II, and ModelGlue Support for integrating with your factories through the factory-method attribute.

9 ColdSpring Configuration

10 Aspect Oriented Programming
Allows you to intercept method calls and act before and/or after them Transparent to the method being called and to the code calling the method Useful for security, caching, logging, and generating remote services Pointcuts: Pointcuts are special components that you can configure to identify Joinpoints for you. Pointcuts are configured with the names of methods, which can contain the '*' wildcard character, and are the primary mechanism with which your Aspects are applied to methods in your model component. Advice: Advice objects are the primary implementation of your Aspects. Working with AOP is mainly a process of adding functionality to existing methods in a cfc. You can think of this as adding advice to those methods. Advisors: Advisors are special components that you configure to create pointcuts for you, and associate Advice objects with them. Advisors are used during the weaving process to build proxy objects, they are the mechanism for defining the how your Advice components should be applied to target objects. Target Object: The target object is the cfc that you would like to add functionality to. ColdSpring will create a new object based on this target object that you can use in place of it elsewhere in your model. Proxy Object: A proxy object is an object that ColdSpring creates to accept method calls intended for your target object, which will then look to see if there are any Advice objects to use before forwarding the method call to your target. The proxy object actually contains all the aspects and pointcuts it needs along with your target object. ColdSpring creates this object for you, which will have the same method signatures and type of your original object, making its use transparent to the rest of your model components. Weaving: Weaving is the process of generating a Proxy Object, providing it with any Aspects and Pointcuts you have configured for a target object. This is performed by a ProxyBeanFactory, which is configured in your ColdSpring xml configuration file.

11 Remote Facades ColdSpring’s remoteProxyFactory uses AOP to generate remote CFCs which can be called via web services or via Flex 2 Easy to setup Use a service layer!

12 Introducing AppBooster
A sample Mach II and ColdSpring application developed with best practices. AppBooster gives your application a jump start Provides a simple model for users, addresses, and roles User authentication is implemented There is both a public and admin interface for managing users Show flow of request for a appbooster going through CS and M2.

13 AppBooster Model

14 Recommendations Do a proof of concept
You don’t have to do it all at once Consider developing or using a code generator or framework to speed development Favor setter injection over constructor injection when setting up your services Join the ColdSpring mailing list Read through the ColdSpring documentation

15 Resources ColdSpring Chris Scott’s Blog Dave Ross’ Blog Kurt’s Blog
Chris Scott’s Blog Dave Ross’ Blog Kurt’s Blog Aspect Oriented Programming

16 Questions?? Fire away… Go Bears!


Download ppt "Leveraging ColdSpring To Make Better Applications"

Similar presentations


Ads by Google