Mach-II 1.1.1 is released!

Congrats and a big thank you to Peter Farrell and Matt Woodward on the new release of Mach-II. Here is a copy of the announcement letter that went to the Mach-II list:

____________________
We are happy to announce that Mach-II 1.1.1 Stable has been released!
It’s been a great release cycle since our last release a year ago.
We’re already planning the new website and hope to have a beta of 1.5
some time after we finish the website.

Download the ZIP of 1.1.1:
http://mach-ii.com/code.cfm

Check out what we did in this release:

Bug Fixes
* Fixed ContentArg append bug
Since the ContentArg is placed in the event object you must copy that
arg or the entire event object when announcing new events! This is
expected behavior.

* Fixed redirect encoding bug
The redirect command did not URLEncodeFormat incoming event arguments.

* Fixed non-critical listener invoker mismatched argument name bug

* Fixed postProcess event name displayed in TracePlugin.cfc
PostProcess now reads “Core Process”

* Fixed strange “No Event-Handler Defined” exception bug
Mach-II threw an exception when the event name was “”. If the event
name is “”, the default event is announced as expected.

* Fixed framework loaded twice on initial startup bug
Framework loaded itself twice on inital startup when config mode is 1
(always)

* Fixed resultValue error bug
When a listener method returns void and the developer specified a
ResultArg/Key, an exception of “The ResultValue variable is not
defined.” is thrown. This occurs because ColdFusion deletes the var’ed
ResultValue variable in the invoker if a listner method return a Java
null or returns void. A better error is now thrown instead of the
useless exception that ColdFusion was giving.

Improvements / Enhancements
* Ensured that isPropertyDefined() method was used by framework instead
of using deprecated hasProperty() method.

* Improved granular control of trace output in TracePlugin by allowing
dynamic parameters

* Improved display quality and added additional data in TracePlugin
The trace plugin now displays the request event name, Mach-II version
number and timestamp.

* Improved command limitations
Allows the possibility of redirecting to another url without appending
event. For example, would
redirect to http://www.google.com?event= in 1.1.0. If no event name is
defined, Mach-II will now not append a blank event name.

* Improved load time on initial application load or reloads by about
25%

* Added a method that returns version number of framework
Call getPropertyManager().getVersion() in any listener, filter, plugin
or view to get the version number. Check out the Mach-II FAQs for more
information on the version numbering system.

* Added enhancement to turn of trace output on a per request basis.
This enhancement is important for AJAX integration. See the file header
in the TracePlugin.cfc for more information.

* Added better ColdSpring plugin integration
Added getListenerNames(), getFilterNames() and getPluginNames() methods
for even easier ColdSpring plugin integration.

* Added an enhancement to get the event name that started the request
lifecycle
Call getRequestName() method on the event object to get the event that
started the request lifecycle. This also works with exception events.
This does not work with redirects since ColdFusion aborts the request
before it processes the cflocation.

* Added Application.cfc support (new bootstrapper)
You can now leverage Application.cfc features such as
onSessionStart/End and onApplicationStart/End with Mach-II. See the
Mach-II FAQs for more information on implementing on using the new
bootstrapper. This feature is only available on ColdFusion MX 7+.
NewAltanta BlueDragon 7 is in beta at the time of this release and thus
this is an untested feature on BlueDragon. Check out the updated
Mach-II Skeleton for working code with the new Application.cfc support.

Also, there is an updated version of the Mach-II Application Skeleton.
This includes an Application.cfc version. You can find it on our code
page:
http://mach-ii.com/code.cfm

Thread safety example: Var scope your loop index in ColdFusion CFCs!

On the Dallas/Ft. Worth ColdFusion User Group email list, someone asked the question whether or not it is important to var scope your indexes in loops and items in loops of structures. While most agreed that it was important, one member contacted me off-list to make the case that Java actually manages the threading and it is a non-issue since ColdFusion 5. If you are new to this concept, the issue boils down to the fact that if you do not var scope local variables in a method, they are accessible and modifiable by other methods in the component since they reside in the variables scope. By adding “var” when setting variables in a method, you are protecting them from other processes outside that method. Example:

After attempting to make my case of why it is important (which fell on deaf ears) I thought it might be beneficial to write a short example that demonstrates a thread safety problem.

First, let’s create two components, ThreadKiller.cfc and ThreadSaver.cfc.

ThreadSaver.cfc:

