mmengel@cuuxb.ATT.COM (~XT4103000~Marc Mengel~C25~G25~6184~) (09/13/88)
In article <2854@utah-gr.UUCP> u-jleigh%sundial.utah.edu.UUCP@utah-gr.UUCP (Jason Leigh) writes: >I do not agree with your notion that using a '+' to concat two strings >causes 'sloppy' code. Such an allowance is called 'overloading' which >is a concept availabe on most modern object oriented programming languages >such as Ada and C++. The purpose of overloading is to enhance the >readability of code by hiding as much unnecessary information as possible. >I am surprised that after having written an Ada compiler, you never came >across overloading... Overloading is NOT equivalent to object oriented programming. Object oriented programming is a paradigm which *can* be used in *most* programming languages. (a variation on "Real programmers can write FORTRAN in any language...") Overloading when taken to the extreme creates a program that the author can read, but nobody else can. If you have to walk in cold and read mytype a,b,c; foo() { a = a + b; a++; c = c - a; } and guess that a, b, and c are vectors of linked lists, and "+" involves an O(n**2) combinatorial mixture of the two operands; the code is not clear. (sure you can document it with comments, etc. but the problem is that you can also *not* document it...). It is even more confusing if the "-" operation is unrelated to the "+" operation, etc. It may make perfect sense to the author, but some poor sod who gets hired to maintain the code 5 years later when a bug is discovered has to learn someone else's notation in order to make sense of the code. Smalltalk is the only language I know of that *forces* you to operate within the Object Oriented paradigm. C++ allows some syntactic sugar on the front of C, but not much else (There are many who disagree on this point -- flames to me, not the net). Ada doesn't really provide any concept of classes, sub-classes or inheritance, so it doesn't have many built-in's for Object Oriented programming, although you can construct such a system. >Jason Leigh -- Marc Mengel mmengel@cuuxb.att.com attmail!mmengel {lll-crg|mtune|att}!cuuxb!mmengel
sommar@enea.se (Erland Sommarskog) (09/15/88)
Marc W. Mengel (mmengel@cuuxb.UUCP) writes: >Overloading is NOT equivalent to object oriented programming. Object oriented >programming is a paradigm which *can* be used in *most* programming languages. >(a variation on "Real programmers can write FORTRAN in any language...") There are they who say the opposite. Thus, you must have an OO language to do OO programming. And I am bound to agree. Some of it you can do in any language, but you will get very little help from the compiler. And some things you can't do. One important feature for object-oriented programming is garbage collection. >Overloading when taken to the extreme creates a program that the author >can read, but nobody else can. If you have to walk in cold and read > (example deleted.) I don't know if this is an argument against overloading. Of course one make mess with overloaded operators. But so you can with names too. Call all your functions 'a', 'b' etc. Or call them "addint" when they are doing searching. >Smalltalk is the only language I know of that *forces* you to operate within >the Object Oriented paradigm. C++ allows some syntactic sugar on the front >of C, but not much else (There are many who disagree on this point -- flames >to me, not the net). Ada doesn't really provide any concept of classes, >sub-classes or inheritance, so it doesn't have many built-in's for Object >Oriented programming, although you can construct such a system. First: Ada isn't an object-oriented language. But it gives better support for object-oriented progamming than many non-OO languages do. But if you want to use the paradigm throughout, you should go for a real OO language, like Eiffel. Next: Object-oriented programming and overloading don't go hand in hand. Eiffel, which is probably the most object-oriented langauge, there is, doesn't have overloading. I'm reading Meyer's book right now, and haven't fully learned the language, but I can't see how overloading should fit there. -- Erland Sommarskog ! "Hon ligger med min b{ste v{n, ENEA Data, Stockholm ! jag v}gar inte sova l{ngre", Orup sommar@enea.UUCP ! ("She's making love with best friend, ! I dare not to sleep anymore")