Slashdot Mirror


Swift: Apple's Biggest Achievement For Coders

GordonShure.com writes: Despite its publicity and hype being rather quiet by Apple standards, the Swift programming language has attracted praise since its release last year. Swift is one of the few Apple products that represent a departure from the hardware-led Steve Jobs approach to the business. If this year's survey of coders by Stack Overflow is anything to go by, it looks as if the language might have potential to really shake things up in a landscape which has been little changed since the 1990s. Might the days of Apple programmers relying upon objective C be numbered?

16 of 337 comments (clear)

  1. One more in a crowded field by TWX · · Score: 5, Insightful

    How's Swift's cross-platform suitability?

    There are two Apple platforms, one popular Google platform, one less-popular Google platform, plus Microsoft's platform. Is Swift suitable for writing applications for all? If not, developers would be writing for a limited, albeit popular platform, but limited to a certain subset nonetheless.

    --
    Do not look into laser with remaining eye.
    1. Re: One more in a crowded field by Anonymous Coward · · Score: 3, Informative

      Most developers? I don't know who you have been talking to or what you have been reading (maybe you work at Apple?), but the Android market share is much greater than the Apple market share. Plus it doesn't take much for a Java dev to turn his/her skills to Android, and C is the only language more popular than Java. In reality I doubt either platform will have issue finding developers.

    2. Re: One more in a crowded field by ShanghaiBill · · Score: 3, Insightful

      the Android market share is much greater than the Apple market share.

      For phones, yes. For apps, no. The average iOS user buys far more apps than the average Android user.

    3. Re:One more in a crowded field by IamTheRealMike · · Score: 5, Interesting

      Is Swift suitable for writing applications for all? If not, developers would be writing for a limited, albeit popular platform, but limited to a certain subset nonetheless.

      No, it's Apple specific. However that's OK because there's a language which is much like Swift, except it runs on pretty much every device you might have.

      That language is new. It's called Kotlin, and it is from JetBrains, the makers of the highly popular IntelliJ series of IDEs (+ WebStorm, PHPStorm, RubyMine, PyCharm etc).

      Kotlin targets the JVM and JavaScript. It interops perfectly with Java. That means code written in it runs on Windows, Mac, Linux and Android. Additionally, via the RoboVM project, JVM bytecode can be compiled to native ARM iOS/OSX binaries. There is no JIT compiler. RoboVM provides bindings to all Objective-C APIs on iOS so you can build native UIs and access all the same functionality as a native app. Programs written this way are on the app store, so Apple is cool with the technique.

      Kotlin has a clean, concise syntax and many modern features that match those in Swift. For example it has nullability/optionality integrated with the type system. It has Markdown comments. It has extension functions. It has some support for pattern matching. It has named parameters. It has the ability to define "data classes" that have easy immutability, content equality, hashcodes, serialization etc all in a single line of code. It has type inference and compile-time inlined lambdas, so you can do high performance functional programming with it. It has features to support complex DSLs. It has a full IDE with many built in refactorings, online static analysis, and via the JVM it has high quality CPU/memory profilers and debugging support.

      In short, programming with Kotlin is much like programming with Swift, except you have better tools, an IDE at least as strong as Xcode and in my experience stronger, and you can write apps with it that are indistinguishable from native iOS and Android apps.

    4. Re: One more in a crowded field by Feral+Nerd · · Score: 5, Informative

      Most developers? I don't know who you have been talking to or what you have been reading (maybe you work at Apple?), but the Android market share is much greater than the Apple market share. Plus it doesn't take much for a Java dev to turn his/her skills to Android, and C is the only language more popular than Java. In reality I doubt either platform will have issue finding developers.

      He is talking about profit potential, not who's got his OS installed on the most devices. The implication is that iOS development is more profitable than Android development which is something that I have heard from more mobile developers than just him.

    5. Re: One more in a crowded field by unami · · Score: 4, Insightful

      whatever the reason may be, this still makes apple's platform more interesting for professional developers.

    6. Re:One more in a crowded field by itsdapead · · Score: 4, Informative

      Is Swift suitable for writing applications for all? If not, developers would be writing for a limited, albeit popular platform, but limited to a certain subset nonetheless.

      Well, Apple just announced that they are planning to open-source Swift and will be also be releasing a Linux version of the compiler. So the language itself isn't going to be Apple-only for much longer.

      However, that only solves the language problem - the big divide between platforms is the totally different APIs that developers have to learn. Frankly, that's usually a bigger learning curve than picking up a new language.

      Mind you, you can say the same for most of the big languages - off the top of my head only Java (and maybe Javascript/HTML5) come with baked-in crossplatform APIs suitable for writing GUI applications.

      --
      In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
    7. Re:One more in a crowded field by Chalnoth · · Score: 3, Insightful

      Just as with Objective-C, I doubt that hardly anybody else will make use of the language.

      The problem is it just doesn't have all that much to offer for projects that are already making use of other languages. It's got a few slick features, but it can't really stand out all that much and the library support is going to be very far behind more mature languages for a long time (if not forever).

    8. Re: One more in a crowded field by SpaghettiPattern · · Score: 3, Interesting

      ... and C is the only language more popular than Java...

      Nitpicking here. I started with C nearly 3 decades ago, I switched to Java but I'd be able to pick up C again in a very short time. Large parts of large/huge systems I design in C structures as they provide a nice abstraction of the underlying hardware. No matter how much I like C, it's no longer number 1 when considering the number of programmers involved. It's "too technical" for application programmers. Considering that financial programmers push the numbers and that they are moving from COBOL to Java, I see Java as the COBOL of the future. The upshot is that Java is good enough to do almost anything and much more elegant than COBOL.

      --

      I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
    9. Re: One more in a crowded field by master_kaos · · Score: 3, Insightful

      And I have the exact opposite experience. We have 8x the usage on iOS vs android, and android users complain a lot more (some legit, some just outrageous requests)

    10. Re: One more in a crowded field by the_B0fh · · Score: 3, Insightful

      That's why the top 10 flashlight apps in the Android App Store all need access to networking, your SMS, mailbox, contacts, etc. "creative ideas for monetization" indeed.

  2. Quiet schmiet, frosty already by Hognoxious · · Score: 5, Funny

    Despite its publicity and hype being rather quiet by Apple standards

    I haven't seen it mentioned on CNN or the BBC, but there's about a dozen stories about it per day on a former tech new website.

    In fact, it's pushed 3D printers off the number one spot.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  3. Re:Yes, but it will be a while. by Lunix+Nutcase · · Score: 5, Informative

    Obj-C is on the way out.

    Uhh, no. So much of the system libraries on both OS X and iOS are written in Objective-C and they aren't going anywhere. Also, all the new APIs of iOS 9 and OS X 10.11 are still written in both C and Objective-C with Swift bridge headers. Basically, it's the opposite of what you claim.

    I'd guess that we're about a year away from the point where the majority new code at Apple is written in Swift.

    Maybe at the application level, but not for system libraries.

  4. That survey is problematic... by antiperimetaparalogo · · Score: 4, Informative

    If this year's survey of coders by Stack Overflow is anything to go by, it looks as if the language might have potential to really shake things up in a landscape which has been little changed since the 1990s

    "Most Loved"

    • Swift 77.6%
    • C++11 75.6%
    • Rust 73.8%
    • Go 72.5%
    • Clojure 71.0%
    • Scala 70.6%
    • F# 70.1%
    • Haskell 69.5%
    • C# 67.2%
    • Python 66.6%

    "Most Wanted"

    • Android 17.7%
    • Javascript 15.4%
    • Python 14.8%
    • Node.js 14.6%
    • AngularJS 13.2%
    • Java 10.5%
    • iOS 9.4%
    • Arduino / Raspberry Pi 8.5%
    • Swift 8.5%
    • C# 8.0%
    --
    Antisthenes: "Wisdom begins by examining the words/names." - excuse my English, i am (slightly...) better with my Greek!
  5. Swift is (shortly) everywhere, including Linux by SuperKendall · · Score: 3, Informative

    In the keynote they announced Swift being open source later this year, including releasing versions for Linux...

    Having done over a decade of backend work in the past, I think it would make a pretty good server language also. It's all about the libraries and frameworks that support what you are trying to do.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  6. Re:Frustrating type conversions by 0123456 · · Score: 5, Interesting

    That would probably have prevented the annoying bug I ran into a few years ago where someone copied a 64-bit time_t to a 32-bit int, did some arithmetic, and then copied it back to a 64-bit time_t, requiring us to update firmware at all customer sites to fix it. If they had to explicitly convert, they'd almost certainly have realized they were doing something wrong.

    That bug alone probably cost us more money than the time required for programmers to always explicitly convert types.