<cfcomponent output="false">
	<cffunction name="init" access="public" output="false" returntype="ThreadSaver">
		<cfreturn this />
	</cffunction>
	<cffunction name="countUp" access="public" output="false" returntype="void">
		<cfscript>
		var i = "";
		for (i=1;i LTE 10;i=i+1) { countDown(); }
		</cfscript>
	</cffunction>
	<cffunction name="countDown" access="public" output="false" returntype="void">
		<cfscript>
		cool = "yeah";
		var i = "";
		for (i=10;i GTE 1;i=i-1) { /* nothing */ }
		</cfscript>
	</cffunction>
</cfcomponent>

ThreadKiller.cfc:

<cfcomponent output="false">
	<cffunction name="init" access="public" output="false" returntype="ThreadKiller">
		<cfreturn this />
	</cffunction>
	<cffunction name="countUp" access="public" output="false" returntype="void">
		<cfscript>
		for (i=1;i LTE 10;i=i+1) { countDown(); }
		</cfscript>
	</cffunction>
	<cffunction name="countDown" access="public" output="false" returntype="void">
		<cfscript>
		for (i=10;i GTE 1;i=i-1) { /* nothing */ }
		</cfscript>
	</cffunction>
</cfcomponent>

As you can see, these two components are virtually identical except for the use of the var scoping in the ThreadSaver.cfc methods. The downfall of ThreadKiller.cfc is the fact that in each iteration of the loop of the countUp() method, the called method countDown() will effectively overwrite the value of “i” setting it back to 1, creating an endless loop. In ThreadSaver.cfc, the two variables “i” are actually seperate containers and do not touch each other.

Now, let’s create our test page. Create a fiile named vartest.cfm in the same directory as the CFCs.

vartest.cfm:

<cfset Object = iif(StructKeyExists(url,"killit"),De("ThreadKiller"),De("ThreadSaver")) />
<cfset test = CreateObject("component",Object).init() />
<cfset test.countUp() />

done!

First, let’s run the “safe” test.  In your broswer, hit:
/vartest.cfm

When you run this, you will see that it did its work and then outputted “done!” on the screen.

Now we can do our “killer” test.  In your browser, hit:
/vartext.cfm?killit

Please note that this will spin up your processor until the request times out, and should only be done in a development environment in case you end up having to restart your ColdFusion instance.

When you run this, you can see that loop never completes and your server isn’t happy about it at all! Hopefully this will prove the point that it is definitely important to remember to var scope your index.

Does your framework control you?

This afternoon, I was having a discussion with another developer who I admire revolving around what we felt were the pros and cons of between Fusebox, Mach-II and Model Glue.  One comment that he made was interesting to me.  He mentioned his dislike of using XML as the controller.  I responded that from my understanding, one of the reasons that Mach-II, then later Fusebox 4 moved towards static XML was to put a stop to programmers putting in conditional programming logic in the controller, and in effect “cheating” the system.  His response was interesting to me in that he said that he felt that a framework should assist you rather than control you.

I can without any hesitation say that programming in an MVC framework such as Mach-II has shifted how I design applications, but it is certainly for the better!  Has it controlled me?  I don’t believe so, but it has certainly nudged (sometimes with great force) into building more robust and more scalable applications than I would have otherwise.   If that is controlling me, then I suppose I am all for it!

EDIT: comments were not carried over to this blog from my previous host.  I am pasting them inline below:

Mach-II assists you, by enforcing some control. How bout them apples.
posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Mark Fuqua said:
Not all frameworks are OO and not all are ridgid, check out this post:

http://www.jefffleitz.com/index.cfm/2006/11/14/Plu…

Mark

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

I sat in on a Plum presentation by David at CFUnited 05. For a number of reasons, it was definitely not my cup of tea. I am sure it is a great solution for some developers, but it certainly doesn’t fit me.
posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Mark Fuqua said:
I was there too and I felt really bad for Adam and David…that was a horrible presentation, for a variety of reasons. Take one hour and download it, play with it and see what it can do. It really is quite cool and that really was a bad representation of PLUM. Don’t even bother with the code generator, just take the time to check out how it handles security, verity, CSS and simple content management, even if you still don’t like it, if you give it a fair chance, it will impress. Even if nothing else, download it, set up one project and check out the custom tags and cfc’s it uses and the folder set-up it creates…really is quite cool.
posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Brian Kotek said:
I think saying “frameworks should assist rather than control you” is a double-edged sword. As you say, by forcing the controller to only concern itself with *controller duties*, the framework is forcing a best practice on you: separation of concerns.

