Mach-II: My Final Words
I've been a little gun shy about posting recently. I stopped responding to a post about the use of the This scope. I did not follow up on the arguments for/against my actions with Mach-II. I did not follow up on anything because I got some rather negative feedback from people I respect. Their main argument basically came down to me looking bad because I was advocating altering a framework for perceived optimization.
This is my response on the matter, and if it gets me into more trouble, then so be it. The client I was working for was moving from ColdFusion to ASP. They were running on ColdFusion MX 6.1 and were not going to upgrade. They had a Mach-II application that had 363 method calls per page (213 mach II and 150 non-Mach II), which should not be the case. They were experiencing a HUGE delay per page for more than one or two people at a time and needed it fixed NOW. Yes, I altered Mach-II, along with other code, and it had a positive effect.
Were the number of method calls normal for a Mach-II application? Probably not. If any application used that many method calls, the writer would be shot, so this had to be an abnormal case. Would my alterations show any real speed increase in a well-designed Mach-II application? Again, probably not. I expect that a well-designed Mach-II application would use far fewer method calls and the total savings from the changes I made should be negligable. There are still a few places in Mach-II where I see possible improvements, and these have been sent to the Mach-II team for official review and inclusion. Will they have significant savings? See my answer above.
In the case I mentioned above, the client was happy and the contract was fulfilled. Would I do it again? Definitely! Why?
Because I'm an employee. So are you. We work for someone. We can offer our suggestions to them, let them know what we've seen and heard and try to move them towards proper code and procedures, but at the end of the day we are just employees. The client is always right, and if we feel otherwise, we can either suck it up or get a new client.
I get called in on emergency contracts all the time. When something is going wrong and it needs to be fixed immediately, then I get the call. For the client mentioned above, it required a fast and dirty fix. For another client, it required a fast fix for their "memory build and crash" problem and then an analysis of how to fix it. Sometimes the analysis leads to suggestions that 'break' OOP, but the end result is always the same. Better code for better performance.
Do I disrespect frameworks? Not at all. I'm one of the founders of the Fusebox framework (a methodology at the time). Do I advocate altering frameworks directly? My last post stated quite clearly that I do not feel that a framework should be altered except by those that know what's going on. On the other hand, if you know what's actually happening in the framework, feel free to alter it. But if you do, realize that you are essentially "forking" the framework, and any upgrades made to the framework cannot be reflected in your code unless you make some hands-on alterations.
But that's the beautiful thing of open source. Anyone can fork it. Anyone can remove the parts they don't want or need in order to tailor the code to their use.


I'm happy your solution worked for you Michael, and I don't think anyone was or is disrespecting you when they simply disagree with you. Cheers.
The only comment I am going to disagree with is that 200+ method calls is fundamentally a bad thing. I would say that is you look at most Java or .NET apps doing anything worthwhile, you'll find thousand of method calls per page request once you've included all of the get and set calls and the like. Heck, if you move to Ruby, EVERYTHING is an object so every line of code that does something will be definition include at least one method call and ofter 4 or 5.
I haven't done load testing yet on the new framework I'm working on, but if it was really a problem to have a few hundred method calls in a page request in CF I'd have no option but to move to a language where method calls were less expensive. To date I have no reason to think that I will have performance problems, but I'll certainly keep you posted.
Will be interesting to find out!
I agree that you need as many as you need but I go by 'less is more'. My components are small, tight, and exact. A page on Fusion Authority has 2-4 component calls. A page of House of Fusion has 3-6. I can see a framework needing more with all the layers of abstraction but 363 seemed to me to be a LOT.
As for disrespect, you would be surprised as to what I was told. I was. very. But as the song says, "in the end it doesn't really matter". If anything it'll spur me to write more things to go against what we've been 'told'. Watch for an article on using the This scope soon. That'll cause some real controversy. :)
I tend to have a different approach to method calls which is "more maintainable is better", but I deal with projects where the maintainability of my architecture is quite a bit more important than optimizing performance, so I think our different preferences would come from different drivers (is a Ferrari or an F-150 better - well, "it depends" :->).
You really start getting into a lot of methods when you start encapsulating of getting and setting which is pretty much a best practice in OO development, but not necessarily the right way to code any given application. Especially if you use composition and custom data types, just displaying a list of 50 items each of which having 10 properties will run at the very least 500 method calls and possibly a multiple of that depending on how your app is designed. My approach is to code using OO best practices pretty much ignoring performance and I can always write a generator to create runtime files like Fusebox does if I run into performance issues.
I think sometimes peoples fingers get ahead of their good sense (I know if happens to me on occasion), but I'm sure that whatever was said the people who did so still have respect for everything you do in the community.
Looking forward to the posting on the THIS scope. I can feel I'm going to disagree with it already, but if people only posted stuff we agreed with, none of us would ever learn!