"Jonathon Sisson" <[EMAIL PROTECTED]> wrote

> As a side note, does anyone have a good argument for access level
> controls like C#?

These kinds of controls do help in large projects with many
teams, often geographically dispersed. It is a form of
documentation about the intent of the class designer,
but also enforces that intent. This is espectially important
during the early development of libraries where the internal
representation is constantly evolving.

The use of these access modifiers also provides an extra
level of namespace control in some cases.

However, that having been said I think anything beyond
public/private is overkill. I actually like the Delphi 2 model
(they have since added protected etc) was a good compromise
where implementation section(*) attributes could be seen
within a module even by other classes, but not outside
the module. By combining that with public/private declarations
in the class you had good control but much less confusion
than in C++ etc.

For smaller programs the whole mess is overkill and the
Python approach of consenting adults makes much more
sense IMHO.

> I personally think it's a waste of time (much like
> C#/ASP.NET...my apologies to any .NET fans out there...)

The whole .NET thing is pretty neat, except that it could have
all been done using Java and thius avoided a language war.
But multiple languages compiling to a common runtime
all with a single class library is powerful medicine...

> end up doing is creating "service methods" that allow access 
> anyways, so
> the margin of "security" is lost).  Thoughts?

And here I agree. So called getters/setters for every attribute
are a JavaBeans kluge that eats away at the very essence
of OOP - like so much in Java... Appropriate accessor methods
are fine but they should be used with great caution, classes
should expose behaviours not attributes!

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to