Steve Nelson is proposing a fully CFC-based framework that hits to the heart of this argument. By eliminating the XML configuration for page flow (among other things of course), you are arguably giving the developer more flexibility, but you are also opening a potentially serious can of worms.

The argument would be the same as having a fence around your yard when there is a steep cliff on the other side of the fence. Does the fence limit your options in the yard? Yes. If the fence was gone, would you have more room to run around? Yes. But the lack of a fence also increases the likelihood of falling off the cliff if you are not very careful and dilligent.

In almost every case I have ever run into, if I or someone else feels like the framework is holding me back – that I NEED to have some logic in my controller and the framework won’t let me – it is actually revealing a problem with the design of the application, not the framework.

So, can good developers build well-designed and encapsulated MVC systems using non-XML frameworks? Of course, provided they are very careful about how they go about it. But since having business logic in your controller is a dangerous thing, I still don’t see the problem with eliminating this danger through the use of XML-based configuration and flow control. There are many benefits and very few real negatives.

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Nat Papovich said:
Brian – There’s the old saying that no programming language has ever made it the least bit difficult to hang yourself. And in many cases, the more powerful the language, the more rope it hands you. A similar (inverse?) situation exists for ColdFusion frameworks.

In effect, frameworks eliminate rope. The more rigid ones give you very little rope. The loosey-goosey ones like the original Fusebox 2 gave you LOTS of rope. I’ve met some horrible applications masquerading as Fusebox 2 applications. If you do something against Mach-IIs design, things blow up. If you do something against the principles of FB2, the next programmer wants to kill himself.

So we’ll agree that even a lousy programmer can write bad bad bad applications using “rigorous” frameworks such as Mach-II. It’s harder to do it with Mach-II than with, say, FB2.

But if you and I have seriously self-imposed rigor, why can’t we enjoy the benefits of those loosey-goosey frameworks? Not to brag, but I occasionally maintain the very first application I ever wrote (a stock trading application), written in Fusebox 2. It’s a joy to maintain because I beat myself up writing it just, ever so perfectly.

Now take a step back. Isn’t the debate about FB, M-II and MG just about the damn controller and views? Why is there so much religion here? The business logic is where the complexity is. If I had to, I could pick up FB2 again and it wouldn’t affect my productivity over, say, FB5. Don’t you agree?

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Brian Kotek said:
Hey Nat. There is no religion on my end. I use Fusebox, Mach-II and Model-Glue to varying degrees on different projects. They really aren’t that different. You are correct: the vast majority of the effort is in the Model. The Controller is primarily a traffic cop and nothing else.

Now, you and I (and many others) DO indeed have the self-imposed rigor to use the “loosey-goosey” frameworks. However, it took me a LONG TIME to get to the point where I think I can really see the design implications of different solutions, and I am learning more all the time. The beginner and intermediate users just don’t have the experience to make these determinations in most cases. In such instances, an XML controller is a Good Thing (in my opinion). On top of this, there is actually very little that an XML-based framework blocks you from doing (that isn’t probably a very bad idea).

So again, for widely adopted frameworks like The Big Three, I think the XML config provides structure, enforces good practice, and has very little downside. But as always, everyone is free to do what they like! If someone is comfortable with a less strict framework, or if the other benefits of frameworks don’t appeal to them (consistency, community support, etc.), I say go crazy!

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Steve Nelson said:
What i’m digging into with my new approach is that CFCs are a framework themselves. How you organize them determines whether the next programmer wants to hang themselves or not. Let’s face it, all modern ColdFusion frameworks are pushing CFCs. If CFCs are a framework, which i am beginning to think they are…do we really need a framework on top of the CFCs?

To play with Brian’s analogy, if we have a fence at the edge of a cliff, do we benefit by having a second fence? Yes, maybe.

I find myself utterly confused by most frameworks. Model Glue baffles me. Machii eludes me. Fusebox seems easy to me probably because I’ve been playing with this stuff for 10 years. But i can’t imagine someone that jumped into CF yesterday trying to get a handle on these frameworks. To me, they’re ALL too hard.

The big debate I have with everyone that i show this new attempt at Fusebox using CFCs is “Why put a cfinclude inside your cffunction? Why not just put the code there directly?”

Which is absolutely hilarious to me, because almost 10 years ago to the day I had the similar question of: “Why put a cfinclude inside your cfif/cfelse? Why not just put the code there directly?”

