Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 1 - Jason Spain
While I agree with William Blatt that languages like java and C++ are
not purely object oriented languages, and that type checking during
compilation in java can lead to having to change a lot of code and design,
I believe that strongly typed languages that provide good ways to encapsulate
are the best choice for robust programming.
In the article, Object-Oriented Encapsulation for Dynamically Typed Languages,
the authors state strongly typed languages, such as java, have private modifiers
to help encapsulate methods and data types within the classes. This prevents
subclasses of a class, and clients of objects of the class from accessing
data that should not be accessed.
However, some dynamically typed languages like python or smalltalk, don't have any
concrete mechanisms for encapsulating data and methods in such a way that
data and methods which shouldn't be changed, can't be changed.
python does have naming conventions that make it harder to access so-called "private"
data and methods of objects, but in reality, all data and methods can be acessed from
a client program.
Also, in smalltalk, you have to manually check that you are not overriding methods from superclasses
and since subclasses could use any method from a parent class, there is no way to prevent subclasses
from using a method that by design should not be used because using the method may have dire
consequenses during runtime execution.
In conclusion, while languages like python and smalltalk may be good programming languages
for learning object-oriented programming principles, they are not nearly as robust
for industry level programming as java or C++, due to a lack of type checking and
strong methods for data and method encapsulation. There is no real strong "contract"
for how a client should interface with an object of a class, that can be written into
classes created in some dynamically typed languages like python and smalltalk and can be
automatically checked PRIOR to runtime.
Link to this Page