r/iOSProgramming • u/yolobicycle • Jan 10 '16
Discussion The most important decision: Objective-C or Swift
Assume you're at a Fortune 500 that is launching a new business unit. No legacy code to deal with. It is now the beginning of 2016 and it is just you and your CTO. You are empowered to decide whether the mobile team that eventually will be hired should build the iOS app in Objective-C or Swift. What do you decide and why?
0
Upvotes
View all comments
Show parent comment
3
u/brendan09 Jan 11 '16 edited Jan 11 '16
The 75,000-100,000 line app was NOT reduced to 25,000 lines. That's absurd. Most line counts ignore header files anyway. That 30% number you've been using is complete BS, unless you count header files (which most people don't).
You're also falling into the fallacy that Swift saved that many lines. If I were to rewrite an Objective-C app from scratch (having the hindsight of written the first version), you can bet it'll be a TON shorter. That's just a rule of rewriting.
We have Swift code in existence that's in excess of 100,000 lines. It would've been around the same length / development time regardless of the language. If anything, Swift took longer from the pathetic tooling available.
It's absolutely less costly to write Objective-C right now. You can find a LOT more talented developers, there's more established libraries and knowledge, etc. Plus, you don't have to count rewriting substantial portions of the code every few months. The initial development time isn't any different (in any meaningful number). Most time isn't spent coding on large projects, it's spent planning / evaluating / testing.
Code from years ago will still compile and run fine in Objective-C. Code from Swift won't. It's a stupid amount of time investment to keep migrating that much Swift code.
It's absolutely not at a dead end for Objective-C. Apple has stated that Objective-C will be supported as long as Swift is, that it'll continue getting language features and updates, the IDE will continue getting new features, and that Apple will continue using Objective-C internally. Craig Federighi has said this in an interview. It's not a secret.
You can't walk up to a client and say "Hey...we chose this trendy language and jumped on the bandwagon too soon....we're gonna need you to pay $10,000 - $20,000 every few months for us to fix this poor decision." You don't keep clients like that. The same thing applies to internal projects at a company.
There is currently no defensible position for using Swift in large projects. There just isn't. From maintenance time, to libraries, to maturity, to tooling, to stability, to ABI (Application Binary Interface) instability, to the larger distributed binary size.
Literally the only people recommending it are the people not doing this in large projects professionally. The techies who jump on the tech bandwagon or write blog posts for a living. The same type of people who said MongoDB was production ready 4+ years ago, who are now regretting it. No one who's been in the industry or had responsibility for large projects / budgets thinks Swift is a good idea to jump on right now. As companies, we're not in it to beta test Swift for Apple. We're in it to ship responsible, maintainable code.
I'm not saying Swift won't be the first choice in 2-3 years. But, right now, it absolutely isn't. I've been doing iOS development for 8 years and have shipped dozens and dozens of large apps for big companies. You don't do well by jumping into immature software stacks. It's a ticking time bomb.