(we used cfifs before cfswitch existed in Fusebox 1.0)

I’ll post more about this stuff soon.

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Nat Papovich said:
Hey Brian – I know you’re not a framework-religious-type, and for that I’m grateful. I’m also happy that I can enjoy the (comparably) loosey-goosey frameworks. Naturally I look forward to Steve’s framework debut (currently codenamed “Foozbox”, right Steve?), even though I doubt I’ll ever reach for anything but my trusty Fusebox hammer, cfincludes and all.
posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Joe Rinehart said:
Not to shift the topic any, but there’s an interesting difference in perspective presented in this post that I’ve noticed between the Mach-ii and MG crowds. A lot of the Mach-ii developers I speak to think of the framework itself and the XML file as the “controller.”

In MG, which really doesn’t work much differently, the framework is designed to encourage developers to think of the controller as their “listener” CFCs (in Mach-ii-speak). Developers are responsible for “controller code” that marshalls client-side state (form, url, session, etc) into data (simple, complex, or CFC) that the Model can then use.

The XML file serves to configure application flow, not act as the MVC “Controller” layer.

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Jeff Fleitz said:
Steve, I am in your camp.

Let me preface this by saying I have every Fusebox book in existence. I have looked Fusebox up and down since version 2. I have also played with Model-Glue Unity and RoR, in addition to .NET stuff. I also highly respect everybody who has designed these frameworks and conributed to the community. I have been an independent all my career, and am just coming into ‘team development’; so having no real experience there, you can take this with a grain of salt.

I don’t get the XML controller issue either, and Mach-ii, Model-Glue, Fusebox (the big three, as Brian referred to them) confuse the hell out of me (not the OO coding, but the reliance on XML for configuration). I spent a couple months as the year rolled over taking a serious look at RoR (didn’t look into going there because we are primary a Windows shop and deployment was a bear). If you spend a lot of time reading blogs over there, you see a lot of posts by Java developers who want to flee into RoR, because of the existing configuration hell imposed by these XML configuration/controller files. These are people who are steeped in this stuff in their day jobs are are waxing about how free, and more productive they are by not having to deal with it.

I have been using Plum for the past three years, but Plum is really a CRUD code generator, unit tester and stored procedure generator. It uses CFCs for heavy lifting and tags for forms, etc. It just makes sense to me, because it doesn’t get in the way. It is almost an anti-framework, because it is just organized well, and works the way you would expect an app to work after reading CFWACK or ColdFusion MX Bible.

I just started a new job as a full time developer for a company after 10 years of being on my own (lousy at marketing). I was hired as a senior developer on a project that was supposed to be Fusebox 5. And I told them I had no Fusebox experience. But when I spoke to the developer I was replacing it was really Fusebox 4 with some Fusebox 4.1 stuff. “But we want to go to Fusebox 5″. Very well.

On my first day I found out the contract was not in place, so I was asked to take over a Fusebox 3 app which had stalled when the developer moved on. This was coming from a manager who is supposed to feel all warm and fuzzy that we are doing Fusebox development. After being with this company for 3 hours, I was pulled into a high-level meeting to discuss this project. I had just managed to get hooked up to the development server and take a look just before the meeting.

For the first time in my development life (20 years and counting), I was in a state of panic. I was not worried about my CF skills or the ability to figure out what the business pain/need was and solve the problem. I was freaked out about the fact that this app was written in Fusebox 3. I am not kidding. My new boss was telling the customer that we would have the problem fixed by the beginning of the week. I started backpeddling immediately. It was pretty funny, actually, now that I think about it. But it illustrates a point that many people feel in the community.

This stuff just adds a level of complexity to an app. Period. Is it worth it? I think it depends who you are and what your environment is. Since I have not been in an Enterprise team, I can’t comment. But for a lot of the smaller shops, I am not convinced it is.

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Peter Bell said:
Wow, lots of cool stuff – to respond to each item in turn:

@Dave – With you 100% – I think that a framework does assist you by limiting your options. You lose the option of throwing queries into your display logic, the option of sticking all of your MV and C scripts into one big directory and the option of putting all of your business logic in controllers. The biggest benefits of a framework are that they move you down well traveled, well proven paths and away from many of the cliffs that are out there for unwary developers. Even if you use your own framework, you should be limiting yourself in very similar ways.

@Brian – +1. I don’t like XML on the whole, but compared to letting developers sprinkle business logic throughout their controllers, it is an evil I’m prepared to live with :->

