>Every time you need a single return value from a form class?
I won't say everytime because circumstances can be different. I will simply leave it with this: it is one of several alternatives available to a developer.
>
As far as the level of "cleaness", in what ways would a private variable be cleaner? Unless this is old news to everyone else, we can list the pros and cons of both approaches here or at the wiki.
>
Cleanliness is a point you have brought up. You suggested there are cleaner alternatives. I will leave it to you to flesh this issue out. Then, if compelled to do so, I will respond in kind. Until then, it would be difficult, if not improper for me to provide counter-arguments to an as yet to be defined argument...
>>Why not a public variable for these items?
>
>Why not? I dunno, but in that scenario, Private and Publics are pretty much the same, and I aviod using a public, so I use a private.
>
As long as the private is defined in the top-most program, I would agree. As a matter of practice, if something is supposed to have global scope, I declare it as such. From a documentation standpoint, I read private variables and global variables to be different things.
>
Ahh, I see. Bad grammar and rushed thoughts (there was a large line of students behind me in the computer lab).
<
A pitfall that will indeed be an impediment between thought and clarity...
<<
The paragraph explained where I would use a private variable, and then I attempted to say that I wouldn't use one to return a value from a class.
<<
That clarifies things a little. I feel fairly confident in saying that I don't agree with the premise you bring up with respect to abstract code, parameters, and private variables. I don't see the relationship between the level of abstractness and whether you would use private variables as opposed to parameters. Two, presuming the validity of the premise, I don't see how it supports your viewpoint that a private variable should not be used to return a value from a form.
For example...
Using your logic, if I have a "really" abstract form class that accepts user input and returns a value, shouldn't I eschew parameters in favor of private variables???
And...just to show how this issue can cut right between OO and private variables, what if you had the following:
oApp.ReturnValue
What if you had a returnvalue property on your global application object? What if your single-value form class directly referenced this item? Is it wrong? I don't think so? This gets to the issue of where frameworks obviate the need for 100% encapsulation. It is not a private variable. If anything, it is a global property. Globals are supposed to be bad...right? Or, is it OK for global properties????
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only