4 ms·
Objective-C is the only programming language that was genuinely unreadable on first glance to me so I would definitely agree that it's difficult to work with.
by Drew_ 3y ago
Objective-C is the only programming language that was genuinely unreadable on first glance to me so I would definitely agree that it's difficult to work with.
- spacedcowboy 3y agoPersonally i don’t see much difference between class obj = new class() and class obj = [class new] And i think the named parameters are easier to read And ARC gives you pretty easy memory management - basically “don’t even have to think about it” except for more-obscure cases, even then weak properties can help out. ObjC is really only a little more complex than C, but gives you so much more for that little increase. It’s orders of magnitude less complicated than c++, but is capable of handling enormous codebases just like C++ It is under-appreciated IMHO.
- gymbeaux 3y agoYour example isn't representative of an entire language, though. It's convenient to your case to use class instantiation, one of the easiest things to do in any language.
- spacedcowboy 3y agoWell, yes, I didn't put everything in the language into a post. You got me there. How about generic containers that can store any object ? Even using the old syntax, it's pretty clear what's going on NSMutableDictionary *container = [NSMutableDictionary new]; NSString * item = [NSString stringWithUTF8String:"hi there"]; [container setObject:item forKey:@"greeting"]; Where @"..." is a shorthand for a constant NSString And then the next thing to add could be a number... NSNumber * age = [NSNumber numberWithInt:18]; [container setObject:age forKey:@"age"]; Then add in an NSDate, or another NSDictionary, or NSArray type.... The standard library that comes with ObjC is really powerful, and since it's ubiquitous, it works really well across a range of apps. And then there are some really nice design patterns. Create an NSNotificationCenter and enjoy the Observer pattern, tightly integrated into the event loop. Any object can notify any other simply by posting a notification, and any object can listen for them by registering interest. And since collections can store anything, it's easy to pass state around and make large applications work well without interdependency hell. Just one of the built-in nice things... And all without caring about memory management.
- gymbeaux 3y agoI think you’re making my case for me. All of that seems easy and straightforward to you, but not to me. It’s worth noting that I struggle similarly with C++ and Rust. I just think the syntax is harder to read than a Java or a C# or a Python.
- spacedcowboy 3y agoJeez, Java is a nightmare! And I’m not a fan of Python either. I think we’ll just have to agree to differ…
- gymbeaux 3y agoI agree that Java isn’t pleasant to work in- but not because of the syntax. It’s everything else, like the JVM, Oracle’s shenanigans with licensing, etc.