Application Generation

Musings on DSLs, DSM, Agile, SPLs and CFML by Peter Bell

Do you want to see this in LightWire?

leave a comment »

Thomas Messier recently blogged about supporting “arbitrary runtime constructors” in LightWire. Check out his posting and comment at the bottom as to whether you like or dislike the idea. If it’s popular enough (strong positives, weak negatives) it may end up in the core . . .

Written by peterbell

March 8, 2010 at 12:05 pm

Posted in Uncategorized

Presenting on “Spring Roo and Code Generation” at Code Generation 2010

with one comment

I just got acceptance last week confirming that I will be presenting a session on “Spring Roo and Code Generation” at Code Generation 2010 in Cambridge, England this June. Roo is a fascinating Java framework that uses some really interesting techniques to elegantly generate Java code allowing for much DRYer development than regular Java programming without the overhead of dynamically typed languages like CFML or Groovy.

As the session description notes:

“Spring Roo is a code generator / framework for quickly generating Java web applications. It uses some very interesting patterns for elegantly generating code. In this session we will combine study of the patterns used by Roo together with hands on experience of Roo as a generator. In addition to learning the basics of a specific generator, we’ll also be “consuming” a generator so we can explore the experience of using a generator and what we can learn from that when choosing or creating generators or tools for others.”

Code Generation is one of my favorite conferences of the year, bringing together some of the top practitioners and academics in the fields of Domain Specific Modeling and Code Generation. If you have an interest in learning how to develop custom applications more efficiently, I’d strongly recommend it.

Written by peterbell

March 8, 2010 at 11:55 am

Posted in Uncategorized

Confirmed bug in lightwire in xml placeholder code

leave a comment »

Please see John Whish’s excellent post and then go to the project site where the latest patched zip file now resides.

Written by peterbell

February 26, 2010 at 9:04 pm

Posted in Uncategorized

Co-presenting tutorial on oAW and DSLs at SPA Conference

leave a comment »

I’m excited to be co-presenting a tutorial at the Britich Computer Society Software Practices Advancement conference. Marina Haase and Mark Dalgarno are presenting a tutorial on OpenArchitectureWare from a different perspective — using DSLs in “every-day” programming and have asked me to co-present.

Thanks Marina and Mark!

Written by peterbell

January 14, 2010 at 6:09 pm

Posted in Uncategorized

Critical LightWire Error in Setter Injection for Transients

leave a comment »

LightWire is a lightweight Dependency Injection engine for CFML that I wrote a while back and is being used by a number of developers and projects.

Many thanks to Micky Dionisio for finding and documenting a critical error in LightWire. I saw the posting yesterday, but didn’t get a chance to replicate the error and post a patch until this morning.

This posting clarifies what the error is and how to patch it.

Please note this does NOT APPLY to the version of LightWire in ColdBox – which does NOT have this error.

Please feel free to pass this along to others, and if anyone else has a custom copy of LightWire they need a hand with, let me know as I’m more than happy to help out with the patching if anyone has any questions.

Side note – if you haven’t already, please update your feed readers to point to my new blog instead of the old one. It’ll make sure you continue to have access to any postings like this if you want them.

Summarizing the Problems

If you inject a transient into a transient, the injected transient is injected as a singleton – not a transient. This means that any changes you make to one of those transients will affect other instances of it.

Replicating the Problem

Here’s some simple code I threw together (Micky also posted good sample code on his posting)

