Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming Android IOS

Ask Slashdot: Swift Or Objective-C As New iOS Developer's 1st Language? 316

macs4all (973270) writes "I am an experienced C and Assembler Embedded Developer who is contemplating for the first time beginning an iOS App Project. Although I am well-versed in C, I have thus-far avoided C++, C# and Java, and have only briefly dabbled in Obj-C. Now that there are two possibilities for doing iOS Development, which would you suggest that I learn, at least at first? And is Swift even far-enough along to use as the basis for an entire app's development? My goal is the fastest and easiest way to market for this project; not to start a career as a mobile developer. Another thing that might influence the decision: If/when I decide to port my iOS App to Android (and/or Windows Phone), would either of the above be an easier port; or are, for example, Dalvick and the Android APIs different enough from Swift/Obj-C and CocoaTouch that any 'port' is essentially a re-write?"
This discussion has been archived. No new comments can be posted.

Ask Slashdot: Swift Or Objective-C As New iOS Developer's 1st Language?

Comments Filter:
  • Obj-C (Score:4, Insightful)

    by occasional_dabbler ( 1735162 ) on Friday September 26, 2014 @07:02PM (#48006429)
    The one really good thing that has come out of the Apple fashion parade is objective C. Jobs' legacy isn't all the shiny fashion crap, it is this powerful and really rather beautiful language. This is from someone usually branded a Microsoft shill. If you want to write iOS/OSX take advantage of the native tools.
    • by djbckr ( 673156 )
      As of now, Swift *is* native tools. And it's a far more elegant language than Objective-C.
    • Re:Obj-C (Score:4, Interesting)

      by dottrap ( 1897528 ) on Friday September 26, 2014 @08:14PM (#48006849)

      Agreed. And for the op, Obj-C is the best language to use right now. Being well versed in C means he can learn Obj-C in a day. Obj-C is a very small superset of C.

      The hard part is learning Cocoa, but that is true of any framework whether that is Swing, Android, MFC, GNOME, Qt.

      Swift is so new, you will have to learn Obj-C anyway to learn Cocoa.

      The best bet is for the op to write model/cross-platform code in C, and then use Obj-C for the native UI layer. Then repeat for Android/Java (via JNI) and Windows Phone/C++CX.

    • I wrote a toy Lisp interpreter in Objective-C, on Linux without any of the NS* libraries. It was great for that, because it gave polymorphism while at the same time letting you mess with object internals. My root class had a method that would overwrite the object's isa pointer, changing it into an object of another class, for use by the garbage collector; try that in most languages.

      The basic layer is C, which is a small and relatively clean language, with a small and relatively clean Smalltalkish object m

    • Re:Obj-C (Score:4, Informative)

      by silfen ( 3720385 ) on Saturday September 27, 2014 @12:08AM (#48007611)

      Objective-C didn't "come out of" Apple or NeXT or Jobs. It was created by Brad Cox and Tom Love at ITT and Stepstone in 1983 and is derived from Smalltalk-80. Jobs just bought the company in 1995.

    • by Dahamma ( 304068 )

      So... based on your later posts you have never even USED Objective-C but you lucked out on /. First Post. Yay for useless comments!

      And trashing Apple in the process, nice.

      Objective-C is a semi-painful language but in my experience SO much more efficient than Android's choice of Java. There is a lot of misinformation about Swift but the reality is its development was headed by the lead dev of Clang who was also responsible for a lot of the innovations in Objecive-C. His goal *was* in fact to replace Obje

  • by Anonymous Coward on Friday September 26, 2014 @07:08PM (#48006451)

    Learning the language itself is not that difficult. Learning the SDK and how things work in Cocoa-land is the important part.

    For example, if you need to display a list of of items in a list, an UITableView will work the same regardless of your language choice. You will still need to understand the idiosyncrasies of working with UITableViewDelegate and UITableViewDataSource.

    I would stick to Objective-C for the moment as there are more learning resources online.

    • True in any modern language; the basic syntax is straightforward but learning the available library ecosystem takes the time
    • by dagamer34 ( 1012833 ) on Friday September 26, 2014 @07:22PM (#48006547)
      Ditto. Because learning the framework takes a LOT longer than learning the language and the fact that the framework was designed with Objective-C in mind, it is foolish to think that you will be able to write a pure Swift iOS app without knowing Objective-C anyway because there isn't enough Swift material out there for Google to find to solve your problems. And unless you *really* enjoy solving those problems on your own, you'd need to convert an Objective-C solution to a Swift one on your own, at which point you are basically learning both languages anyway. So I would say all new iOS developers need to learn Objective-C because writing a Swift-only app would be too painful otherwise. This all changes when The Big Nerd Ranch puts out a Swift book, but there's no indication that is anytime soon.
    • I would stick to Objective-C for the moment as there are more learning resources online.

      I agree with this. As a new user, for the moment, Objective-C is likely the way to go due to their being more documentation out there. Swift documentation though is rapidly increasing.

      As a developer in both Swift and Objective-C, the primary advantage of Swift is it is slightly faster to do many things as it doesn't require strict classing of variables, so you find yourself not having to spend as many lines of code swapping strings to integers as that kind of thing and end up with slightly more reada

  • If you 'speak' C (Score:3, Insightful)

    by angel'o'sphere ( 80593 ) <{ed.rotnemoo} {ta} {redienhcs.olegna}> on Friday September 26, 2014 @07:10PM (#48006463) Journal

    Why not write it in C and ommit Swift/Objective-C?

    Perhaps easier to port even, but honestly, if you want to use the Frameworks, try Swift.

    There is a reason we have a flodded AppStore market with iOS Apps ... Apples tools are 30 years old, granted. But the rest of the industry simply did not catch up since 35 years.

    Using a text editor to write code for a device like an iOS device, that simply displays the weather or a stock price is so ... 1960s?

    • Re:If you 'speak' C (Score:4, Informative)

      by evenmoreconfused ( 451154 ) on Friday September 26, 2014 @08:39PM (#48006921)

      Using a text editor to write code for a device like an iOS device, that simply displays the weather or a stock price is so ... 1960s?

      Well -- 1970's maybe. 1960's were more about drum storage and all that. Even in the early '70s, the 029 keypunches didn't let us correct typos -- you had to hold the "dup" key down to duplicate the bit you got right, and then carry on keying from where the mistake started. The 129's were much better, as they only punched the card after you finished the whole line.

      Although come to think of it, I did write a nice simple weather app in 360/Assembler for a class in 1974.

  • by Anonymous Coward

    There are way more tutorials and examples for Objective-C than Swift.

  • by Anonymous Coward on Friday September 26, 2014 @07:16PM (#48006505)

    I'm already getting barraged by headhunters asking for five years of Swift minimum for contracts now...

    • Taken at face value, requiring more experience in a technology than the time it has existed publicly would mean they're trying to poach from inside Apple. Perhaps they're trying to satisfy the legal requirements to ensure that nobody in your country is suitable before they can import immigrant workers.
    • I'm already getting barraged by headhunters asking for five years of Swift minimum for contracts now...

      Put it on your resume, "five years Swift". If anyone asks you to explain, mumble something philosophical about gazelles on the plains in Spain.

  • If you've spent this long avoiding modern languages why start now? If you're not interested in object oriented design you're just going to spend your whole time cussing at the frameworks. Just hire a contractor.

  • by notthepainter ( 759494 ) <oblique@@@alum...mit...edu> on Friday September 26, 2014 @07:25PM (#48006555) Homepage
    If you're just starting out you're going to be learning a lot, reading blogs, reading stackoverflow, and there is far more Obj-C out there than Swift now. So you since you want fast, not best, Obj-C is the correct choice for you. Not necessarily for everybody, but for you.
  • by musikit ( 716987 ) on Friday September 26, 2014 @07:29PM (#48006587)

    since you are already a C programmer and are talking about maybe moving to android at a future time. i would write as much as possible in C and just bind to the UI with java/objc/swift.

    take advantage of what you know. build wrappers around the java/objc code you will need to you can easily transport that to whatever platform you are on as long as it binds with C.

  • I'm also about to learn iOS programming. If I write an app in Swift, what is the oldest version of iOS that it will run on?

    • can only deploy to ios7 or newer with swift

      • can only deploy to ios7 or newer with swift

        You're not dealing with the Android market which has a crap ton of people still clinging to Android 2.3 or earlier. New version adoption rate on IOS is the highest for any platform. And every phone that apple sells now runs on 7.0 or better.

    • The question is irrelevant.
      As a deceloper of a 'small company' you can not put Apps into the AppStore that run below iOS 7 (and I woukd not wonder if that is in a few days iOS 8)
      Only companies like MS or Google can still 'update' iOS 6 or older Apps. All others are forced to publish for a newer version of the OS.

      • Are you sure about that? My understanding is that new/updated apps must be "optimized" for iOS 7, but they can still run on older versions.

        • by Bogtha ( 906264 )

          No, you're right, there's no rule against supporting older versions. Xcode 6, which is the version released just the other day to support iOS 8 development, supports building applications targeting iOS 6 and up.

          Apple have never explicitly required developers to support a minimum version of iOS, they just drop support for targeting older versions in Xcode a few years after release. Xcode 5, which was the most recent version until the other day, still supported iOS 4.3, which is over three years old and ha

  • Don't listen to these ass clowns saying "Go with Obj-C". If they had any clue they would know that introducing Swift was the first step towards obsoleting Obj-C.

    Assuming you're not learning this language to obsolete yourself, then you definitely want to stick with Swift.
    • Re:They are wrong... (Score:5, Informative)

      by dgatwood ( 11270 ) on Friday September 26, 2014 @10:22PM (#48007313) Homepage Journal

      Don't listen to these ass clowns saying "Go with Obj-C". If they had any clue they would know that introducing Swift was the first step towards obsoleting Obj-C.

      Here's why you should learn Objective-C first:

      • There are billions of lines of production Objective-C code out there, and remarkably close to zero lines of production Swift code out there. If Swift is the first step towards obsoleting Objective-C, then the second step must be waiting fifty years for all the Objective-C code out there to get rewritten.
      • Swift isn't finished. From what I've read, they expect to make syntax-incompatible changes. Although they plan to have translators to move old code forward, do you really trust automated translators enough to run them on huge chunks of production code?
      • There's no assurance that Swift has staying power. Over the years, Apple has released bridges to many different programming languages over the years. Java? Check. Perl? Check. Ruby? Check. Python? Check. Now ask yourself how many of those bridges are still supported by Apple. If you only have time to learn one language, it should be the one that you know will still be popular in ten years.
      • Swift is designed to make it easy to build apps that include a mix of Swift, C, and Objective-C. Therefore, there's no reason to believe that it won't be possible to write fully capable apps for iOS and OS X in Objective-C for the foreseeable future. And even if, God forbid, Apple decides to be a bunch of a**holes and starts shipping a bunch of Swift-only classes in a reckless and desperate attempt to pressure developers to switch to Swift, you'll still only be a tiny bit of glue code away.

      That's not to say that Swift isn't interesting. The ability to test code on the fly is certainly cool, and if Swift proves to be a long-term-viable language, I'd imagine it will eventually (over a couple of decades) become the dominant language for OS X and iOS development. However, there's plenty of time to learn Swift. If you want to start writing real-world code today, you're better off learning Objective-C, because there are orders of magnitude more examples, you'll be more likely to find employment (there's way more Objective-C code out there to maintain), and more people can help when you run into problems.

      Ask again in five years, and the answer might be different, but for now, IMO, Objective-C is the clear choice unless you don't already know any C-based language, and probably even then.

      • Swift isn't finished. From what I've read, they expect to make syntax-incompatible changes.

        That was before Swift 1.0 introduced with the final XCode 6 and iOS8. They aren't breaking syntax anymore...

        And even when they were, it was usually pretty minor things to fix.

        I'd imagine it will eventually (over a couple of decades)

        HA HA HA HA HA HA HA

        You don't know Apple, or iOS developers. Dominant over ObjC within two years (and by the end of next year that prediction will probably seem ridiculously conservative)

        • by putaro ( 235078 )

          HA HA HA HA HA HA HA

          You don't know Apple, or iOS developers. Dominant over ObjC within two years (and by the end of next year that prediction will probably seem ridiculously conservative).

          Oh really? Drink some more koolaid. Remember how long it took to lay Carbon to rest. And the Cocoa APIs are still incomplete in many areas. Then take a look back at all the new programming languages and frameworks Apple has introduced over the years and then shot in the head. Dylan? OpenDoc?

          I'd say it's 50/50 whether or not Swift will get enough traction to continue on.

          • by Bogtha ( 906264 )

            Remember how long it took to lay Carbon to rest.

            Very different situation. I work with a lot of companies that develop iOS applications, and it's extremely rare for them to be more than a couple of years behind the cutting edge.

            Then take a look back at all the new programming languages and frameworks Apple has introduced over the years and then shot in the head.

            Modern Apple does it very infrequently, and usually, when they do, it's because they've got something newer to replace it. In this case,

  • by tyme ( 6621 ) on Friday September 26, 2014 @08:13PM (#48006841) Homepage Journal

    Swift is still a very immature language, with lots of bugs in the compiler, rough support in the debugger and IDE, and the syntax isn't even set in stone yet (don't expect the syntax to settle down before Swift 2.0, probably some time in late 2015 if not 2016). There are a number of things that you still can't do in Swift (e.g. providing a callback function for APIs that expect a C function pointer), and you'll just spend a lot more time hitting your head against walls than writing working code. On top of this there are many more resources available for learning Objective-C than there are for Swift, and the pitfalls and corner cases are better understood for Objective-C than they are for Swift. As a bonus most of your instincts honed on C will carry over to Objective-C (while they are likely to lead you astray in Swift).

    Swift is a really exciting language, and fun to play around with, but it's not ready for production work (yet). It will get there, but in the mean time you should stick with the established tools, which means Objective-C for iOS and Mac OS X app development.

  • Right now, Obj-C (Score:5, Informative)

    by GrahamCox ( 741991 ) on Friday September 26, 2014 @08:14PM (#48006851) Homepage
    A lot of comments here saying how Obj-C is "ugly", and so forth. I wonder how many commenters are actually using it to any great extent, on a day-to-day basis, rather than have just looked at it out of curiosity for five minutes?

    If you want to write an app now, Obj-C is the only sensible choice. Swift looks promising, but it's not ready. It's changing almost weekly and at the moment it's actually introducing bugs into the frameworks where none exist in Obj-C. If you want to live on the bleeding edge, go for Swift, but if you want to write an app, get it working and ship it out of the door, Obj-C is the only game in town today.

    Once you get into Obj-C, it's a much more elegant language than it's usually given credit for anyway. Sure, it's old, but the runtime and compiler work put in in recent years makes up for many of its older roots. Manual memory management is not required, there is a dot syntax for properties and so on, so square brackets are not the only way to call getter/setter methods. As a pure superset of C99, it's easy for a C programmer to learn. It's also a small language. The real power lies in the frameworks, and that will take you far longer to learn than the language. Don't be put off by the superficial "ugliness" of Obj-C code, it isn't relevant. It's expressive and straightforward, and as a former C++ programmer, I also found it dramatically more productive when I first adopted it over a decade ago. It is possible to become fond of it, believe it or not. Whether the same eventually becomes true of Swift, only time will tell. Ignore the nay-sayers who have probably never actually used Obj-C in anger in their lives.
  • I want all devices to end up running HTML5 apps or some kind of compatible format. I'm working on a mobile game using CocoonJS. Phonegap is also pretty good, especially now that modern HTML5 canvas are rendering using webgl.

  • Although I am well-versed in C, I have thus-far avoided C++, C# and Java, and have only briefly dabbled in Obj-C. Now that there are two possibilities for doing iOS Development, which would you suggest that I learn, at least at first? And is Swift even far-enough along to use as the basis for an entire app's development? My goal is the fastest and easiest way to market for this project; not to start a career as a mobile developer.

    This portends badly. You don't know enough about any of the languages currently in use on any platform, and your goal is "the fastest and easiest way to market?" The obvious solution is to give the job to someone else who knows what they're doing.

    So, since that's not what's happening here (and any sane - and most insane - business would go that route), this is a case of "I've got a cool idea for a mobile app but I don't know anything about the platforms or how to code in the languages behind them, and I don't want to give any details about what its' performance and resource requirements are because someone might steal the idea." This is further borne out here:

    If/when I decide to port my iOS App to Android (and/or Windows Phone), would either of the above be an easier port; or are, for example, Dalvick and the Android APIs different enough from Swift/Obj-C and CocoaTouch that any 'port' is essentially a re-write?

    Why not just download the dev kits for Android [android.com] and iOS [apple.com] and ask yourself if you can even understand the development documentation, the APIs, etc? The problem right now is yo don't even know enough to ask the right questions: you don't want to commit to something (objc vs swift) this early in your learning curve and then find out you made the wrong choice because you didn't take a month to pick up some basics.

  • My current company did most of their work in Objective-C. It's a bear. One of the worst parts is all the retain and release calls. They're used for memory management, and god help you if you forget because there's no obvious way to see the problem. Our current company is ditching Objective-C entirely and moving to QT and C++. My boss, who wrote all the Objective-C stuff, says that Objective-C has become a mess over the past 5-10 years as Apple is promoting Objective-C for both iOS (iPhone, iPad) and OSX (de
    • Re: (Score:2, Insightful)

      by Anonymous Coward

      You could try using ARC (Automatic Reference Counting) and the retain-release difficulties [are suposed to] disappear. The code to interface to the low level code is added (transparently) by the compiler when ARC is enabled.

    • by Bogtha ( 906264 )

      One of the worst parts is all the retain and release calls.

      OP says he's familiar with C, so he's already used to manual memory management.

      Regardless, modern Objective-C uses ARC, which means all the retain and release calls are automatically generated by the compiler. You actually get a compiler error if you try to write the calls yourself these days.

      god help you if you forget because there's no obvious way to see the problem.

      Aside from the fact that Apple provides excellent tools like Instrum

    • You don't need to use "all the retain and release calls". In fact, by default, they are not enabled. They're only required in legacy code, or if you really prefer to work that way (and believe it or not some do - it's actually not really very hard if you take the trouble to understand it properly - most people who get into trouble with manual retain/release/autorelease often haven't spent the half hour reading the relevant documentation, or the even-better explanation found in 3rd party books, e.g. Hillegas
  • There's a very strong case to be made for Swift first going forward, and not many seem to be making it or understand the iOS dev world at all.

    I speak as someone who has been developing iOS applications since somewhat before the release of the iOS SDK way back when.

    I don't think anyone outside those paying the closest attention to iOS development realize how rapidly Swift is being adopted, especially by those who have been doing Objective-C the longest.

    That's the core aspect of this I don't think people unde

  • Don't do apps. (Score:4, Insightful)

    by Animats ( 122034 ) on Saturday September 27, 2014 @01:05AM (#48007715) Homepage

    You say you're an experienced embedded-systems developer. Those are rare. Stay with that and get better at it. There are already a huge number of people grinding out appcrap, more than the app market can support. Soon there will be a glut of former phone app programmers, if there isn't already.

    Try to get in on the back end of the "Internet of things". That crowd is overrun with appcrap people and has no clue about embedded.

  • Comment removed based on user account deletion
  • You're an experiecned C developer? Well, sorry, but that's a no-brainer then. Go for Objective-C. Anything else would be really really stupid. You'll have to change some C habits to actually 'get' Obj-C, but you'll live. Obj-C works on every plattform, so you wouldn't be tied to iOS/OS X either. Only upsides to that route for you.

    I OTOH also am an experienced developer, but pampered by 15 years of modern scripting language usage. I would want to learn C++ or Objective-C (I've been trying to pick up C++ for

Our OS who art in CPU, UNIX be thy name. Thy programs run, thy syscalls done, In kernel as it is in user!

Working...