3 ms·
Your 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
by gymbeaux 3y ago
Your 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.