I am having an issue with getting other programmers in tune with encapsulation...any good suggestions for whitepapers or something I can use to strengthen my case??
Thanks....
-
-
force them into making every field private and only exposing public accessors that don't manipulate the field directly... show them the value of that particular means of encapsulation.
...
either that or take some of their code that doesn't show good encapsulation and wreck it... -
Next time you get bad code from them ask them to explain to you exactly "How long is a Second" all the way down to the point where they can't think of any thing else.
At that moment you say that good encapsulation makes you objects so understandable to their users that they don't know how it works, how it was consived or how is implemented "it just is".
Every one know what a Second is but no one knows what "It, Really is".
Andres
-
Here is an article written by Steve McConnell for IEEE Software, Vol. 13, No. 2, March 1996, that you might find helpful:
Missing in Action: Information Hiding
You should be able to glean some arguments for encapsulation from this article.
Also, McConnell's book Code Complete has an excellent section on information hiding. It is section 6.2 in the old edition. Looking at the contents of the new edition, it looks like it is in section 5.3,but I haven't read it so I can't verify if that is true.
All developers should have a copy of Code Complete (well worn from reading of course) sitting on their desks.
Hope this is helpful.
~Bebo
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.