Ah, yes... Free code review. I love it. Thanks. As a solo dev, I rarely get feedback on my code. Especially from an expert.
I certainly subscribe to this (relatively) recent craze about correctly architected code. I've heard MANY podcasts on it in the past couple of years, and honestly, I can't get enough of it. It has caused me to re-write, and then re-write again many sections of my code.
So, help me get the full idea of what you've presented here. I do see the beauty in it, and I like the idea, but let me explain why I did it the way did (not that I'm trying to justify or convince you, or me, that I am right).
Your saying move the IF test into the called method, rather than addressing it where I did, at the higher level method, right? Now, the test is against a class property that will dictate wheter the target method should be called. I'm sure you see that. The reason I chose that architecture was so that I could call that target method from various other places,
irrespective of the controlling class property; which I sometimes need to do.
This let's me call the target low-level method outright and know that it will fire, otherwise, I'd have to (1) store the current value of the class property, (2) set it to true (3) call the target method (4) restore the original value.
I can see the case for it both ways.
>Text color in the editor is a personal preference, but I appreciate your blogging about things that people may not have thought of.
>
>However, I feel the need to add some things that affect comments
>
>1. There are several lines that look like:
>
>Adding all the dashes doesn't make it more or less of a comment. It just adds addtional characters that distract and add to the comment problem.
>
>2. Lots of code like:
>
>IF SomeCondition
> this.GetSomething(someParameter)
>ENDIF
>
>*-- Create some other object -------------------------------------------------
>IF SomeOtherCondition
> this.GetSomethingElse(someParameter)
>ENDIF
>
>It would be self documenting and not need any comments if it read
>
SomeObject = MethodCreateSomeObject(someParameter)
>SomeOtherObject = MethodCreateSomeOtherObject(someParameter)
>
>See the book Clean Code by Robert Martin
>
>
>
>
>
>>Just blogged about the COLOR of comments in your code window.
>>
>>
http://therealmattslay.blogspot.com/2009/08/color-of-your-comments.html>>
>>What color do you use? (assuming you "need" comments in your code, like I do <g>)