ModelGlue Development Cheat Sheet
When my team and I first began building our Model-Glue:Unity application, we experienced a GREAT deal of head scratching and frustration during the development process. We would alter a line here or there, refresh our browser, and NOT see the change. It took us quite some time to finally figure out what kind of action was warranted for what kind of change in order to make it manifest, so we documented it for ourselves in our local Wiki.
Following are the guidelines and shortcuts we came up with to make our development a wee bit less frustrating. I don't claim to have the market cornered on understanding all of the nuances and functionality of MG:U, so please, feel free to let me know about any changes or additions you feel would benefit those who read it.
There are essentially two modes of operation in ModelGlue: Development and Production. What each of these modes entails is actually user-definable since MG provides several different options that can be associated with each. For instance, you can be running your application in "production" mode and yet still opt to display Model-Glue debugging information. For the purposes of this post, "Production" will imply that all options associated with development have been disabled and the application is configured to run at its maximum speed.
In order to toggle between development and production modes:
Following are the guidelines and shortcuts we came up with to make our development a wee bit less frustrating. I don't claim to have the market cornered on understanding all of the nuances and functionality of MG:U, so please, feel free to let me know about any changes or additions you feel would benefit those who read it.
ModelGlue:Unity - Modes of Operation
(Note: ALL of the settings required to perform the following functions reside within the Coldspring.XML file)There are essentially two modes of operation in ModelGlue: Development and Production. What each of these modes entails is actually user-definable since MG provides several different options that can be associated with each. For instance, you can be running your application in "production" mode and yet still opt to display Model-Glue debugging information. For the purposes of this post, "Production" will imply that all options associated with development have been disabled and the application is configured to run at its maximum speed.
How to Toggle Modes
In order to toggle between development and production modes:
- change the "reload" property in Coldspring.xml to "true" for development or "false" for production;
- edit the "debug" property, setting the value to "true" for development or "false" for production;
- ensure that the "Mode" property in the Reactor bean definition is set to the value "Production" for production, or "Development" for development;
<property name="reload"><value>true</value></property>
<property name="debug"><value>true</value></property>
<bean class="reactor.config.config" id="reactorConfiguration">
...
<property name="mode"><value>development</value></property>
</bean>
<property name="debug"><value>true</value></property>
<bean class="reactor.config.config" id="reactorConfiguration">
...
<property name="mode"><value>development</value></property>
</bean>
settings for development mode
<property name="reload"><value>false</value></property>
<property name="debug"><value>false</value></property>
<bean class="reactor.config.config" id="reactorConfiguration">
...
<property name="mode"><value>production</value></property>
</bean>
<property name="debug"><value>false</value></property>
<bean class="reactor.config.config" id="reactorConfiguration">
...
<property name="mode"><value>production</value></property>
</bean>
settings for production mode
Refreshing During Development
Because ModelGlue:Unity maintains some objects, values, and settings in scopes that aren't typically refreshed, certain types of modifications require certain actions in order to make them manifest. The following matrix covers the typical mods that require specific reset actions.| Modification | Reset Action |
|---|---|
| Change to ModelGlue.xml (or any XML file included in Modelglue.xml) |
|
| Changes to Coldspring.XML |
|
| Change to a controller cfc | re-initialize the app by going to the url [app url]/?init=true (http://www.myMGapp.com/index.cfm?init=true) |
| Change to a model cfc | all changes should be visible real time...just refresh your page! (note: IF the cfc you edited ALSO happens to be injected into a controller, then you'll have to follow the steps for "changes to a controller cfc") |
| Change to the database | Reactor needs to be reset. This is accomplished by:
CRITICAL NOTE! Reactor is a LOT like Wendy's...it doesn't make till you order it. What this means is that, even though you may have reinitialized the app AND Reactor is in Development mode, that one little record object you needed to be recreated WON'T be recreated UNTIL you actually call the portion of your code that asks ModelGlue for it. SO, be sure you leave Reactor in Development mode UNTIL you get to the portion of your code that actually USES the object you were trying to refresh. Ya feel me? relevant portion of Coldspring.xml file
<bean id="reactorConfiguration" class="reactor.config.config">
... <property name="mode"><value>development</value></property> </bean> <property name="rescaffold"><value>true</value></property> |
| Change to a View | All changes should be visible real time...just refresh your page! |
| Change to Reactor Dictionary file (model/data/reactor/ Dictionary/[table name].xml) |
All changes should be visible real time...just call your event again! |
Again, any additions or corrections that need to be made to this matrix, please shoot me an email (via my funky resume) or leave a comment (if you can pass the Turing Test).
Doug out.Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Re: ModelGlue Development Cheat Sheet
If you could provide a print view for your blog, that would be great. When I print out some of your posts, some of the codes get cut off at the end because of the horizontal scrollbar.
Posted by Lola LB on September 8, 2007 at 7:25 AM
Re: ModelGlue Development Cheat Sheet
Good job!
I also did a small writeup on reloading Model-Glue apps with an alternative way here:
http://boyank.blogspot.com/2007/09/howto-reload-model-glue-applications.html
I also did a small writeup on reloading Model-Glue apps with an alternative way here:
http://boyank.blogspot.com/2007/09/howto-reload-model-glue-applications.html
Posted by Boyan on September 8, 2007 at 11:34 AM
Re: ModelGlue Development Cheat Sheet
Thanks Boyan! I like the approach you took...definitely ensures that EVERYTHING gets reloaded.
Posted by dougboude on September 9, 2007 at 2:41 AM

