Having reflected on the pros and cons of various programming languages, I have reached the conclusion that maybe I like Java most. It is really just so great.
For example:
- Everything is references to begin with. Having forgotten for the hundredth time to add the star to an argument to a method in Objective C makes you appreciate this. No need for * or & or ->. Great.
- It's object oriented. The first time you do a collection/aggregation of data and logic and wrap it in a .c and .h file in C it brings a certain nostalgia to life. "This must be where the need of classes first arose" you say to yourself and feel the kinship with thousands of previous programmers, toiling in their sweat in the pre-C++/Ada eras. But the 2nd+ time you do it, it's really more of a nuisance than the joy of following a great tradition. Especially, lacking a compiler-supplied call to a constructor, having to provide an "init" function to set the data to the preferred state.
- It's garbage collected. I love garbage collection. Yes. There it is. I said it. It's out in the open. Or, what I love is not having to keep track an eye out for memory leaks, of course. On the flip side I also love having everything statically allocated at compile time, and never getting anything from the heap. Just to provide some dualism here.
- Dot notation. YES: myObect.setThing(a). NO: [myObject setThing:a].
- Name mangling and function overloading. initWithInt, initWithBool, initWithDouble, initWithAdAbsurdum... yeah right.
- Not as many slightly implicit ways in which objects can happen to get instantiated as in C++.
- No templates.
- No operator overloading.
- Especially no "new" overloading.
Yes, That sums it up good, I think.
lördag 15 maj 2010
Prenumerera på:
Kommentarer till inlägget (Atom)
Inga kommentarer:
Skicka en kommentar