Live data from Hacker News

Java Was Strongly Influenced by Objective-C

cs.gmu.edu

11–20 of 53 posts

Re: Java Was Strongly Influenced by Objective-C

#11
post #4

Except it seems to be missing all the features that make Objective-C "Objective-C" in my mind. How do you implement method missing/message forwarding in Java? Oh, that's right, your code doesn't even compile.

Too be fair, message forwarding is a pain in the ass in ObjC as well.

It's not really that hard, is it? You just have to implement methodSignatureForSelector and forwardInvocation.

Compare to Java where it's not even possible to forward messages determined at runtime, you have to generate stubs before compiling. AFAIK.

Re: Java Was Strongly Influenced by Objective-C

#12
post #8

I just want to remember everyone that Objective-C is nothing more than Smalltalk with C backward compatibility. Also, the static type checking in early Java is pretty much the same thing as in early C++ (when both were without templates/generics).

I think 'remind' might be the word you are looking for.

Re: Java Was Strongly Influenced by Objective-C

#13

Perhaps learning Objective-C would make me a better Java coder. Alternately, maybe all the ObjC practices that would translate have already been written up as standard Java patterns or included in the standard Java books and all I'd get from it would be frustration because I can't apply anything neat I see.

I'm playing with some Objective-C at the moment. For me the most interesting thing is how blurred the line between ObjC/OOP/message passing and straight C is. It's the first language I've used where you can treat the high level part as not much more than a library with custom syntax. I'm sure the lispers live in this world all the time ;)

Re: Java Was Strongly Influenced by Objective-C

#16
The use of the word "influenced" to describe the effect had on Java's design process by Smalltalk, Objective-C and other languages of good repute is really somewhat misleading.

Certainly, there is some identifiable influence. For example, the concept of a JIT-ing virtual machine comes straight from Smalltalk (Deutsch & Schiffman, 1984), and it would also not surprise me if the APIs of Smalltalk and NeXTSTEP influenced the design of Java's somewhat. But that is largely where the influence ends: on the implementation of the language rather than on the language itself.

Java the language belongs on the same branch of the OO family tree with C++, C# and other strong statically-typed OO languages--not on the branch with Smalltalk and company. Yes, Java's object model is class-based, single-inheritance and single-dispatch, but its model has little else in common with Smalltalk's. If it was designed with Smalltalk in mind, then it constitutes a dangerous misunderstanding of it. I do not mean the fact that "everything" in Java is not an object, but rather that some things that very clearly should be objects, such as classes, are not objects is alone enough to disqualify it as one of Smalltalk's legitimate offspring.

The people who assert over and over again that Java was influenced by this language or that language do so because this language or that language has a better reputation among programmers than Java, and it is hoped that by doing so perhaps some of that reputation might rub-off on the hapless language.

Re: Java Was Strongly Influenced by Objective-C

#17
post #7

Don't Classes in Java get boiled off in the compiler? There are no "class objects" at runtime that I've ever seen.

What do you mean?

Classes are in some sense like objects, meaning they can hold their own state, but there is no notion of meta-classes like in Smalltalk.

The class in the JVM is like a module that holds functions and attributes. And the JVM byte-code is very class-centric.

The objects themselves are probably not what you think they are. The JVM currently has no notion of "call method next() on object O" ... that's done with something like ... invoke_virtual Enumerable.next(obj). The bytecode "invoke_virtual" is responsible for doing the single-dispatching (subtype-polymorphism) at runtime, otherwise it looks just like an invoke_static ... so the compiler is crucial for generating the correct byte-code, because the class has to be known at runtime ;)

Re: Java Was Strongly Influenced by Objective-C

#18
post #16

The use of the word "influenced" to describe the effect had on Java's design process by Smalltalk, Objective-C and other languages of good repute is really somewhat misleading. Certainly, there is some identifiable influence. For example, the concept of a JIT-ing virtual machine comes straight from Smalltalk (Deutsch & Schiffman, 1984), and it would also not surprise me if the APIs of Smalltalk and NeXTSTEP influence…

The people who assert over and over again that Java was influenced by this language or that language do so because this language or that language has a better reputation among programmers than Java

The post was written by one of the people who worked on Java, not somebody trying to impress you by associating Java with some language you like better. Are you trying to say Patrick Naughton is just making this up?

Re: Java Was Strongly Influenced by Objective-C

#19
post #4

Earlier quoted context omitted.

Too be fair, message forwarding is a pain in the ass in ObjC as well.

It's not really that hard, is it? You just have to implement methodSignatureForSelector and forwardInvocation. Compare to Java where it's not even possible to forward messages determined at runtime, you have to generate stubs before compiling. AFAIK.

Sure you can ... object.sendMessage(messageName) ;) Or for already built classes ... see java.lang.reflect.Method

Personally if I were to choose, I'd trade some syntactic sugar for a decent garbage-collector. But that's just me :)

Re: Java Was Strongly Influenced by Objective-C

#20
post #8

I just want to remember everyone that Objective-C is nothing more than Smalltalk with C backward compatibility. Also, the static type checking in early Java is pretty much the same thing as in early C++ (when both were without templates/generics).

I think I would argue with the "nothing more" part. It has split and evolves from its origins. Also, the combination has some decent advantages over straight Smalltalk.
Post reply on HN