|
Bartell, Aaron L. (TC) wrote:
I'll agree that it kinda works in RPG, but not necessarily a good job. What if I want to have multiple instantiations of the same object in my program? D addr1 s TYPE(ADDRESS) D addr2 s TYPE(ADDRESS) addr1.setCity("Denver") addr1.setState("CO") ... addr2.setCity("Chicago") addr2.setState("IL") and then let's say I want to pass that address into my tax calculation routine. . . tax = calcTax(35.12:addr1) Now calcTax will have my addr1 object and all of its functions (getCity, getState, etc). You can emulate this with data structures, sort of, except you don't get the functions of the object. The other cool thing about having a create-your-own-datatype approach is that there most likely will be a base object much like java has -- Object. Now if I want to have a vector full of different types of objects I can. There are a lot of other bennies that could be listed also. Yes this can be programmed into RPG to a certain extent, but it should be seen as such a fundamental aspect of a language that it should be at the compiler level vs. application, IMO.
Aaron: The question basically boils down to: "Should RPG become an object-oriented language?", right? OO is good, and personally, I'm a big fan of it. However, a heck of a lot of work would be needed to shoehorn RPG into an OO language, and in my opinion, it would still never be a good OO language. 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. One problem with compiled languages is that they like to have strong type checking, which unnecessarily complicates OO models, IMO. Sure, strong typing can detect certain coding errors at compile time. But more often than not, it's a nuisance to get rid of all the type mismatch errors by recasting the types of object references. (Then again, frequent use of recasting may indicate a poor design to begin with!) Interpreted OO languages do not burden you with things like interfaces, virtual classes and functions, type recasting, etc. Bottom line: If you want to do OO development, then you should probably be using an OO language. 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.