<code>
index.cfm:
<cfscript>
BeanConfig = createObject(“component”, “scratch.lightwire.BaseConfigObject”).init( );
BeanConfig.addTransient( “scratch.transient1″ , “transient1″ );
BeanConfig.addTransient( “scratch.transient2″ , “transient2″ );
BeanConfig.addSetterDependency( “transient1″ , “transient2″ );
BeanFactory = CreateObject(“component”,”scratch.lightwire.LightWire”).init( BeanConfig );
transient1 = BeanFactory.getBean( “transient1″ );
transient2 = transient1.getTransient2();
writeoutput( “Transient 1 is called #transient1.getName()#<br />” );
writeoutput( “Transient 2 is called #transient2.getName()#<br />” );
transient1.setName( “I am transient 1 and I’ve been changed” );
transient2.setName( “I am transient 2 and I’ve been changed” );
writeoutput( “Transient 1 is called #transient1.getName()#<br />” );
writeoutput( “Transient 2 is called #transient2.getName()#<br />” );
transient1b = BeanFactory.getBean( “transient1″ );
transient2b = transient1b.getTransient2();
writeoutput( “Transient 1 is called #transient1b.getName()#<br />” );
writeoutput( “Transient 2 is called #transient2b.getName()#<br />” );
</cfscript>

transient1.cfc
<cfcomponent name=”transient1″ output=”false”><cfscript>

public transient1 function init() {
variables.instance = structNew();
setName( “I’m transient 1″);
return this;
}

public string function getName() {
return variables.instance.Name;
}

public transient2 function getTransient2() {
return variables.transient2;
}

public string function setName( Name) {
variables.Instance.Name = arguments.Name;
}

public transient1 function setTransient2( Transient2 ) {
variables.Transient2 = arguments.Transient2;
return this;
}
</cfscript></cfcomponent>

transient2.cfc
<cfcomponent name=”transient2″ output=”false”><cfscript>

public transient2 function init() {
variables.instance = structNew();
setName( “I’m transient 2″);
return this;
}

public string function getName() {
return variables.instance.Name;
}

public string function setName( Name) {
variables.Instance.Name = arguments.Name;
}

</cfscript></cfcomponent>
</code>

You’ll see that transient2b has the name assigned to transient 2 – NOT a good thing :-(

The fix is fairly straightforward. In LightWire.cfc there is a method called setterandMixinInject.

It includes the following code:

<code>
// If there are any setter dependencies
If (StructCount(variables.Config[arguments.ObjectName].SetterDependencyStruct))
{
// Inject them all
For (Key in variables.Config[arguments.ObjectName].SetterDependencyStruct)
{
If (key NEQ arguments.ObjectName)
{
evaluate(“arguments.object.set#Config[arguments.ObjectName].SetterDependencyStruct[Key]#(variables.getSingleton(key))”);
};
};
};
</code>

In the evaluate line (line 281 in my version, although it appears there are various versions floating around – something I’ll work on resolving next week), just replace variables.getSingleton(key) with variables.getBean(key). It’ll automatically handle singletons and transients appropriately then (you don’t need to add the conditional logic Micky did – that is what getBean() is for – to handle singletons and transients appropriately – and seamlessly).

There are two associated errors if you’re using addMixinDependency() instead of addSetterDependency().

The first is just a little further down in the same method just after the “MIXIN DEPENDENCIES” comment. It’s in the following code:

<code>

// Get current object name
If (Key NEQ arguments.ObjectName)
{
arguments.object.lightwireMixin(Config[arguments.ObjectName].MixinDependencyStruct[Key], variables.getSingleton(Key));
};

</code>

and again, just replace getSingleton(key) with getBean(key) to fix the error.

The second is a little further down in the method. In the following code:

<code>

// MIXIN DEPENDENCIES (annotations)
MixinInjectionList = arguments.object.lightwireGetAnnotations();
For (Count = 1; Count lte listlen(MixinInjectionList); Count = Count + 1)
{
// Get current object name
LoopObjectName = ListGetAt(MixinInjectionList, Count);
arguments.object.lightwireMixin(LoopObjectName, getSingleton(LoopObjectName));
};
</code>

You want to replace getSingleton(LoopObjectName) with getBean(LoopObjectName).

Here is a patched version of the LightWire.cfc.

The download at RIAForge has also been patched.

Thanks very much Micky for the detailed error report and also Brian Rinaldi for poking me to make sure I was checking it out :-)

FYI, Micky also mentions an issue with a singleton being treated as a transient. I was *not* able to replicate that and do not believe there to be a bug there, but I’ll circle round with Micky just to be sure and will post if any additional issues are found.

Written by peterbell

January 9, 2010 at 2:23 pm

Posted in ColdFusion/CFML

Presenting on Agile and Productivity at cf.Objective() 2010

leave a comment »

I have just found out that I’ve been accepted to present two topics at cf.Objective() this year.

The first topic (Lean, Agile and Kanban) will be an introduction to specific techniques from agile that can be used to improve the management and development of software projects. The second (Productive work environment/practices) will be a set of tecniques for developers to improve their efficiency covering everything from Flow and Pomodoros to keyboard shortcuts and creating custom “shims”.

I’ll also be on one of the teams for “The Duct Tape Programmer vs The Architecture Astronaut” which should be fun!

Thanks to the selection committee!

Written by peterbell

January 7, 2010 at 8:58 am

Posted in Uncategorized

2009 – A Year in Conferences and Publications

leave a comment »

2009 has been a really good year for me. Impossibly busy between work, travel, dating and improv classes, but I’ve learnt a huge amount this year and am looking forwards to leveraging a lot of that in 2010. Here’s a quick summary of the conferences I attended and articles I wrote in the last twelve months. Not quite the crazy pace of 2008, but still a decent years work!

My main goals for the year were to become more broadly known outside just the ColdFusion and Domain Specific Modeling worlds while still being actively involved with CFML and code generation.

Domain Driven Design

I kicked off the year with a well received presentation on Domain Specific Modeling to the Domain Driven Design group in New York. The presentation focused on the many synergies between DDD and DSM and inspired a video interview on domaindrivendesign.org.

Flex

While I haven’t had much of a chance to code in Flex this year, I managed to continue my Flex Authority series with an article on Automating the Build using ANT.

Program Committees

In addition to continuing as a member of the Code Generation conference program committee, I was really excited to be invited to join the program committee for the Domain Specific Modeling workshop at ooPSLA and the British Computer Society Software Practices Advancement (SPA) conference.

Groovy/Grails

I attended the inaugural gr8 conference in Denmark back in May. I also wrote an article for groovymag comparing Ruby/Rails and Groovy/Grails and presented on the gr8 conference at the New York Groovy/Grails meetup over the summer. I also signed up to co-organize the New York Groovy/Grails meetup although unfortunately I’ve been remiss at that and have not yet organized a meeting. Hopefully I can resolve that in the New Year. I also launched a “Getting Groovy” blog, but I really need to find some more time in the New Year to post some new content – especially about DSL’s in Groovy.

CFML

I presented on RAD OO at CF United Express in New York, RAD OO in code at cf.Objective(), and both RAD OO and Requirements and Estimating at CF United. I also presented a version of the Requirements and Estimating presentation at Scotch on the Road in London, and gave a RAD OO presentation at RIA Unleashed in Boston last month. I also wrote the forward for Luis Majano’s book on ColdBox – thanks Luis!

I’d have *loved* to present at CF in NC, but the timing was too close to another conference, and I had hoped to present at cf.Objective().anz, but in the end I just couldn’t make it down. Hopefully I’ll manage one of the antipodean conferences in 2010 as I’m missing Australia and would love to see a little more of the country (I never got to do much traveling when I was living in Sydney). I’m also hoping to manage a presentation or two in continental Europe in 2010.

Code Generation/DSM/Software Product Lines

I was on the program committee for Code Generation 2009, managed the birds of a feather sessions and moderated a panel on “The State of the Art in Domain Specific Modeling”. I also presented a case study on SystemsForge “A High Volume Software Product Line” at the inaugural conference on Practical Product Lines in Amsterdam and have been asked to contribute a small piece for an article in IEEE Computing based on the presentation for publication next year. I was also excited to have my first article published on InfoQ. It provided an introduction to DSL Evolution and I’m now working on another article on DSL Testing which I hope to have published on InfoQ in the new year.

In other news, I wrote an article in jsmag on jQUery UI, and presented a session on “solo scrum” at BCS SPA in London this year. I also attended the local No Fluff Just Stuff conference in Boston which was a great chance to actually attend a conference without having to present anything :-)

Looking back

I’m happy with what I accomplished this year. In particular I’ve been working on a large CFML project with some excellent developers and have got a chance to hone a number of skills – from agile project management to working with Continuous Integration servers in CFML. I’ve also continued to work on the SystemsForge software product line and have been busy with the Railo open source CFML engine which I use for pretty much all of my CFML development now unless there is a compelling reason not to. I’m also glad to be using git for pretty much everything now and have MX Unit and Selenium as my defaults for CFML unit/integration tests and UI/acceptance tests respectively.

Looking forwards

I’m embarrassed to say that I’m still not fully “test infected”. I blame it on lots of small projects and the extra complexity of TDD in a SPL/DSM environment, but the fact is I just haven’t taken the time to change how I do things. This year I’m looking forward to getting into a truly TDD flow with my projects.

I’m also looking forward to doing some more substantial projects in Groovy and Grails and I also hope to do some projects using Spring Roo and Scala. I’m starting to miss the nice code completion that static typed languages can offer and am looking forward to seeing how productive I can be using Roo and Scala respectively.

In the CFML world, my main focus will be “fast start” projects. Imagine being able to generate 80-90% of a real world application in your frameworks of choice and then being able to add custom code while still being able to regenerate the project as the requirements change. I’ve already got the ability to generate ColdBox apps and will be working on FW/1 and Model Glue generators early in the new year. I think this is a way I could add a lot of value to CFML projects by bringing in a great reference architecture, best practices for project management, coaching, *and* a substantial part of the application for a fraction of the cost and in a fraction of the time that other developers could offer. Expect to hear more about this (and feel free to hit me up if it sounds of interest!).

I’ll also be helping to present a long tutorial on openArchitectureWare, so I’m looking forward to writing some more practical generators using oAW (especially xtext). I love what the guys at Artemis can coax out of oAW and I’d like to see if I could leverage some of the capabilities of their tooling in my code generation projects. I’m also hoping to find some time to play with JetBrains new MPS. I’m fascinated by projectional editors and while I’m not sure it’ll be ready for primetime, I think the experience of using one will really help me to broaden the way I think about Language Workbenches.

So, not a bad year, and some decent plans. Still, looking at some of these guys it’s good to see how much more can be achieved in just a year!

Here’s to an exceptional 2010 all round! What are *your* main goals?

Written by peterbell

December 31, 2009 at 4:27 pm

Posted in Uncategorized

First Article Published in InfoQ!

with 2 comments

w00t I have just had my first article published in InfoQ :-)

It’s on Domain Specific Language Evolution.

Many thanks to the editor – Srini Penchikala – for all his help with the process.

Written by peterbell

December 22, 2009 at 7:07 am

Posted in Articles/Writing

Code Generation 2010 – Call for Speakers Ends Soon

leave a comment »

Just a reminder that the call for speakers for Code Generation 2010 ends on January 15th. It’s one of my favorite conferences of the year and I’d thoroughly recommend it for anyone with an interest in Domain Specific Modeling or Code Generation.

If you have an area of research or a real world case study, why not propose a session? Attendance is free for speakers and the attendees are always interesting, knowledgeable and engaging . . .

Written by peterbell

December 18, 2009 at 12:54 pm

Posted in Conferences

Presenting on DSL Design at SPA2010

leave a comment »

Again, a little late, but I’m happy to announce that I will be presenting at the Software Practices Advancement conference held by the British Computer Society for the third year in a row.

I’ll be presenting a workshop on “What makes a good Domain Specific Language?“.

Written by peterbell

December 18, 2009 at 12:48 pm

Posted in Conferences