@Nate – For a good programmer working on their own who never needs to share their code, MVC frameworks are pretty irrelevant. But if you’re not that good, have to work with others or ever want others to work on your code (which is 80% of the time) that’s where community frameworks shine.

@Steve – CFCs aren’t a framework. They are a tool for putting data and functions together to allow for OO programming in CF. Best OO practices speaks to high cohesion, loose coupling, MVC, separation of concernse, etc., but cfc’s don’t enforce any of that. MG and M2 are hard because they are OO and without a background in it OO takes some getting used to – it isn’t as obvious as single page procedural approaches. I also think we’re new to OO in CF and we haven’t yet found the simplest way to explain all of this stuff. I would argue that if you’re baffled by MG or M2 then you DEFINITELY should spend more time on them. When they are “duh – of course you’d do it that way” then is the time to start to consider not needing them.

@Joe – Interesting. I’m working on my own little front controller, and one of my focuses is in using custom data types and conventions to completely eliminate controller coding, using a Spring Web Flow style approach (although not limited to wizards). I truly believe the perfect controller has no code.

@Jeff (and Steve) – Of course, there is no point in using OO coding or frameworks unless you need them. In my experience, once an app grows beyond a certain level of complexity, you start to have problems maintaining it as a procedural app. If that is the case, it is time to look at OO. No question most of the sample apps are so trivial, you could code them with in page page controllers and they’d be fine. As your apps grow, I’ve found a point where they become much more maintainable using OO style coding, but there is a substantial learning curve to getting over the hump so it needs to be an individual choice as to whether you want to make that leap or not.

posted 1500 days ago
Add Comment
Reply to: this comment OR this thread

Nat Papovich said:
Peter, you said “[with a framework] you lose the option of throwing queries into your display logic, the option of sticking all of your MV and C scripts into one big directory…” What makes you think that any of the Big Three removes the option of putting cfquery tags into view templates? And at least with Fusebox, you certainly can put all your code in one directory, in one circuit. You’re confusing frameworks with best practices. Best practices and convention over configuration (RoR) are what prevent you from doing the no-nos above, not a framework. Steve’s “framework” isn’t a framework. It harkens back to the FB2 days – a methodology.

Let’s not go down the OO path here. Frameworks != OOP. I have worked with some of the largest ColdFusion applications in the world, and there’s not a single whiff of OO in the air. Additionally, I have written pure Java applications, all in OO. You don’t need OO to solve the problems introduced by large procedural applications.

Steve’s not intellectually baffled by MG and M-II. What eludes him is the purpose of the frameworks: Why something so complex to solve such a simple problem? People can still do really stupid things in any front-controller-style framework. Why not provide a lightweight way to organize your code and place greater emphasis on best practices to avoid the morass?

posted 1499 days ago
Add Comment
Reply to: this comment OR this thread

Peter Bell said:
Hi Nate,

Great points. You’re right. A lot of the examples I gave weren’t very good as they are indeed conventions – not requirements of the frameworks.

I also agree frameworks != OO as there are frameworks that don’t require OO coding (like FB) and it is quite possible to write OO code without using a framework.

I’ll call you a little on OO, however. While I agree that strictly speaking you do not NEED to use OO programming to solve the problems of large procedural apps, I’d argue that on the whole OO apps are easier to scale and maintain than procedural ones. If they weren’t nobody would waste the extra time it takes to understand and write them.

Apologies to Steve – your description of his “bafflement” makes perfect sense. I think there are real benefits to community frameworks, but I’ll let the people that write and use them fight that battle. For my particular (and fairly unusual) use case I have learned a great deal by studying community frameworks, but none of them quite fit my needs, so I am developing a custom tailored framework (including DI and ORM as well as a pseudo-page interceptor and front controller) that meets my needs precisely. I still personally think that there is a real place for community frameworks for the vast majority of projects, but I’ll leave it to people who actually use them to continue that argument!

posted 1499 days ago
Add Comment
Reply to: this comment OR this thread

Peter Bell said:
And I have NO reason why I keep calling you Nate instead of Nat – sorry about that :->
posted 1499 days ago
Add Comment
Reply to: this comment OR this thread

