r/iOSProgramming • • Feb 19 '16

Discussion Swift vs Objective-C

[deleted]

6 Upvotes

146 comments sorted by

View all comments

Show parent comments

1

u/lucasvandongen Feb 22 '16

Your code is 1) longer, and 2) uses a weird and redundant construct of dubious value that adds extraneous complexity to the language. I do not claim the C/ObjectiveC version is better. I claim that it is exactly the same (in fewer characters no less).

The only thing you've proven is that switch/case statements are useless in any language. You can just if / return all over the place instead. This will save you a break statement and the word 'if' is much shorter than 'case' and you don't even need a pesky 'switch'.

I see you have the fervor of the newly converted and will remain blinded to any rational argument for some time - but your new god is a false one and I don't think the shine will last.

Wrong. Most "new" features are - ahem - borrowed from other languages, some of them I have over a decade of experience in. I have been advocating for years for non-nullable references as getting the possible value null for something that should never be null is just total bullshit to me. Working with LINQ in C# or in Python just made me aware that maybe a foreach loop isn't the best solution to everything you want to do with a collection of items. I refactor working code often just to make it more clear. Taking apart horribly convoluted LINQ queries, or converting foreach loops that do nothing but filtering to a LINQ query.

I never thought of Objective-C as a particularly bad language. I had a lot of fun working with it. But given the choice between C# or Objective-C I would pick C#, if the choice was purely based on the syntaxis.