|
Any good OO language allows at least some level of "meta" programming.
In Java its reflection:
void showFields(Object o)
{
Field[] fields = o.getClass().getFields();
for (int i = 0; i<fields.length; i++)
{
Field field = fields[i];
field.setAccessible(true);
try
{
System.out.println("A (possibly private) private field is
"
+ field.get(o));
field.set(o, a_new_value_for_a_private_field);
} catch (IllegalAccessException e)
{
e.printStackTrace();
}
}
}
"Joe Pluta"
<joepluta@xxxxxxxx To: "RPG programming on
the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
thers.com> cc:
Sent by: Subject: RE: back to:
improving rpg. was: what is object oriented programming
rpg400-l-bounces@x
idrange.com
08/05/2003 03:18
PM
Please respond to
RPG programming on
the AS400 /
iSeries
> From: Hans Boldt
>
> Regarding Python's method of data hiding, sure you can get around
> it. Just like you can get around the data hiding in C++ by coding
> "#define private public". Any good programmer can get around the
> data hiding features of any language, and so honoring the data
> hiding wishes of the class programmer is always a matter of
> programming protocol, and not a matter of OO programming language
> design. That is, enforcing data hiding is a project management
> problem, not a programming language design problem.
Finally, a concrete statement. And patently false. In Java, you call a
method from a factory that returns an object that implements an interface.
Only the interface is known to you. You have the source to neither the
factory nor the final class, nor to the interface which it implements.
Please show me (without using the debugger, or some hokey
serialize/unserialize boogums) how to access a private variable in that
object.
In Python, it's simply an assignment.
In any event, this is a collosal waste of time. But still I feel compelled
to argue these points with you because you are, whether you like it or not,
an authority figure here, and you might want to take the time to
distinguish
between agreed technology and your opinion when making statements, because
frankly you're at odds with the rest of the world in many areas.
At least when I spout my scatter-brained opinions, I clearly delineate them
as such. You declaim your opinions, even when they are diametrically
opposed to conventional wisdom, and state them as if they were fact. This
is very dangerous for anybody who listens to you and doesn't know better.
One more time: information hiding is an OO concept. Period. I didn't say
it. The guys who invented this stuff did. Read their works.
Joe
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.