6 ms·
Java Was Strongly Influenced by Objective-C
- andrewfromx 4y agofinally my life makes sense! I was a java programmer asked to build an iphone app in 2008 and I learned Objective-C by hacking my way through it. Anyone remember three20? https://stackoverflow.com/questions/tagged/three20 https://stackoverflow.com/questions/tagged/three20
- solarmist 4y agoCan you explain for the people not in the know?
- andrewfromx 4y agooh three20 was an objective-c iphone library named 320 because that was the size of the screen. Created by facebook but everyone started using it until iphones started to come in other sizes!
- sandofsky 4y agoI recall people dropping three20 long before screen sizes were an issue. I can't speak to all the issues with its design; I think I got to the part where it tried to model navigation similar to Ruby on Rails' routes and gave it a big "Nope."
- FlyingSnake 4y agoraises hand
- JamesSwift 4y agoOh man three20. I was freshly hired at my first dev job at a startup as a self-taught rails dev. I like to learn and was open to doing more, so they had me start to take over some of the ios dev, which heavily leveraged three20. Unless you have the same experience, you can't imagine how difficult it is to get your head around native ios development with this kitchen-sink, highly-opinionated library layered on top. I had no frame of reference for understanding ios, or three20, or even development in general really (I had done some webapps and api servers...). That was the most difficult phase of "this seems like it should be incredibly simple but I'm now a week into trying to figure it out". So frustrating. I made it out the other end, ultimately by just throwing my hands up and asking for help, then really digging into native ios first so I had a solid frame of reference of what the system was intended/designed to do, and what three20 was doing for/against you. I had a similar experience with Ruby/Rails actually (not understanding what rails did vs just ruby), and now I recognize I'm falling into that trap immediately when getting into new ecosystems. Now I try to make sure to start from the basics, and layer the complexity on only after I have a frame of reference for understanding the platform.
- andrewfromx 4y agoomg this was 14 years ago now https://github.com/andrewarrow/yammer_iphone https://github.com/andrewarrow/yammer_iphone (cue, GnR song 14 years...) Also props to https://github.com/joehewitt/ https://github.com/joehewitt/ it was amazing at the time.
- int_19h 4y agoNote that the same email says: "James Gosling, being much older than I was, he had lots of experience with SmallTalk and Simula68, which we also borrowed from liberally." The "objective" part of Obj-C is itself obviously a calque of Smalltalk, so we can pretty much reduce it to these two. And then if you look at them and compare either to Java, it's obvious that it is much more of a Simula descendant. As is C++, by the way, so while Java may not descend from C++ other than syntactically, they're still siblings.
- wrs 4y agoJust a note as to the distinction in dispatch mechanisms here: ObjC, Ruby, and other Smalltalk-like languages use “message passing”, which encapsulates a call symbolically as a “message” (name + args) then does a “dispatch” operation that looks up the code through the inheritance chain and runs it. If you override the dispatch mechanism you can do things like delegation or forwarding with great flexibility. NewtonScript does the symbol lookup first (same as for any member lookup) and retrieves a function/closure object, then executes that function with an implicit “this” argument. Closer to the way JavaScript, Python, Go, or C++ do it.
- melvinroest 4y agoSomething like: implementing your own small if/else DSL [1]! I'm not saying that this is a good idea. I am saying that this is possible with overriding the method dispatch :') In Pharo (a Smalltalk descendant) one needs to override the doesNotUnderstand method. The thing is: the whole DSL that I made (with if/else/elif) is its own method call. It's exactly one method call. So if you write "code" like that, then you'll always have a variable length type of method call that Pharo won't understand. By overwriting it and checking for the right symbols (If, Else and Elif) one can group them together and mimic if-statement type of behavior. I think it's really wild, awesome and fun. [1] https://www.youtube.com/watch?v=BUEnRrUZ-Ug https://www.youtube.com/watch?v=BUEnRrUZ-Ug
- Alifatisk 4y agoWhat’a the pros / cons with dispatch compared to the latter?
- klodolph 4y agoWith the latter approach, you can save the bound method as a value. Depending on the way this is implemented, it can carry some additional overhead—because you create an object to represent the closure. The Objective-C dispatch, objc_msgSend, is very fast and allocates no memory. This is an implementation detail, however. I’d say that there’s a big difference between Python/Go and JS/C++. In Python, obj.method returns a bound method call—basically, a function that saves obj and passes it in as the first argument, and obj.method() has exactly the same semantics as x=obj.method;x(). In JS, obj.method returns an unbound method, and the equivalent to obj.method() is x=obj.method;x.call(obj). Objective-C has some nice semantics and a little bit of typing to help you out here.
- DonHopkins 4y agoWhy not just use C# instead? It was purposefully designed to address and correct the many mistakes of Java, and much more importantly, it's not owned by Oracle.
- revscat 4y agoIt’s owned by Microsoft. A strong case can be made that this is significantly worse. Screw them both. Use Rust.
- pasc1878 4y agoMS worse than Sun yes. MS worse than Oracle, really?
- retrocryptid 4y agoI have been a MSFT customer and an ORCL customer. While both do things to you that cannot be described in polite company, MSFT at least buys you dinner first.
- delta_p_delta_x 4y ago> It’s owned by Microsoft It was owned by MS, but the entire .NET ecosystem has since been open-sourced and released with a permissive MIT licence. It is managed by the .NET Foundation[1]. [1]: https://dotnetfoundation.org/ https://dotnetfoundation.org/
- SeanLuke 4y agoThe MIT license is worth nothing because it does not contain a patent release. Microsoft's sword of damocles has always been in patents they held with regard to C# and .NET. Have they released this IP as well?
- fsckboy 4y agoI'm no defender of Microsoft, but haven't they said "if you don't sue them, they won't sue you type of thing"? also, that doesn't make this code or the license worth nothing.
- Zigurd 4y agoWhen Objective-C was two guys in a garage the company I was working at was pitched by them to use it for writing software that would run on a minicomputer. This was way before Next. My initial impression was "Huh, so I could take the syntax definition for SmallTalk and add it to the syntax definition for C and there would be almost no collisions. Cool!" At the time I was playing with parsers in connection with automating law form filling, e.g. Westlaw form books. I agree with another poster's impression that it's more Simula-like. As an undergrad I played with M4 macros to make C more object-ish.
- DonHopkins 4y ago>Patrick Naughton the gentleman ... So now he's a "gentleman" huh??! That must have been written before Sept. 14, 1999. https://en.wikipedia.org/wiki/Patrick_Naughton#Sex_crime_arrest_and_conviction https://en.wikipedia.org/wiki/Patrick_Naughton#Sex_crime_arr... https://www.zdnet.com/article/the-rise-and-fall-of-patrick-naughton/ https://www.zdnet.com/article/the-rise-and-fall-of-patrick-n... >Sigh... we sure knew how to have fun in those days... Zoinks! That didn't age well.
- shellac 4y agoAdditionally Sun and NeXT partnered to create OpenStep. [1] I thought the java library owed quite a lot to OpenStep. [1] https://en.wikipedia.org/wiki/OpenStep https://en.wikipedia.org/wiki/OpenStep
- deleted 4y ago[deleted]
- SeanLuke 4y agoMy web page posted long ago is evergreen on HN!
- ksherlock 4y agoTangentially... The OpenStep spec was a collaboration between NeXT and Sun. Essentially, it was the NextStep API but cleaned up and made more OS-independent. Aside from running on NeXT (Mach), it ran on top of Solaris and Windows NT. This was back in the day when Apple's preferred adjective was "beleaguered" and every 6 months there was a rumor that Sun would buy up Apple (while we're at it, Apple sold Mac Execution Environment that was a MacOS emulator for Solaris), so in a slightly different universe, Sun bought Apple and OS X happened 5 years ahead of schedule.
- mpweiher 4y ago> "beleaguered" I thought "Beleaguered Apple Computer" was the official name of the company...
- mistrial9 4y agoSun and Apple were drawn together as my-enemy-is-your-enemy due to Microsoft. There the cultural overlap stopped. It is not surprising to hear about some inside lower-upper-management plot among stock owners, to M&A their was to personal Lambo riches. Neither user community wanted this, and the World was a very different place at that time.
- steve1977 4y agoSome sources actually say the NS prefix in Cocoa/OpenStep classes stands for NeXT/Sun. (others say it’s simply NeXTSTEP, however considering that those classes had a NX prefix initially, the NeXT/Sun bit might actually be closer to truth)
- SeanLuke 4y agoI'm pretty sure NS was NeXTSTEP. That was the assumption of developers at the time IIRC. Before NeXTSTEP existed there was just NeXT, hence the NX.
- retrocryptid 4y agoAha. I think that explains why NS<foo> methods started creeping into NeXTStep 3. That's about the same time frame as the yellow box, NeWS and sparc becoming a first class supported platform for gnu/objc.
- bakul 4y ago> James Gosling, being much older than I was, he had lots of experience with SmallTalk and Simula68, which we also borrowed from liberally. Simula67. It was an almost superset of Algol60 & had nothing to do with Algol68. Smalltalk was also influenced by Simula67.
- zzzeek 4y agomy first professional programming with java was right near the beginning, in about 1997 or so. Funny at that job I had to deal with both Smalltalk and Obj-C fans who thought everything about Java was awful, preferring their two respectively favorite languages instead.
- phendrenad2 4y agoTo me Java is a fantastic high-level language. I think a lot of people in the web world would be pleasantly surprised to re-discover it. Python/Ruby only became popular because of Oracle licensing fees (now a non-issue thanks to alternative JVM implementations), and stayed popular because of science (you really can't beat the simplicity of Python for the sciences, people don't really want to have to fight with syntax in the science fields). I think the only areas where Java isn't good are when you need deterministic latency (such as in a 3d renderer), or when you need a simplistic syntax that non-programmers can use.