1 / 38

Mach II at Macromedia Sean Corfield Director, Architecture

Mach II at Macromedia Sean Corfield Director, Architecture. An introduction to Mach II and its use on macromedia.com. Overview. An introduction to Mach II What Macromedia is doing with Mach II Lessons Learned - Good & Bad. Introduction. What is Mach II? Definitions & Buzzwords

kelda
Download Presentation

Mach II at Macromedia Sean Corfield Director, Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mach II at MacromediaSean CorfieldDirector, Architecture An introduction to Mach II and its use on macromedia.com

  2. Overview • An introduction to Mach II • What Macromedia is doing with Mach II • Lessons Learned - Good & Bad

  3. Introduction • What is Mach II? • Definitions & Buzzwords • An overview of how it works • Why use Mach II? • Pros & Cons • Alternatives

  4. What is Mach II? /i • "Mach-II is a web-application framework focused on easing software development and maintenance." • mach-ii.com (official Mach II website) • It's code that we can use as a foundation for our applications

  5. What is Mach II? /ii • Object-Oriented • Strict Model View Controller structure • Event-Based Implicit Invocation Architecture

  6. What is Mach II? /iii

  7. What is Mach II? /iv • Events • Generated by user (links, forms) • Generated by application code • Example • User tries to login (event=login) • Login success (event=login_ok) • Login failure (event=login_bad)

  8. What is Mach II? /v • Event Handlers • Specified in XML (mach-ii.xml) • Can notify "listener" CFCs • Can render views (HTML) • Can announce new events • Can use filters to process data and affect the flow of control

  9. What is Mach II? /vi • A simple event handler: <event-handler event="showHome" access="public"> <notify listener="newsManager" method="getNews" resultKey="request.news" /> <view-page name="homePage" /> </event-handler>

  10. What is Mach II? /vii • Model - ColdFusion Components • Business Domain Objects • "listeners" (for handling events) • View - CFML pages • Also layout templates, "pods" etc • Controller - Mach II • XML configuration file • Core framework files

  11. What is Mach II? /viii

  12. What is Mach II? /ix • Extensibility • Filters • CFCs that process data, announce events, change flow of control • Invoked explicitly by event handlers • Plugins • CFCs that process data, announce events, change flow of control • Invoked implicitly at key points in the event lifecycle

  13. Why use Mach II? /i • "It helps ColdFusion developers build maintainable applications by allowing them to focus separately on the independent parts of their applications: the business model, the presentation layer, the connecting logic - the flow of the application." • corfield.org (unofficial Mach II website)

  14. Why use Mach II? /ii • Good frameworks provide a "head start" • Based on sound engineering principles • MVC design pattern • Implicit Invocation Architecture • Standardization • Common structure for applications • It supports "best practices" • Good OO design / heavy use of CFCs • Loose coupling / high cohesion

  15. Why use Mach II? /iii • But . . . • Frameworks • Require you use their style / idiom • Constrain how you develop applications • Mach II requires you use • CFCs / OO / MVC / CFMX6.1

  16. Why use Mach II? /iv • Alternatives? • Struts (built for Java) • http://jakarta.apache.org/struts/ • Fusebox (procedural, explicit) • http://www.fusebox.org/ • onTap (procedural, implicit) • http://www.turnkey.to/ontap/

  17. Macromedia & Mach II • Why did we choose Mach II? • How are we contributing to Mach II? • What applications use Mach II?

  18. Why we chose Mach II • The macromedia.com team had • Heavy use of ColdFusion Components • Informal MVC approach in some apps • But we wanted more standards and more structure in our applications

  19. Contributing to Mach II • Macromedia was an early adopter • Discovered bugs (& provided fixes) • Submitted enhancements (based on real-world usage scenarios) • Load testing & stability improvements • Published Mach II Development Guide

  20. Applications using Mach II /i • We started small • Active Content Resources administrator • 6 filters, 14 event handlers, 2 listeners, 7 views • Breeze Leads application • 4 filters, 13 event handlers, 2 listeners, 6 views • Some internal content management applications • This proved the framework for us without taking much of a risk

  21. Applications using Mach II /ii • Product Showcase [link] • 6 filters, 81 event handlers, 16 listeners, 1 plugin, 42 views • European Online Stores (HTML version) [link] • 7 filters, 78 event handlers, 1 listener, 1 plugin, 45 views • 14 Mach II applications in production or in development…

  22. Lessons Learned • Benefits of using Mach II • Downsides to using Mach II • Freedom within the framework • Load testing & thread safety

  23. Benefits of using Mach II /i • Able to leverage existing CFCs • Built an HTML version of Flash / CFC store in a short space of time • Implicit Invocation • Reduced coupling & dependencies • Easier to change application flow • Strict MVC • Separation of presentation and logic • Declarative controller (XML)

  24. Benefits of using Mach II /ii • What our engineers say • Mach II provides a head start on coding • Common code structure and very modular nature of code make it easier to maintain than ad hoc applications • Plugins and filters make it easy to extend functionality

  25. Benefits of using Mach II /iii • What our engineers say • Good MVC implementation allowing application to be built views-first or business-model-first as needed • XML controller makes incremental development & testing easier • Overall, a big win - Mach II is well-liked • "two enthusiastic thumbs up!"

  26. Downsides to using Mach II • What our engineers say • Lack of documentation • Debugging / Tool support • Some community tools are now appearing • Poor white space management • Improved in 1.0.9 • Thread safety is big, bigissue

  27. Freedom within the framework /i • There's more than one way to do things • Filters vs Plugins • Layouts, Pods • Form handling • Request scope vs Event object • Listener style

  28. Freedom within the framework/ii • We used filters for • Security / login authentication • Persistence • Form handling • Localization • Caching • Omniture click-stream tracking

  29. Freedom within the framework/iii • We used plugins for • Application initialization / parameters • Localization • Tracing / debugging / performance analysis • Note: two approaches to localization!

  30. Freedom within the framework/iv • Layouts & Pods • Portal / Grid Layouts • Lots of small views, rendered to contentKey variables (pods) • Use layout template views to assemble page • Usually announce event to assemble page • CompositeView design pattern

  31. Freedom within the framework/v • Form handling • Beaner filter • Code was written before <event-bean> command was added! • Validation filter • No custom form handling: • All basic bean-based code

  32. Freedom within the framework/vi • Request scope vs Event object • We mostly follow the (original) Mach II Development Guide recommendations • Mostly use a few request scope variables as the API to views • Use a few event arguments where it is clearer and more maintainable to do so • This is no longer considered best practice for Mach II!

  33. Freedom within the framework/vii • We have yet to choose one listener style • Some applications use a single listener as a facade for the business model • Some applications use one or two simple "manager" listeners • Some applications use a lot of small, single-function listeners

  34. Load testing & thread safety /i • Mach II 1.0.9 is thread safe • Earlier versions of the framework were not! • Load testing highlighted random errors • All CFCs are stored in application scope • Need to use 'var' scope for all local declarations in all functions!

  35. Load testing & thread safety /ii • You must also 'var' declare implicitly created variables (from cfquery, cffile etc) • Example: <cfset var results = 0 /> <cfquery name="results" …>

  36. Summary • Mach II… • …is a good fit for the way we develop applications: OO, MVC • …is based on a solid software architecture: Implicit Invocation • …provides a common structure for our applications that reduces coupling, increases cohesion, eases maintenance

  37. Resources • The official Mach II website • http://www.mach-ii.com/ • The unofficial Mach II website • http://www.corfield.org/machii/ • Mach II Development Guide • http://livedocs.macromedia.com/wtg/public/machiidevguide/

  38. Mach II at Macromedia • Questions & Answers? • Sean A Corfield • scorfield@macromedia.com

More Related