3 ms·
I am a C++ guy but I dabbled in Obj-C for a while. I think my progression was similar to a lot of people: 1) Uggh, this language sucks. What's with all the []
by AndrewStephens 5y ago
I am a C++ guy but I dabbled in Obj-C for a while. I think my progression was similar to a lot of people:
1) Uggh, this language sucks. What's with all the [] everywhere? Why are the parameter names included in the signature? Why are allocation and initialization separate operations? This is a joke.
2) Hold on! You can replace methods at runtime? You can swap out implementations on the fly? Calling methods is incredibly flexible yet also optimized up the wazooo?
3) Wait a minute! You can call methods by name at runtime? Even from dynamically loaded libraries? I always thought Windows COM sucked, now I understand how much better it could have been. This is the best language ever!
I haven't done any ObjC for years but sometimes I miss its flexibility. It wasn't all roses, sometimes lifetime management was a pain for instance, but ObjC doesn't deserve its reputation as a weird, unloved language.
- kitsunesoba 5y agoObj-C's flexibility is great, but it's also one of the language's weaknesses. Having worked on Apple platform projects for over a decade, I've seen some truly insane Obj-C code — bad casting, no null checks, and a variety of different types of incidentally working but incorrect code, among other things. It's a wonder that some of those projects ran at all. But I suppose that's down to the skill of the developer more than it is the language itself. In the right hands, Obj-C is powerful for the same reasons… the compiler gets out of your way and lets you write.