What are OOP's Jargons and Complexities?

John W. Kennedy jwkenne at attglobal.net
Mon May 23 18:15:03 EDT 2005


Xah Lee wrote:
> So, a simple code like this in normal languages:
> a = "a string";
> b = "another one";
> c = join(a,b);
> print c;
> 
> or in lisp style
> (set a "a string")
> (set b "another one")
> (set c (join a b))
> (print c)
> 
> becomes in pure OOP languages:
> public class test {
>   public static void main(String[] args) {
>     String a = new String("a string");
>     String b = new String("another one");
>     StringBuffer c = new StringBuffer(40);
>     c.append(a); c.append(b);
>     System.out.println(c.toString());
>     }
> }

The actual Java parallel to what you have written above is:

     String a = "a string";
     String b = "another one";
     String c = a + b;
     System.out.println (c);

> In the same way, numbers in Java have become a formalization of many
> classes: Double, Float, Integer, Long... and each has a bunch of
> "methods" to operate or convert from one to the other.

Byte, Short, Integer, Long, Char, Float and Double are wrapper classes, 
which exist chiefly to allow primitive content to be stored in 
collection classes.

byte, short, int, long, char, float, and double are primitives.

> Instead of
> aNumber = 3;
> print aNumber^3;
> 
> In Java the programer needs to master the ins and outs of the several
> number classes, and decide which one to use. (and if a program later
> needs to change from one type of number to another, it is often
> cumbersome.)

This has nothing to do with object orientation or classes, but with 
strong typing, which is important for program verification, and an 
inescapable necessity for compiling to efficient object code. Strong 
typing has been a feature of mainstream programming languages since the 
late 1950's.

-- 
John W. Kennedy
"The bright critics assembled in this volume will doubtless show, in 
their sophisticated and ingenious new ways, that, just as /Pooh/ is 
suffused with humanism, our humanism itself, at this late date, has 
become full of /Pooh./"
   -- Frederick Crews.  "Postmodern Pooh", Preface



More information about the Python-list mailing list