Nick Kwiatkowski said:
One thing that keeps bothering me with all these discussions is the fact that people keeps saying “If you are not using a Framework, then your using procedural programming.” Frameworks don’t inciniuate OOP, and not using one dosen’t gaurentee that OOP is not in place. I don’t use a reconized framework for any of my projects; I usually write one using my own methodoligies on the fly. I personally tend to find that the modern frameworks add too much complexity and code to otherwise simple projects. Sure they tend to force stricter principals of what code goes where, but couldn’t that be self-imposed? To answer the obligitory questions, I do work in teams of people, and have worked on very large-scale projects. Having written contracts between components, decoupling components, and having clear methodologies on how your application is supposed to communicate with itself is the way to go for me — and it’s a lot quicker than a FB, or M2 application.
posted 1499 days ago
Add Comment
Reply to: this comment OR this thread

Sam said:
Steve and Nat: It’s great to finally know I’m not the only one!
posted 1499 days ago
Add Comment
Reply to: this comment OR this thread

Peter Bell said:
Hi Nick,

You said:

One thing that keeps bothering me with all these discussions is the fact that people keeps saying “If you are not using a Framework, then your using procedural programming.”

Who is saying that? I don’t see that being said anywhere at all?

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
Does anyone remember Joel on Software’s post circa 2001 about the Dreyfus Model of Skill Acquisition? At the beginner level, you follow the rules rigidly. As you gain experience, you start to not only understand those rules but internalize them. Finally, as an expert you’re not longer thinking about the rules but relying on intuition.

The problem with the current crop of frameworks is their rigid rules keep everyone at level one. While the frameworks themselves may rely on advanced concepts such as dependency injection and implicit invocation, developers aren’t really grokking those concepts. They’re just following the rules.

It’s true that if you give a programmer enough rope, he’ll hang himself. But it’s only a figurative hanging. He’ll live and learn from the experience.

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Maybe that works in a vacuum, but what happens when you mix in a few developers of different skill levels, a large and complex application, along with an aggressive deadline? Thats when rules, and stringent ones at that, become very valuable.

I think it might make more sense to describe the environment in which you work, when you pick a side in the framework/non-framework debate.

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Joe Rinehart said:
Hey Patrick,

I think that’s stating that the rules of the current CF frameworks limit skills development is wrong.

Reason 1:

It’s not until Mach-ii came along that many CF developers even realized implicit invocation existed, and now we’ve got a good population of people who’ve learned about it through Mach-II and MG and are applying it in Javascript, Flex, and other places. That’s evidence of recognition of a concept, application in the original context, and then mastery through re-application in a new environment.

Reason 2:

The concepts of II and DI in MG and Mach-ii don’t exist to limit people’s development: instead, they enable it. Most people (set excludes Peter Bell) don’t have the time or desire to learn implicit invocation or dependency injection by writing their own implementations. If the frameworks didn’t provide implementations of these concepts, more people would remain in a “rut,” doing tomorrow exactly what they do today.

Instead, frameworks make it easier to both take advantage of advanced concepts while expanding skills first through rule enforcement, and then through comprehension of the purpose of those rules.

Side note:

What’s with everyone saying the frameworks are so rigid? I feel a lot more flexible when I’m working in M2 or MG. The patterns enforce better design that leads to more flexibility, instead of allowing developers to box themselves in, creating rigidity.

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
“What’s with everyone saying the frameworks are so rigid? I feel a lot more flexible when I’m working in M2 or MG. The patterns enforce better design that leads to more flexibility, instead of allowing developers to box themselves in, creating rigidity.”

Well, the XML files in FB4+ are rigid by design. I’m not sure about the other frameworks.

I don’t understand why any XML file in any of the frameworks can’t be a CFML file. The XML file is read by some component that in turn sets up the framework, setting parameters, creating objects, and what-not. Why the extra layer of indirection? Why not just give me an API, let me create the objects and set up the framework directly via CFML?

I think there are two reasons most CF frameworks rely on XML.

First, they’re borrowing ideas from Java, writing simple set up / configuration code is much more involved. You spend as much time thinking about data types than the data itself. And then you have to compile it. You can’t read a class file of an existing app to see how it’s configured. You certainly can’t open it up in a text editor and make a simple change. So in Java, it’s preferable to include as much configuration as possible in a text file. If your configuration is too complex for a properties file, XML tends to get the job done pretty well.

CFML works fine for configuration, because a CFML file is a text file. But because we follow the rule from Java rather than understanding the reason behind the rule, we’re stuck with a bunch of XML files.

