12 ms·
Programmers "liked" Java because they were told to by Sun. Programmers "liked" C# because they were told to by Microsoft. Now, programmers "like" Obj-C because
by jballanc 14y ago
Programmers "liked" Java because they were told to by Sun. Programmers "liked" C# because they were told to by Microsoft. Now, programmers "like" Obj-C because they are told to by Apple. In that regard, this seems like a step in the right direction...
But it's only a half step. If you look at what's happened to the other two languages mentioned above, they have evolved such that their runtimes are now more important than the languages they originally hosted.
What really needs to happen to Obj-C is for people to wake up and realize that the runtime is actually really nice. Combined with LLVM, one could make the case that the Obj-C runtime could compete with the JVM or the CLR.
(Of course, the one huge, massive, glaring omission is any sort of managed memory... Well, at least there was a garbage collector at one point.)
- nubela 14y agoI don't know about you, but I appreciate that I don't have a garbage collector with coding for mobile apps (Not done any for OSX apps yet). You'll know what I mean if you work with large images (Bitmaps) in Android, then you'd wish you have a better craft at release memory (instead of recycle())
- stcredzero 14y agoI am wondering when someone will implement a good Ulterior Reference Count or an Age-Oriented GC for iOS/OS X. These are both hybrids of GC and reference counting that combine the strengths of both. Basically, new objects tend to die quickly, so the overhead of reference counting is generally redundant, and GC techniques like copying collectors tend to excel. Old objects tend to stick around, so reference counting overhead is low. By using a hybrid of both techniques where they are strong, you avoid a lot of overhead: pointless ref-count changing, and pointless scanning of object graphs. The result is something with the high throughput of generational GC with only a fraction of the maximum pause time. https://researchers.anu.edu.au/publications/29505 https://researchers.anu.edu.au/publications/29505 http://www.cs.technion.ac.il/~erez/Papers/ao-cc.pdf http://www.cs.technion.ac.il/~erez/Papers/ao-cc.pdf
- jballanc 14y agoI think anyone who thinks that GC/Memory Management is a "solved" problem hasn't been paying attention! Oh, and thanks for the links!
- flatline3 14y agoFirst, I want to counter your use of "like" in quotes, as if programmers couldn't have perfectly valid reasons to like these languages. I like Java for its low-cost allocations, sane implementation of constructors, and checked exceptions that prevent undeclared control flow behavior. The huge trove of solid-quality libraries and a general community focus on unit testing and documentation (perhaps in no small part driven by Apache) has been quite valuable. I like C# for its type inference, relational algebra ala LINQ, reactive extensions, adoption of F#, and a general R&D focus on adopting language design from the functional languages. I like Obj-C for the ease of which I can drop to C and assembly, and the ease-of-implementation inherent in Apple's GUI frameworks. That's about it -- there's a lot to dislike about ObjC. All that aside, and given my own significant familiarity with the underlying runtimes, I'm trying to understand what you think is so advantageous about Apple's ObjC runtime. It is effectively an extremely simple dynamic dispatch runtime, reliant on the OS memory management combined with reference counting, zero support for any complex runtime state inspection (say, to support breaking reference cycles), and now with some C-derived glue for closures and compiler-emitable calls to support somewhat-automatic reference counting. The class registration system has hardly changed in 20 years, has no support for namespaces, the type encodings available at runtime are complex-to-decode-strings, and the whole thing is, quite honestly, the kind of rickety design you'd expect to emerge from C hackers in the late 80s early 90s, incorporating none of the advances in the field from either Sun/Java or Microsoft/C#. ObjC predates the work on Strongtalk that led to the modern JVM, it either predates or fails to inherit from the language R&D outside of C, and predates the CLR runtime work done by Microsoft. It's a DINOSAUR. I don't really understand where you see the runtime advantage here, and I spend nearly all of my time writing ObjC. The only advantage I see to the ObjC runtime is that it's required to interface with their native libraries.
- drewcrawford 14y agoI have read your discussion of the Objective-C runtime three times to try and understand it. Your criticism seems to boil down to "The ObjC runtime is insufficiently complicated." (For example, you say several times that it lacks features X and Y, for many values of X and Y.) There is a school of thought that says simplicity is a feature. That C++ is an example of "language gone wrong". That the C hackers in the 80s and 90s had the right idea. It is not reasonable to compare Java and ObjC because in spite of the marketing material, they have very different performance characteristics. For the most part, garbage collectors are not efficient enough to be comfortably used on 5w computers. If you need a non-GC native-performance language, your choice is C++, C, or ObjC. Clearly you're in the "Features are good, use C++" camp, but the people who are not in that camp are also in pretty good company.
- stcredzero 14y ago> Now, programmers "like" Obj-C because they are told to by Apple. Not accurate in my case. I tried Objective-C because I was told to by Apple. In fact, as a Smalltalker of 15 years, I found the addition of the header files and everything from C and the square brackets quite distasteful at first. I now find that Objective-C is a powerful and elegant language on its own merits. If eero is to Objective-C as Coffeescript is to Javascript, then I suspect I'm going to love eero.
- thibaut_barrere 14y agoI can't agree on your first point, really. I liked Java because it had a fairly large catalog of reusable libraries, and was decently easy to deploy back when I used it. I loved C# because the language is really beautiful and fairly robust. What makes you assume people can't pick tools by themselves? On your second point, I think people (see http://rubymotion.com/ http://rubymotion.com/) already realize that the runtime is really nice!
- jballanc 14y agoI was probably being unfair to Java. For C# I have no mercy (it's personal). I would argue you're the exception that proves the rule. For what it's worth, I was a huge Obj-C fan starting in 2002. The way that Obj-C's popularity matches the profitability of writing for the iOS platform in lock-step tells me that some people can pick tools by themselves, but most just do what they're told... Oh, and did I mention that I'm on the MacRuby core team? ;-)
- thibaut_barrere 14y agoI know many other people who love C# actually! So I think it's more a matter of "personal sphere". Note that I don't use it anymore at all personally either. Thanks for your work on MacRuby! Did I mention I love Ruby? ;-) (really - all of my apps are Ruby/CoffeeScript based).
- jasonlotito 14y ago> The way that Obj-C's popularity matches the profitability of writing for the iOS platform in lock-step tells me that some people can pick tools by themselves, but most just do what they're told... Same exact thing happened with Ruby, and the herd followed. Is their any doubt?
- jballanc 14y agoNowhere near the same. When Ruby was just becoming popular, any Rails developer could have said "This language is crap, I'm going to go write my web app in PHP/Perl/Java/Python". Now try the same thing as Obj-C was just becoming popular: "This language is crap I'm going to go write my iOS app in..." Well?
- mpweiher 14y agoWhat we found even back in the NeXT days was that programmers who had never tried Objective-C thought it really sucked, but most who actually tried it really, really liked after a short while. The runtime really is great, and the fact that it is, essentially, the "C" runtime (~= native platform ABI) + one additional function (objc_msgSend()) is wonderfully minimal, and that this is all you really need to have a highly dynamic object oriented language is something even academia is only slowly figuring out.
- protomyth 14y agoCannot really agree with your first point, as I came to Objective-C through Brad Cox's excellent book[1]. Apple has added quite a lot to the language and Cocoa is pretty nice. F-Script is a nice language in the Smalltalk tradition built on the Objective-C runtime. If I was going to pursue something like this, I would probably work at making a clang-like front end for it. 1) Object-Oriented Programming: An Evolutionary Approach http://www.amazon.com/Object-Oriented-Programming-An-Evolutionary-Approach/dp/0201548348/ http://www.amazon.com/Object-Oriented-Programming-An-Evoluti...