Mach-II 1.5 is sweet! Notes from Peter Farrell’s presentation at cf.Objective()

Wow! Peter, Kurt, and Matt have been busting some tail!

Today I skipped a session-and-a-half to sit and chat with Peter Farrell about what they have been working on. I am *very* impressed. I feel fortunate to have had this chance to see a bit of a preview of the session, since I am not sure I could have taken it all in in the 1-hour slot that he had to present it in.

It should be noted as I list these features that one of the big principles in the team’s development has been to maintain backwards compatibility while adding in some real advances in the framework. I am sure this was a delicate balance, as Peter confirmed in our discussions. In addition to BC, the following goals have guided development on 1.5:

  • Make large applications easier to develop with new elements , and
  • Improvements for “things” that people use workarounds
  • Property CFCs instead of using the configure() method of Plugins
  • Support for static structs and arrays in XML
  • Bindable property placeholder in parameters support ${value}
  • “Behind the scenes” improvements for new features scheduled for Mach-II 2.0

Here is some of the new functionality:

  • Includes – This allows XML configuration files to include other XML files. The main purpose of this is to allow you break up large unruly configuration files into smaller pieces to make them more manageable and easier to maintain. Peter mentioned that this would be easy to implement in legacy applications immediately. The include file follows the same Mach II XML format we all know. The include tag also allows you to override a base config file’s elements using an include which defaults to false if not explicitly defined.
  • Modules – This is a really powerful addition that will allow sub-applications or peer-applications (3rd party applications for instance) to be easily integrated. Peter mentioned that appKey was a pseudo implementation, but not as easy to work with. Having never used that, I will take his word on it. :) A Module is just another complete Mach II XML file referenced like this:

    Unlike includes, legacy applications well need “some” refactoring to take advantage of this, but new applications can start using this immediately. Peter also mentioned that the framework independently reloads modules in dynamic mode. Only modules that have been changed will be reloaded. Modules extend the “base” module which allows you to define elements such as filters, listeners, properties, event-handlers, etc. to be shared across all modules.

    You can define specific exception handling events within each module. If an exception handler is not defined in the module the framework will use the exception handler from the parent.

    Now you can announce events in the base application or within the modules using the following mechanisms:

    Similar upgrades have been implemented for and as all have the new “module” attribute added. So, let’s say for example that I want to call an event named “showHome” in a module named “blog”. How would that look in the url? Like this:


    The “:” is actually just a default delimiter. You can set that to be whatever you wish in the config file by setting the moduleDelimeter property.

    Of course, it should be noted that you can now do this as well:


    Yes, that’s right! Mach II now supports….

  • SES URLs – They have now added the UrlParseSES property. The framework knows how to read and write SES URLs as defined by you. As with the moduleDelimiter property, you can change the SES delimiter to be something other than “/”.The following is now available:
  • Subroutines – This allows you to define reusable pieces of code in your configuration XML. Here is the example that Peter gave.

    I will have to double check the syntax, but I believe that is executed within an event by using the new tag. Peter mentioned that this will fix a need that Aaron Lynch blogged about here in which he came up with an EventChainPlugin that we use on several of our applications.

    If you are in a sub module and you try to execute a subroutine that doesn’t exist in that module it will check the parent.

  • Configuration Syntax – Peter also demonstrated new complex properties that can be added into the configuration XML now. For example you can add this in into the section of the file:

    You can also do nested complex properties as you see in this example:

    In addition to Arrays and Structures, you can now even have Property CFCs! Peter announced this with a big warning… DO NOT PUT YOUR DATA MODEL IN YOUR CONFIG! Although you can clearly imagine some bad uses for this feature, the intent was to be able to make an instance of a CFC available throughout your application as a property. Here is an example of the syntax:

    This is a great alternative to empty plugins that only serve to instantiate Property CFCs in their configure() methods.

  • Bindable Properties – Mach-II 1.5 also brings us bindable properties. This will be especially useful for properties that might vary between different environments such as development/production. Here is the syntax:
    traceMode” value=”${traceMode}” />
    I could be wrong, but I don’t believe that I saw an example of how you actually set that value.
  • Redirect Persists – As Peter began running out of time, he rattled off a number of new features including redirect persists. This is a very cool feature that was formerly handled by various plugins, but allows you to persist complex event args across a redirect. For instance you can now do this:persistArgs=”list,of,event,args,to,use” />
    (defaults to the entire event object if persistsArgs not defined)
    Functionally this basically creates a temp value in the application scope that can be grabbed and cleared once you land on the target event.

All of these changes are pretty exciting, and I believe they make a pretty good case Mach-II is moving forward by leaps and bounds. Hats off to the 3-man team that is keeping it moving along!