The other reason XML is so popular is that it’s easy to enforce the rules in an XML file. For example, if you don’t want people putting if statements in a particular context, don’t include an if tag in your XML grammar. (Or keep to a reasonable level by disallowing nested ifs.)

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Jeff Houser said:
Nick said:
“If you are not using a Framework, then your using procedural programming.”

And Peter asked details…

I’ve never heard anyone say that explicitly. But, there seems to be an underlying belief in the community that “Procedural” built applications are not maintainable, but if you use Object Oriented Programing then your app is maintainable. I believe that was the the idea Nick was trying to get across. ( He can correct me if he feels like it ).

I believe both these assumptions to be false.

A properly designed and documented application is going to be maintainable regardless of whether that design is Procedural based or Object Oriented based.

I can honestly say I’ve never seen a procedural application written in ColdFusion. Most older apps are written in a top-down manner. This means that each piece of code comes after the other until the page is complete. There is little thought to encapsulation of functionality, display code is mixed with business logic, and the whole thing is a mess. I believe spaghetti code is commonly used to refer to this type of approach.

I get the feeling that many programmers move from Spaghetti code to using an OO based approach (with a framework), and say “Procedural sucks, OO is more maintainable” without understanding that what there was nothing procedural in what they were previously doing.

I’d love to see CF introduce some procedures or subroutines functionality. CFML Custom tags are the closest thing we have, but being able to embed routines inside a page or CFC (Just like a cffunction) would be useful in some procedural designs.

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Brian Kotek said:
I agree with Joe that Patrick’s statement about frameworks “keeping people at level 1″ is not only incorrect but a gross oversimplification of the situation. Patrick, please give an example of how any or all of the frameworks are doing this.

Also, Patrick’s second post reveals that he is actually basing all of this on Fusebox 4. He doesn’t seem to be aware that because Model-Glue and Mach-II use Listener CFCs (Controllers in MG), that you aren’t being stopped from adding ifs or anything else you want in your controller. Fusebox 4 is more strict in that regard (but 5 allows nested ifs, loops, etc. so most of this criticism is moot anyhow).

There are a lot of advantages to using XML as the configuration language. To name a few: declared XML can be parsed by tools easily; DTDs within an IDE can provide tag and attribute autocomplete, validation, default values, etc.; decoupling application code from configuration almost always results in more easily maintained code. The Pragmatic Programmer (an incredible book) urges “put abstractions in code, but details in metadata”. When using frameworks, XML is the detailed metadata to set up the context for an application.

posted 1498 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
Brian,

I think it’s good that people are able to discover II via Mach ii, or IoC via ColdSpring, or MVC via MG. But if you’ve been using any of these frameworks for long enough, you ought to be able to explain the principles on which they’re built of the context of a framework. In fact, you ought to be able to build a similar framework from scratch. Maybe you’ve advanced beyond level 1, but if you can’t do that, you’re certainly not at level 5.

Every day, I read on someone’s blog how Framework X saved the day. Okay, how did it save the day? Going back to your pre Framework X code, what have you learned that you could have done differently? Where are those discussions? Outside of the framework developers themselves, I don’t see anyone demonstrating a deep understanding of the principles behind them.

Why does it seem no one can explain IoC without using the words “[Cold]Spring” or “XML”?

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
that should be “.. explain the principles on which they’re built OUTSIDE of the context of a framework”
posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Brian Kotek said:
You’re essentially asking two questions here.

First, just becuase you CAN build a framework from scratch doesn’t mean you should. You mentioned the same thing in your comments on my blog regarding ColdSpring. I’m not clear on why you seem to have such an overwhelming urge to reinvent the wheel on all of these things. Hey, if you want to go write your own framework, be my guest. No one is stopping you.

The second question is “why is framework x good” or demonstrating the principles that underly the framework and make it useful. I think you’re missing the point that the majority of the benefit that a framework gives you is not just in forcing best practices on someone (because in reality they can only nudge, they can’t stop one from making mistakes). The benefits of a framework are also in areas like community, consistency, employability, etc.

I don’t think anyone has ever said “you can’t build a well-structured application without a framework”. Of course you can. The same way you don’t need to use OO to build a maintainable application. I would argue that frameworks and OO certainly HELP you build maintainable applications, but it would be insane to say you can’t do so without them. I’m not sure why you’re making such sweeping generalizations and asserting unfounded things like “frameworks keep you at level 1″ or “everyone touting frameworks is ignorant of the pinciples behind them”.

