|
Jim Langston wrote:
Question on this statement, Hans:IMHO, OO is not a very good fit for compiled languages like RPG and COBOL and C. On the other hand, OO really hits its stride in interpreted languages like Object REXX, Python, Smalltalk, and Ruby.I'm a C++ programmer. Are you saying that OO is not well done in C++? Or that it could be better? Or just what are you saying? Right now C++ is my langauge of choice, and if it's a bad choice I'd like to know.
I suppose it's primarily a matter of personal choice. Personally, I prefer the interpreted OO languages (Python in particular) because of their flexibility and power. As I noted before, compiled languages tend to have compile-time type checking. Not that strong typing is necessarily better (although some would argue that point), it's just that in order to generate optimal code, compilers like to know the types of things ahead of time. And so, compiled OO languages tend to have compile-time type checking, which often means you need to recast pointers to the proper type. It also means tricky syntactical features like virtual classes/functions and interfaces. On the other hand, in an interpreted language, types are checked at run-time. Whether or not a particular attribute or method exists for an object is determined solely at run-time, which greatly simplifies the design of the language, since you don't need to declare references as belonging to particular classes, and you never need to recast the type of an object reference. In addition, interpreted languages (in some cases) allow you the power of "meta-class hacking", since a class is an object like any other. That is, you can create classes on the fly. Is C++ a bad choice? I think it really depends on the type of application. For systems programming, it has certainly been used to good effect. For example, in the Linux world, KDE is implemented in C++. The big issue with C++ is memory management. Other OO languages, especially the interpreted ones, have integrated memory managers with garbage collection. C++ requires you to be more concerned with memory management issues. In summary, there are always trade-offs. Compiled OO languages are generally less powerful, but can generate faster machine code. Interpreted OO languages are more powerful, but programs (generally) run slower. Cheers! Hans
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.