Learn something new, times 2
This was a great weekend for me and I think for our little project. First, Mike Henke helped a ton in ferreting out some issues with the framework on Linux. Thanks, Mike! What I learned was that component names are case sensitive on Linux. Having programmed nothing but perl on linux, I never knew this was the case. It's perfectly sensible... I just never knew it. At risk of looking like a total n00b, there's something else I didn't know about CF, or else I knew it but quickly forgot it since it's not something I've ever had a reason to do. Prepare to laugh. I did not know that a subclass of a component could override a private method with a public one and then call that private method via super(). Didn't know it. I do a lot of java programming, and you can't do it in Java. I assumed you couldn't in CF. I'm not talking about the super part. I'm talking about the private part. In Java, private is private and you ain't seein it if you ain't the object. There is no inheritance. Your children starve. But you know what they say about assuming... Anyway, thanks to Sean Corfield for showing me the light. The net result of this was an additional bit of functionality in MXUnit with respect to testing private methods. Now, it supports two styles: one is a direct function injection into a precreated object. The other is the creation of a new object that extends the object in question and overrides the private function under test. The differences in approach are discussed here: http://mxunit.org/doc/index.cfm?doc=testprivate Regardless of the approach one takes (the code is virtually identical in either case), it should lead to easier testing of private methods without the maintenance headaches of a more traditional approach. So, it was a great weekend: learned new things, improved the framework, improved the documentation, and drank more Dalwhinnie 15. If only it weren't too damn cold outside for a Fuente.
Subscribe to: Post Comments (Atom)
No comments:
Post a Comment