You last sentence about ColdSpring seems to come out of left field. The benefits for XML configuration are well known and I described some of them in my last post. But ColdSpring doesn’t force you to use XML. That is just the most common way of using it. And IoC does not equal ColdSpring, it is just the most established and feature-rich IoC option currently available.

To conclude, I’ve known of you and corresponded with you for many years, and I’m not sure what happened to make you seem so jaded. But to be honest, lately it’s hard to tell if you are trying to make a valid point or just being deliberately contrarian.

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Joe Rinehart said:
Patrick,

> Why does it seem no one can explain IoC without using the words “[Cold]Spring” or “XML”?

You make a good point here – it needs to be stressed that the concepts are separate from the framework. When I talk on MVC or MG, I try to use a non-framework II example – usually, I use the idea of a button acting explicitly versus implicitly, whether in Javascript or some other client-side language. That’s when I start to see light bulbs really go on.

> In fact, you ought to be able to build a similar framework from scratch.

Sure, you should be able to write some sort of implementation, but why do it yourself when you can learn from those of us masochistic to learn about things like circular dependency resolution and the nooks and crannies of optimizing CF code?

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
“decoupling application code from configuration almost always results in more easily maintained code”

Yes, absolutely. In the old days when we used small words we use to call this separating the “what” from the “how.” I got lost when someone said the “what” mustn’t be Turing complete.

“The Pragmatic Programmer (an incredible book) urges ‘put abstractions in code, but details in metadata’.”

And on the same page (145) it reads “More powerful and flexible implementations of metadata use an embedded scripting language.”

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
> In fact, you ought to be able to build a similar framework from scratch.

“Sure, you should be able to write some sort of implementation, but why do it yourself when you can learn from those of us masochistic to learn about things like circular dependency resolution and the nooks and crannies of optimizing CF code?”

Not to mention documenting, promoting, giving it away for free, setting up a blog and a mailing list, answering questions, putting up with people like me…

When I said “build” I meant “prototype.” On the whiteboard. :)

Patrick

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Patrick McElhaney said:
Brian,

If you teach me something, the sure sign that I’ve understood it is that I can explain it back to you in my own words. That’s where the “build it yourself” comment comes from.

If you really want to know why I’m so jaded, email me off list. I don’t want get into that on poor old Dave’s blog. :)

I am trying to make a valid point, but I understand how it seems like I’m trying to be contrarian. Actually I’m surprised (and grateful) you haven’t given up on me.

Patrick

posted 1497 days ago
Add Comment
Reply to: this comment OR this thread

Patrick, if the reason you are against frameworks is info you wouldn’t mind sharing, I would be interested in hearing about it. I’m sure Dave wouldn’t mind :)

posted 1497 days ago

Gmail Tip: Muting and Unmuting conversation threads

I accidentally learned a new Gmail trick today. I was viewing an email and accidentally hit the ‘m’ key on my keyboard. This apparently mutes the conversation making that thread disappear from your inbox. This is a cool trick on its own, but what happens if you want to unmute it? In your Gmail search you can enter: is:muted, and you will see a list of all muted threads. To unmute, click into one and choose “Move to Inbox” in the select box at the top.

Using escape characters with MS SQL Server

This morning I was asked to do a quick and dirty query to find all rows from a table in MS SQL Server where a particular column contained one or more pecent sign (%) charaters.  Considering the ‘%’ character is a wildcard, I obviously needed an escape sequence, but oddly I had never run across this particular problem before.  After a quick search I found what appears to be a Microsoft-specific solution that suited my needs.  You can use an escape character in your ‘where’ clause, then define that character at the end of your query by adding {escape ‘[your character]‘} like this:

SELECT
MyColumn
FROM
MyTable
WHERE
MyColumn like ‘%%%’
{escape ”}

I would like to underscore that the backslash character in my statement can be whatever you need it to be in case that is another point of conflict for you.

Windows Vista is fast… just take Microsoft’s word for it.

Wow… just wow!

from this article:

Vista licensing also limits benchmarking

“According to the Vista EULA, because the OS contains “one or more components” of the .Net Framework 3.0, users can conduct internal benchmarking of those components, but can’t disclose the results of those benchmarks — or measurements to compare rival products — unless they comply with conditions found at a Microsoft Web site

The article mentions how the restrictions are very vague and confusing, and moreover since they are based on the company website, they could be changed at any time.

Maybe I have just gotten too accustomed to the open source community and how freely that kind of information flows, but this just seems silly to me.  If you put out a product, you should be proud to match it up against your competitors.