[MUD-Dev] [TECH] [ObjC] : programming languages - Obj-C as opposed to Java

Adam Martin ya_hoo_com at yahoo.com
Wed Aug 15 10:52:01 New Zealand Standard Time 2001

----- Original Message -----
From: "Brian Hook" <bwh at wksoftware.com>

> Anyway, I don't mean this to be some advocacy rant, but for those
> that are still developing tools using stone age crap like MFC/C++
> and that have the ability to consider other platforms for tools, I
> would highly, highly recommend examining Cocoa/MacOS X.  This
> isn't a simple "20% better" situation -- this is several order of
> magnitudes better, both in terms of access to technology
> (e.g. there is an NSOpenGL view built into the frameworks) and the
> ability to rapidly develop user interfaces (Interface Builder is
> extremely impressive).  Not to mention that Objective-C (basically
> a C-syntax variant of SmallTalk) is leagues beyond C++ or Java
> when it comes to syntax, maintenance, readability and general OOP
> cleanliness (the fact that Java FORCES integration of the
> interface and implementation details is just mind bogglingly
> stupid).


> What is particularly amazing is that the object frameworks and
> language used by NeXT over ten years ago is STILL better than the
> most commonly deployed frameworks and languages in use today (MFC,
> C++, STL, Java, AWT, Swing).

> Okay, I'm done =)

I had a look at the ObjC FAQ at
. Having started in C and some C++ I moved to Java a long while ago
and have stuck with it as the lesser of many evils. The ObjC FAQ
gave the following as the only differences between Java and ObjC
(well, they mentioned pointless stuff like "different syntax: colons
for fullstops", etc):

    "Features that Java adds include mandatory typing, exception and
    thread support in the language, security managers, name spaces,
    predefined class libraries (java.lang, awt), etc.

    Features that Java misses include categories and the selector
    type.  No categories means that a class can not be amended to
    suit your needs (a problem suffered by more OO languages,
    including C++).  No selector type means that `forward::' and
    `perform:' methods do not exist, and that the possibilities of
    dynamic binding are limited; e.g. you can't tell an array to say
    `@selector (hello)' to all its elements, and the buttons in your
    GUI won't be able to use the target/action paradigm employed by
    the OPENSTEP AppKit (and which is why inner classes were
    invented in Java 1.1)."

Unfortunately that doesn't explain to me what "selectors" and
"categories" actually are (and bear in mind that the things listed
as Java-only are pretty serious stuff).

Looking at some tutorials etc, the only hugely different aspect of
ObjC I could see was the "ability for sublasses to pose as their
superclass" - this being the single most annoying spanner that Java
throws into the OOP works (background: Java Language Specification
essentially gives the programmer almost no control over polymorphing
of objects - e.g. if you have "circle extends shape" and circle
overrides methods in shape, that circle is actually in many
situations going to be treated as a shape and THERE'S NOTHING YOU
CAN DO ABOUT IT...so that aspect of OOP gets shot in the head fairly
early on).

Your comments about "Java FORCES integration of the interface and
implementation details" I agree with wholeheartedly - but haven't
found a reference yet to how ObjC does it differently? Could you
expand a little bit on that?

In the interests of being able to make better use of OOP, I'd like
to switch to a better language than Java, but without going into the
current benefits of Java (including some of the extremely useful
stuff starting to appear in 1.4 as the libraries start to mature a
bit), there must be more reason than that to justify branching into
a new language.

Adam M
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list