9 ms·
Java Was Strongly Influenced by Objective-C
- michaelwww 11y agoPatrick Naughton... now there's a name I haven't heard in a long time. I went to Wikipedia to find out what happened to him after his arrest. No jail time, but he had to work for the FBI for free for a year.
- tjr 11y agoThe first book I read about Java was his. I remember enjoying his essay at the end [this particular link being an unedited version]: http://blinkenlights.com/classiccmp/javaorigin.html http://blinkenlights.com/classiccmp/javaorigin.html
- comrade1 11y agoI remember when I moved from obj-c to java (as WebObjects made the same transition) and being amazed at just how bad the java standard libraries where compared to the obj-c foundation and other nextstep libraries. The obj-c libraries were so nice and clean and focused. Funny to see the 'oak' name reused - it's now an Apache project for a jcr backend.
- cturner 11y agoDo you remember any of the the names of method calls that were created by converting the objective-c libs into java?
- threeseed 11y agoIf you mean WebObjects its libraries used almost the exact same method names e.g. EOUtilities.objectsMatchingKeyAndValue(key, value); You can still see a lot of the original code in Project Wonder e.g. https://github.com/wocommunity/wonder/blob/master/Frameworks/Core/ERExtensions/Sources/com/webobjects/foundation/NSArray.java https://github.com/wocommunity/wonder/blob/master/Frameworks...
- protomyth 11y agoThe difference between WebObjects as a obj-c program to java program was just heart breaking. You could further see the pain of transition in the Java bridge for Cocoa. It really showed the mismatch between obj-c and java.
- eikenberry 11y agoThey hid it well.
- krisgenre 11y agoMaybe true. I recently ported an Obj-C project containing 9000+ lines of code ( no GUI ) to Java and was quite surprised about how easy the Obj-C code was to read even though I knew nothing about it.
- Reason077 11y agoThe naming of parameters in method calls was something I found a bit weird and overly verbose when I first used ObjC. But I've come to appreciate that it can greatly improve readability when trawling through unfamiliar code bases, and thankfully it's a feature Apple have carried across to Swift. Now days I often wish Java had external parameter names, too!
- dilap 11y agoOne of my fave obj-c features (which comes from smalltalk, I am told), and I'm surprised more languages don't do it. Aids code readability immensely, and basically eliminates an entire class of bug (of accidentally transposing two params of the same type). Most people tend to react to it really negatively at first encounter though.
- ttflee 11y agoI had done the opposite for a hobby scheme-like interpreter found in github from Java into ObjC, but finding various difficulties doing the same into Swift at the early days of it. Converting that piece of Java codes into ObjC was easy and straightforward because it was basically just some Foundation classes, e.g. NSString, NSArray, NSDictionary and NSNumber.
- zak_mc_kracken 11y agoNot very convincing. Maybe Patrick Naughton was in love with Objective C but there is little of that left in Java. Depending on which angle you look at, you could see Java's interfaces as a direct successor of Objective C's protocols or a simplification of C++' multiple inheritance. If you were to believe James Gosling, it's clearly the latter that influenced Java's design. The fact that Naughton liked Objective C hasn't had much impact on what Java ended up looking like in 1995.
- w0utert 11y agoHaving programmed many, many lines of C++, Java and Objective-C, I'd have to agree. Maybe parts of Java were influenced by Objective-C, but surely there is very, very little left of the philosophy behind how you write Objective-C code. In fact, I'd say there's almost no similarity whatsoever. In terms of how you program, Java is a lot more like C++, minus half the language features that make C++ both powerful and dangerous. Obviously there are fundamental differences, but I think it's pretty clear that someone switching from C++ to Java would have a much easier time adjusting, then going from C++ to Objective-C. Also, I find the qualification of Objective-C as a 'mutant of C' a bit off the mark. Yes, Objective-C is a superset of C, it's built on exactly the same foundation, but the end result is and how you use it is completely different in almost everything except the syntax of the pure C-constructs and fundamental types.
- tragomaskhalos 11y agoThe fact that class methods are not polymorphic is a dead giveaway that Java's heritage is more C++ than Smalltalk/Obj-C.
- jayvanguard 11y agoI'd put that more around 1997-8. Java 1.0 and 1.1 definitely felt a lot more like programming objective-c both in terms of the features available and the style the community developed in. Somewhere in the Java 1.2-1.5 things changed considerably. I agree that by then it felt way more like C++ than Objective-C.
- reacweb 11y agoObjective-C was strongly influenced by smalltalk. I think Java is more influenced by smalltalk than by Objective-C. The whole concept of compilation toward bytecode that may be interpreted or compiled to native is very similar to smalltalk. I think the influence of objective-C and C++ was mainly to avoid reproducing mistakes, in particular the tricky syntax. The syntax of smalltalk is very clean and simple which is not the case of C++ or objective-C.
- cmrdporcupine 11y agoJava the language is more like Simula than Smalltalk. But yes, the JVM/runtime is vaguely Smalltalkish, and this is no accident given that many of the key contributors came from Self and Smalltalk lineages.
- QuercusMax 11y agoWhich ObjC syntax do you find tricky? The message sending syntax may be weird at first, but I wouldn't call it tricky.
- AdieuToLogic 11y agoI'm not sure how much Brad Cox[1] would like the characterization: > Objective-C is an object-oriented mutant of C But Java (the language) has little in common with C++ aside from the token-level commonality both share with B. As for Java's interfaces, those (as "zak_mc_kraken" mentions) have strong ties to Objective-C's protocols, though I disagree with the subsequent statement of them being "a simplification of C++'s multiple inheritance". IMHO, they are far closer to C++'s class/function declarations. I'd say Java had a similar influence as C++ did from Simula, introducing superficial similarities with C++ due to its dominance at the time[2], but incorporated more of the dynamics provided by Smalltalk-like languages (such as Objective-C). Note the use of "super" for calling parent methods and the lack of multiple inheritance in both. 1 - http://www.virtualschool.edu/objectivec/ http://www.virtualschool.edu/objectivec/ 2 - Fun bit of trivia: when Java hit the scene in the late 90's, you could globally replace the word "reference" with "pointer" and the documentation would read just the same. See section 2.2.9 of http://www.oracle.com/technetwork/java/simple-142616.html http://www.oracle.com/technetwork/java/simple-142616.html for a prime example.
- vbezhenar 11y agoI find a lot of similarities between Java and C++. Java is basically a subset of C++ with some sugar around. When I was learning Java, I just made a link between Java constructs and C++ constructs and that allowed me to learn Java in one day and start getting things done. Of course I took few years more to master Java, but that's another matter. So Java "reference" is C++ pointer without asterisks and ->. All java methods are virtual. Java interface is full-abstract class without fields (in Java 8 even not so full-abstract). Multiple inheritance only with interfaces. No generics (I learned Java 1.4), one common ancestor Object, friendly GC releasing you from the pain of memory management. Basically the only new concept is package. Otherwise it's stripped C++ with different runtime library.
- pron 11y agoThat was entirely intentional. Java adopted some C/C++ conventions that its designers knew were suboptimal, like == being reference, i.e. pointer, equality, switch statement with fallthrough etc. (even automatic number promotion, though I'm not sure it was clear to Java's designers that may not be such a good idea) precisely because they wanted C/C++ developers -- basically the entire market for Java developers at the time -- to be able to learn it quickly and make it feel familiar. Familiarity was purposefully chosen as one of the top design goals, as explained by James Gosling[1]. Today, these decisions would have been different, as C++ no longer reigns supreme. I find that Kotlin has completely adopted all of Java's core values, but modernized the specific syntax and semantics. Kotlin is what Java would have been if it had been designed today. The fact that Kotlin has made interoperation so seamless (you can switch any single Java class with a Kotlin file in an existing project -- IntelliJ would even automatically translate it for you) makes transitioning from Java to Kotlin (if you want) so smooth and gradual that it's a tru pleasure (even working on a mixed codebase). [1]: http://www.win.tue.nl/~evink/education/avp/pdf/feel-of-java.pdf http://www.win.tue.nl/~evink/education/avp/pdf/feel-of-java....
- vmsisbetter 11y agoNot strongly enough unfortunately, otherwise it would have metaclasses and class-side inheritance would work correctly.
- ChuckMcM 11y agoThat is pretty much the same way that I remember it as well. The interesting dichotomy is that the NeXT 'cabal' as it were, primarily, the code/library developers as was I, and James was primarily language design. But the group was small enough that everyone had an opinion, and it often came up "well Objective C does it this way..." or "C++ does it this way ...". James was always a minimalist and Bill Joy (who was in Aspen working on the 'self' language) was always pushing the edge of what you could express in a language.
- SeanLuke 11y agoHoly cow, that's my USENET posting. Will have to ask my sysadmin to record the HN spike. I do find it funny reading postings here basically saying that, regardless of what Patrick Naughton said, his language is actually based on C++. Those language creators have some nerve! :-) Reminds me of the Kurt Vonnegut scene in Back to School. Even back in the '90s, when I wrote that as a wee PhD student, it was clear that Java was derivative of Obj-C (among others) much more than C++. EDIT: all the Newton references in that passage are because it was posted in comp.sys.newton.misc (IIRC).
- jayvanguard 11y agoYes, it was a well known fact back then. I'm sure I heard talks or articles from Gosling, Guy Steele, and others that explicitly said this as well.
- MCRed 11y agoAnd Objective-C is a derivative/recreation/highly inspired by SmallTalk. But my question is, what modern language today is a copy of Dylan?
- pavlov 11y agoNone of them, unfortunately? (Unless I'm forgetting something.) Of the languages created at Apple, Dylan was the most interesting one. Swift is practical in many ways, but it's not inspired or visionary. Swift is basically a better C++ with decent Cocoa interop built-in. It's comparable to C# in originality... And that's not putting down either Apple or Microsoft -- it's simply the realities of creating a language at a large corporation with internal and external stakeholders.
- Retra 11y agoI don't think 'originality' should be the goal of any language. Being novel for the sake of novelty inhibits effective communication, it doesn't enhance it.
- 11y ago
- mhomde 11y agoWait... C# was strongly influenced by Java... by law of transitive properties that means C# was strongly influenced by Objective-C..... Nooooooooooooooooooooooooooooooooooooo. That's like the opposite of finding out that Sweden named New York
- MCRed 11y agoThis is what makes C# so pleasant to use. Before C# Microsoft created a language called J IIRC that was meant to compete with Java (Maybe it was J++?) Wikipedia says J#, but I think this is a later incarnation: https://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET#J.23 https://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visu...
- prodigal_erik 11y agohttps://en.wikipedia.org/wiki/Visual_J%2B%2B https://en.wikipedia.org/wiki/Visual_J%2B%2B
- protomyth 11y agoBrad Cox's two books are worth reading: "Object-Oriented Programming: An Evolutionary Approach" ISBN-10: 0201548348 ISBN-13: 978-0201548341 "Superdistribution: Objects as Property on the Electronic Frontier" ISBN-10: 0201502089 ISBN-13: 978-0201502084 even after all these years, they still give some interesting insights
- spiralpolitik 11y agoThe saddest thing is that Java never implemented support for Objective-C 'Categories' so Java programmers are forever doomed to write classes called StringUtil full of methods that really should be on the String class. After 20 years of Java programming this still annoys me. That and making 'byte' signed.
- javajosh 11y agoTo me, the worst thing about Java is the tooling and OS integration. Compare what it takes to invoke a node program with what it takes to invoke a Java program. Or what it takes to do basic file IO in either of those. It's crazy, and it will never get better. The best Java can do is wrap everything in a build system ("just add an exec compiler plugin, configure for your main class, and invoke mvn with special arguments!") or an IDE ("just create a run config through the following 20 step process..."). It's true that if you spend a lot of time in Java these things fade into the background, but these are exactly the things that shouldn't fade. You'll never "whip up a quick script" in Java because of these problems.
- spiralpolitik 11y agoJava was never designed to "whip up a quick script". Today as in 1995 there are better alternatives to do that. Also Java was designed to abstract away from the underlying OS to provide "write once, run anywhere" so its "as designed" that OS integration is lacking. Personally I think the tooling is the best part of Java. Having an IDE helps you build more robust software by providing far more context than a text editor ever could. The build systems have reached the point that its very easy to do the right thing to build robust software. Compared with what came before (make, imake, configure etc) the tools are much better.
- oldmanjay 11y agoSure, node CAN be faster to get going. So what? Shell scripts are even faster to bootstrap than node. Will you switch over to doing everything in bash instead? Also, yes, I whip up quick scripts in Java all the time, because sometimes it's the closest hammer to my particular nail. Your entire comment can be summed up as "I don't really understand Java, and I don't like it" which is not a terribly compelling argument.
- jasallen 11y agoWould kill for dates on each these messages!
- rzzzt 11y agoAn interesting tidbit on two unused keywords from the 1.0 specification [1]: "The keywords const and goto are reserved by Java, even though they are not currently used in Java. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in Java programs." [1] http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/3.doc.html#229308 http://titanium.cs.berkeley.edu/doc/java-langspec-1.0/3.doc....