
Java Was Strongly Influenced by Objective-C - thealphanerd
http://cs.gmu.edu/~sean/stuff/java-objc.html
======
SeanLuke
Wow, a pointer to an old page of mine, that's weird to see on HN. This post
was originally from comp.sys.newton.misc, back when I was a PhD student. Here
was the thread:

[https://groups.google.com/d/topic/comp.sys.newton.misc/Kb0Jo...](https://groups.google.com/d/topic/comp.sys.newton.misc/Kb0JoVv2ljA/discussion)

The discussion was originally about Java on the Newton, and someone had made
the goofy suggestion that Java was based on NewtonScript. Patrick Naughton
jumping in was an interesting ending to the thread.

As a side note: four years later I actually wound up writing the only version
of Java released on the Newton (Waba).

<http://cs.gmu.edu/~sean/projects/newton/waba/>

~~~
seanmcdirmid
That is quite cool! I wrote a JVM for the PalmPilot in 1998:

<http://www.cs.utah.edu/~mcdirmid/ghost/>

Lots of fun fitting the 1.0.2 class libraries into 180K (out of 256K
available, needed some space to run in!).

------
rayiner
Well Objective-C was influenced by Smalltalk, and nearly every modern OOP
language was also heavily influenced by Smalltalk. And of course there has
been over the years a lot of cross-pollination between Smalltalk and Java.
Hotspot was written by the team that had originally marketed a Smalltalk VM,
Gilad Bracha co-authored the JVM 2.0 specification and was also involved in
the Strongtalk Smalltalk implementation, and of course one of the key
developers of Hotspot, Lars Bak, is now working on Dart which is basically
Smalltalk with Javascript syntax.

~~~
nikster
I can't help but think that ARC has pretty much killed garbage collection. Why
use garbage collection at all when you have a static equivalent that works
just as well?

~~~
krichman
ARC is terrible, I've had far more errors with it than I ever did without.

~~~
Apocryphon
Do tell, please.

------
gilgoomesh
Which is why Objective-C++ is so much fun to have available in your Mac/iOS
programming toolbelt: it's the best and worst of two completely different
C-derived object-oriented language lineages in one schizophrenic package.

~~~
cageface
It's a terrible Frankenstein monster but it can be pretty useful. My most
popular iOS app is a synthesizer with a UI in Obj-C and a DSP core in pure
C++. Interfacing the two is pretty trivial thanks to Obj-C++.

I've been considering a port to Android but all the JNI boilerplate I'd have
to write is putting me off.

~~~
asveikau
I'll agree that JNI is inelegant, but having recently written a small amount
of JNI glue with the NDK for a hobby/side project, I have to say, once you get
going it won't be a big deal. If that's really the only barrier to an Android
port, I say bite the bullet, sit down and do it.

~~~
cageface
I need to do it anyway. I'm taking on more and more Android work and I know
sooner or later I'm going to have to dig into the native layer. Thanks for the
words of encouragement.

------
sippndipp
So how comes that they missing out all the cool features like
"performSelector", "respondsToSelector"? Sure the whole OOP part may comes
from Objective-C (SmallTalk to be precise) but the dynamic parts were poorly
executed.

~~~
malbs
Not to mention the fact that they completely ignored class methods.

No, static methods do not count.

~~~
i386
Out of curiosity, why do statics not count for class methods?

~~~
hboon
They are closer to global functions that are attached to classes and don't
support inheritance the same way as instance methods. e.g. if a subclass
implements a static function with the same signature as its parent, and you
call it with the parent class, it invokes the parent class version instead of
the subclass version.

Class-side methods in Smalltalk are inherited, working with classes (as an
object) is analogous to how instance-side methods work with instances (also
objects). So e.g implementing and using factory methods are simpler in
Smalltalk and similar languages.

Edit: grammer and typos.

------
nikster
That might explain its complicated syntax. Better than obj-c but worse than
nice languages like Ruby or Python.

Also, if they were influenced by Obj-C then why on earth didn't they bring
over the by far most useful feature of the language, caegories?! Or maybe
categories were a later addition?

I have been developing Java for 15 years and ObjC only for two but categories
are seriously the best thing since sliced bread. Anything missing in the
libraries? Just add it!

~~~
cageface
A lot of the newer JVM languages provide better equivalents to Obj-C
categories. Most of them also let you mix in instance variables along with
methods. Check out Scala or Kotlin for specific examples.

~~~
mpweiher
Objective-C categories nowadays can include instance variables :-)

~~~
cageface
Really? Since when? Do you have a link to docs? I've seen some hacks involving
associated references but it was my understanding that categories were not
allowed to add instance variables because Apple would have to make member
access much slower to allow that kind of extension.

~~~
mpweiher
My bad: they are allowed in class extensions, which are similar to but not the
same as categories.

Given how the new non-fragile ivars are implemented, it _should_ be possible
to add ivars anytime before the first instance is created (so load time should
be OK), but that has apparently not been implemented, class extensions only
work for code compiled together.

So I guess no dice, apart from associated objects or the old indexed-instance-
variable tricks:

[http://markmail.org/message/b5aqssv3iowcsw2i#query:+page:1+m...](http://markmail.org/message/b5aqssv3iowcsw2i#query:+page:1+mid:b5aqssv3iowcsw2i+state:results)

Alas, those tricks break on bridged CF classes that have incorrect metadata:

[http://markmail.org/message/yourm4nkghaf3bak#query:+page:1+m...](http://markmail.org/message/yourm4nkghaf3bak#query:+page:1+mid:pb57oyiiyp3vfomn+state:results)

(Checked on 10.8, instance-size for CF objects still incorrect)

------
timthorn
Fascinating that this snippet is from comp.sys.newton. I've forgotten all my
NewtonScript, but do remember the richness of the Newton programming model.

------
zackzackzack
I'm twenty-one and the email referenced something called "Excited Live". Can
anybody explain what that was? Google hasn't been much help.

~~~
georgemcbay
Excite Live! was one of the many services (circa ~1996) offered by Excite,
which was kinda-sorta like Yahoo (search, web site directory, etc, etc) but is
mostly remembered today as the company that could have bought Google for
pennies but passed on it.

<http://en.wikipedia.org/wiki/Excite>

<http://www.excite.com>

I briefly worked for Excite entirely by accident, but my tenure there was
pretty brief due to an odd situation. I was originally hired by Novo Media
Group who at the time was in the final stages of a merger with McKinley (known
for the Magellan search engine), and McKinley's Sausalito offices were closer
to my home (Novo was in SF and I was living in Marin) so I was located in that
office under the assumption that both offices would soon be serving the same
company but the deal with Novo fell through, Excite bought McKinley and things
got weird and I left.

