6 ms·
Interesting, I guess that part was missed on me since I only really ever used it for iPhone apps and never really had a need to use C directly. Also, you're 10
by itslennysfault 2y ago
Interesting, I guess that part was missed on me since I only really ever used it for iPhone apps and never really had a need to use C directly.
Also, you're 100% right. The square brackets are what immediately repulsed me and continued to befuddle me even after years of experience with it. Also, everything just feels "backwards" to me if that makes any sense. Coming from Java/C#/JavaScript everything just seemed unintuitive to me at all times. Also, I think this was heavily compounded by using xCode which (at the time) was incredibly laggy. So, I'd mess up the Obj-C syntax and the IDE wouldn't tell me for what felt like forever. Often I'd make a change and hit "play" before the syntax highlighting caught up and that always felt infuriating.
I last used xCode about 4 years ago and it was still an issue then (even with swift).
- ramesh31 2y ago>"Also, everything just feels "backwards" to me if that makes any sense." Because it is. Obj-C comes from the Smalltalk lineage by way of Alan Kay, using message passing [0] versus method invocation. It's a subtle difference with huge implications to how you design systems. Method invocation won out mostly because of Java and C++, but there was a time it wasn't clear which was the better OO paradigm. [0] https://en.m.wikipedia.org/wiki/Message_passing https://en.m.wikipedia.org/wiki/Message_passing
- bunderbunder 2y agoMessage passing belongs up there with lisp, forth and pure functional programming as paradigms that are worth learning for "the profound enlightenment experience you will have when you finally get it." But I often see that my peers in the profession lack the kind of growth mentality that enables a person to see past the alienness of less algol-y languages. Quote from "How To Become a Hacker" by Eric S. Raymond: http://www.catb.org/esr/faqs/hacker-howto.html http://www.catb.org/esr/faqs/hacker-howto.html
- em-bee 2y agosee my comment above: https://news.ycombinator.com/item?id=42132104 https://news.ycombinator.com/item?id=42132104 i can't tell the difference and therefore i don't see what profound enlightenment experience i am supposed to have.
- mpweiher 2y agoIf you can't tell the difference, you didn't actually learn it. Doesn't mean you have to like it, but they are different.
- em-bee 2y agoyou may want to read the whole discussion following the linked comment to understand what i learned. if you have any additional insights i'd appreciate your input.
- mpweiher 2y agoWhat makes you think I didn't?
- em-bee 2y agowell, if you did, then can you please tell me what i am missing? i have written a decent amount if smalltalk code, and even held workshops teaching smalltalk to others. and i have written lots of code in many other languages. i did see differences. the most awesome was when i wrote some code to respond to an http request, the code failed, the http request stalled, i fixed the code live, and then the http request resumed. but i can do the same in pike if i tried, and i expect in lisp and other languages too. and if that is the case then it supports my understanding that most OO languages use message passing. where then is the great revelation that comes from smalltalk?
- mpweiher 2y ago>> i can't tell the difference > i did see differences. Spot the difference. ;-) > but i can do the same in pike if i tried, and i expect in lisp and other languages too. Absolutely you can! You can even do it in C: write yourself a message-passing library in C. You might want to call it Objective-C. Or do a VM for Smalltalk. > where then is the great revelation that comes from smalltalk? The claim was not that the great revelation came from Smalltalk, but that it came from message passing: >>> Message passing belongs up there with lisp, forth and pure functional programming as paradigms that are worth learning for "the profound enlightenment experience you will have when you finally get it." Smalltalk isn't even mentioned in that little section about the enlightenment. And in fact, Smalltalk's form of message-passing is pretty limited, it only just extends beyond method invocation and it certainly can be (and is) frequently used just like method invocation. If you want to do more sophisticated things, you mostly have to go via the DNU handler, which is a bit hacky. And in fact, Alan Kay's famous OOPSLA '97 quip "I made up the term object oriented. And I can tell you I did not have C++ in mind." was followed immediately with the slightly less famous "So, the important thing here is: I have many of the same feelings about Smalltalk". https://www.youtube.com/watch?t=634&v=oKg1hTOQXoY&feature=youtu.be https://www.youtube.com/watch?t=634&v=oKg1hTOQXoY&feature=yo... And even message-passing is much broader: for example, with Higher Order Messaging, you can control how messages are delivered: to collections, on different threads, delayed, distributed (combine distributed + delayed and you get TeaTime/Croquet), conditionally only if the receiver understands the message, etc. https://en.wikipedia.org/wiki/Higher_order_message https://en.wikipedia.org/wiki/Higher_order_message https://www.youtube.com/watch?v=GBtqQwcJoN0 https://www.youtube.com/watch?v=GBtqQwcJoN0 And even that just scratches the surface. When you look at something like the Enterprise Integration Patterns, that's distributed asynchronous messaging, which opens up a whole other universe. Also: Erlang. https://www.enterpriseintegrationpatterns.com https://www.enterpriseintegrationpatterns.com https://stackoverflow.com/questions/3431509/is-erlang-object-oriented https://stackoverflow.com/questions/3431509/is-erlang-object...
- pjmlp 2y agoJava is heavily based in Smalltalk and Objective-C, even if it has a C++ like syntax for mainstream adoption. https://cs.gmu.edu/~sean/stuff/java-objc.html https://cs.gmu.edu/~sean/stuff/java-objc.html Even Java EE was actually a rebooted Objective-C based project done internally at Sun during the OpenSTEP days, aka Distributed Objects Everywhere.
- em-bee 2y agoi have learned smalltalk, common lisp, java, python, ruby, perl, php, C, javacript and a few other languages, and i still do not understand the difference between message passing and function invocation. they look the same to me. according to wikipedia the difference is "In contrast to the traditional technique of calling a program by name, message passing uses an object model to distinguish the general function from the specific implementations. The invoking program sends a message and relies on the object to select and execute the appropriate code." Method invocation won out mostly because of Java and C++ but according to the wikipedia article java uses message passing. supposedly the distinction is that i can have a generic method that gets called if a named method can not be found. in smalltalk that's doesNotUnderstand: in ruby it's method_missing. javascript used to have __noSuchMethod__, in php i can overload __call, in pike i do the same with defining a method called `(), and many more. so are they all using message passing? and then if java is supposed to use message passing and javascript removed __noSuchMethod__ it seems that alone can't be the distinction. if there is a distinction at all then it look more like an implementation detail that does not actually affect what kind of code you can write, and more importantly, based on that it is not at all clear that method invocation won out.
- astrange 2y agoThe difference is NSInvocation. A function pointer doesn't capture the arguments to the function, but a message does. Also, you can change the destination of a message send at runtime, but you can't change the destination of a function call unless you're dtrace and can do code patching.
- em-bee 2y agook, so that means message passing needs a runtime, and it can be assumed that pretty much every language that has a runtime uses message passing. more evidence that it is message passing that won out. and the profound enlightenment ( https://news.ycombinator.com/item?id=42130432 https://news.ycombinator.com/item?id=42130432 ) is not specific to message passing but about a dynamic language runtime. being able to intercept messages/function calls is just one of the benefits of that.
- robenkleene 2y agoI've been an Mac and iOS engineer for over a decade, and none of this makes any sense to me. Everything you listed (besides the brackets) is worse in Swift than in Objective-C (Swift has real problems with live error checking in Xcode in particular, due to the additional compilation complexity since it's a significantly more complicated language). I've observed some folks have a visceral reaction to having to use Xcode, I don't really understand it myself. I can understand being annoyed at having to use a specific IDE to write iOS and Mac apps, e.g., it's harder to bring your own text editor like you usually can, it's going to make your life a lot harder if you try to to avoid using Xcode. But comparing Xcode to any IDEs like the JetBrains IDEs I've used (mainly the discontinued AppCode), Android Studio (also JetBrains under the hood), or other similarly complex development environments like Unreal or Unity, I don't see any of these as a clear winner. Personally I'd prefer using Xcode to any of those. I suspect this comes down to just whether you like native Mac apps or not, Xcode is a native Mac app and if you like that aesthetic than you'll like Xcode. I suspect most of the dislike for Xcode is really just folks who dislike the Mac platform (e.g., the UI toolkit) overall.
- pjmlp 2y agoI think it comes from the folks that aren't really into Apple culture, rather they buy Apple because of UNIX, or want to target iDevices without culture background on the ecosystem.
- nullpoint420 2y agoBingo. I'm tired of people claiming that macOS (XNU more specifically) is just BSD under the hood. It's called X is not Unix for a reason! I feel like so much awesome engineering in XNU around security and portability, as well as innovations like IOKit are swept under the rug because "it's just FreeBSD." I still think it's a shame that more people don't take advantage of the Mach side of XNU more. Launchd and Mach ports are a powerful combination IMO.
- neverartful 2y agoThe square brackets can be a huge impediment when first working on Obj-C (it was to me). I found that after some period of time to acclimate they eventually felt 'normal'.