{"id":12304,"date":"2015-09-18T17:53:41","date_gmt":"2015-09-18T21:53:41","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=12304"},"modified":"2020-04-09T09:05:12","modified_gmt":"2020-04-09T13:05:12","slug":"objective-c-is-our-generations-cobol","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/09\/18\/objective-c-is-our-generations-cobol\/","title":{"rendered":"Objective-C Is Our Generation&rsquo;s COBOL"},"content":{"rendered":"<p><a href=\"http:\/\/sealedabstract.com\/rants\/objc-is-our-generations-cobol\/\">Drew Crawford<\/a> (<a href=\"https:\/\/twitter.com\/drewcrawford\/status\/644685167823450112\">tweet<\/a>):<\/p>\n<blockquote cite=\"http:\/\/sealedabstract.com\/rants\/objc-is-our-generations-cobol\/\"><p>Sometime this year, <em>probably right around now<\/em>, Swift will surpass ObjC in search traffic. The number of people trying to google some Swift question will be <em>greater<\/em> than the number of people googling some ObjC question. Around <em>now<\/em>. Not next year, not when you&rsquo;re planning your next major version and might have more time to think about porting a few classes. <strong>Right now<\/strong>.<\/p>\n<p>[&#8230;]<\/p>\n<p>Pretty much every <strong>new<\/strong> iOS developer I talk to is learning Swift. Not ObjC. Not Swift <em>and<\/em> ObjC. Just the Swift.<\/p>\n<p>[&#8230;]<\/p>\n<p>Your ObjC codebase isn&rsquo;t going to go away. Just the people willing to work on it. Sorry.<\/p><\/blockquote>\n<p>My first reaction is to point out that <em>of course<\/em> there&rsquo;s more search traffic for a language that&rsquo;s new, in flux, and much more complex than its predecessor. That said, it&rsquo;s quite possible that we have reached Peak Objective-C.<\/p>\n<p>I&rsquo;m having a good experience with Swift so far. It fixes so many things that have long annoyed me. There are certainly problems with Swift, but Apple is working at an impressive pace to address them. I do worry a bit that using Swift is going to paint me into a corner. Crawford writes:<\/p>\n<blockquote cite=\"http:\/\/sealedabstract.com\/rants\/objc-is-our-generations-cobol\/\"><p>Swift is essentially a superset of ObjC. Other than a few weird trivia questions (<code>#pragma pack<\/code> anyone?) you can do everything in Swift that you can in ObjC, and much, much, more.<\/p><\/blockquote>\n<p>This is mostly true, and you can migrate code piecemeal, but it does seem like there&rsquo;s a point of no return. First, you <a href=\"http:\/\/stackoverflow.com\/questions\/24204211\/mixing-objective-c-and-swift-when-subclassing\">cannot subclass a Swift class in Objective-C<\/a>. Second, it doesn&rsquo;t interoperate with C++. Third, Apple <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/Swift\/Conceptual\/BuildingCocoaApps\/WorkingWithCocoaDataTypes.html#\/\/apple_ref\/doc\/uid\/TP40014216-CH6-ID61\">doesn&rsquo;t really talk about it<\/a>, but the bridge for Objective-C and Swift strings and collections is <em>not toll-free<\/em>. There seems to be <a href=\"http:\/\/stackoverflow.com\/questions\/32621880\/is-there-a-way-to-work-with-foundation-objects-nsstring-nsarray-nsdictionary\">overhead in just passing bridged objects back and forth<\/a> between the two languages. This is probably not a problem in most cases, but it&rsquo;s not clear to me what you can do if this bites you.<\/p>\n\n<p>This is more a problem with Swift interoperating with Cocoa than with Swift the language. But if you&rsquo;re writing an app, working well with Cocoa is what matters.<\/p>\n\n<p><a href=\"https:\/\/twitter.com\/sandofsky\/status\/644907281436438529\">Ben Sandofsky<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/sandofsky\/status\/644907281436438529\"><p>I&rsquo;m bullish about Swift, but it&rsquo;s nuts to port a large, mission critical app to it, today.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/andy_matuschak\/status\/644913372287369216\">Andy Matuschak<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/andy_matuschak\/status\/644913372287369216\"><p>This is a pretty accurate analysis. Having been an early patient, I can report mixed outcomes and excitement about the future.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/timburks\/status\/644935077936259072\">Tim Burks<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/timburks\/status\/644935077936259072\"><p>I&rsquo;m aware of two projects, one at a startup and one at a big big company, that were rewritten in ObjC after starting in Swift.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/sandofsky\/status\/621381022580477952\">Ben Sandofsky<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/sandofsky\/status\/621381022580477952\"><p>Every new line of Objective-C you write today is technical debt in a Swift world.<\/p><\/blockquote>\n\n<p>Update (2016-03-22): <a href=\"https:\/\/twitter.com\/kluivers\/status\/712330976677007360\">Joris Kluivers<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/kluivers\/status\/712330976677007360\"><p>Had to revert back to Objective-C for a delegate implementation. NSDictionary -&gt; Swift Dictionary conversion for a param didn&rsquo;t perform well<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Drew Crawford (tweet): Sometime this year, probably right around now, Swift will surpass ObjC in search traffic. The number of people trying to google some Swift question will be greater than the number of people googling some ObjC question. Around now. Not next year, not when you&rsquo;re planning your next major version and might have [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2020-04-09T13:05:15Z","apple_news_api_id":"badba4ee-5877-4ee1-b868-119b1a4acbf2","apple_news_api_modified_at":"2020-04-09T13:05:15Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/Autuk7lh3TuG4aBGbGkrL8g","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[1935,31,30,54,138,71,901],"class_list":["post-12304","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cobol","tag-ios","tag-mac","tag-objective-c","tag-optimization","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=12304"}],"version-history":[{"count":5,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12304\/revisions"}],"predecessor-version":[{"id":28597,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12304\/revisions\/28597"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=12304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=12304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=12304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}