Mobile
Article
By Ariel Elkin , Max Hornostaiev

Swift: Probably The Best Full-Stack Language in the World

By Ariel Elkin , Max Hornostaiev

Ever since its release in 2014, Swift went through multiple iterations in order to become a great full-stack development language. Indeed: iOS, macOS, tvOS, watchOS apps, and their backend can now be written in the same language.

Backends can be written in many other languages – but let us argue why Swift is probably the best full-stack language in the world.

  1. Safety. An essential advantage of Swift as a perfect back-end programming language is the safety built into the language. Swift does away with entire classes of errors and crashes. Remember null pointer exceptions? Those that cause crashes when objects you expect not to be nil are accidentally nil. Swift’s optionals let you know in advance if an object may be nil, and if so, force you to adequately handle the nil case. Safe initialization prevents you from ever initialising an object such that it ends up being nil. Remember unrecognized selector sent to instance crashes? Swift is type-safe meaning that if you’re calling a function on an object that doesn’t respond to it, the error will be caught by the compiler and not at runtime. Yet Swift was explicitly designed to be familiar and practical, rather than to adhere to some particular programming dogma. That said, as Chris Lattner puts it, “the defaults encourage safety and predictability”.

    --ADVERTISEMENT--

  2. Fewer Context-Switching. It is a substantial context-switch for iOS and macOS programmers to learn SQL, JavaScript, Ruby, Java or other typical back-end languages. Swift, however, can provide equivalent functionalities with a familiar language and frameworks: Apple’s Foundation has been ported to Linux.

  3. Designed for General Purposes. Swift was designed for generality, to be used at a high level as well at a systems level. The aim is to make it equally powerful for building applications, servers, scripts, and, soon, operating systems.

  4. Great pre-existing web frameworks to chose from Several substantial Swift web frameworks already exist, no need for you to reinvent the wheel. Kitura, Perfect, and Vapor offer you the platform and modules you need to quickly get a server up and running. They are young but stable frameworks, and are already used in production.

  5. A great environment for work and study. Swift Playgrounds are an awesome place for quickly experimenting with code that runs on either your app or your server. This gives you the chance to see how some adjustments of your code work as you type them – no more waiting for your compiling and executing code. Similarly, the REPL is a Swift command-line environment that will appeal to many developers. You simply type your statements and the REPL immediately interprets your code, letting you see the results instantly.

  6. IBM’s Support. IBM became one of the biggest Swift fans and supporters since Apple open sourced it. They were the first major cloud infrastructure provider that built native Swift apps in production. As of today, IBM has already developed more than 100 apps on Swift. Besides that, the company has greatly contributed to the evolution of Swift by creating IBM Cloud tools for Swift and, of course, the Swift Sandbox, a cloud environment that enables programmers to write their Swift in a server environment on top of Linux. In February 2016, the company introduced Kitura, an open-source web server framework written in Swift. Kitura enables the development of mobile front-end and back-end in the same language. So a major IT company uses Swift as their backend and frontend language in production environments already.

  7. The most in-demand technology. According to freelance placement firm Toptal, Swift is the most in-demand programming language. Toptal’s data showed that there was a 600 percent increase in demand for freelance developers who know Swift. This will likely lead to more developers learning Swift and further boost a thriving ecosystem.

  8. The most loved language A Stack Overflow survey of more than 50,000 developers from around the globe concluded that Swift was the second most loved programming language in 2016, and the most loved programming language in 2015. Which is probably why it’s also GitHub’s most starred language (with over 36,000 stars at the time of writing). Write your entire stack in a language that developers are happy with!

Using the same programming language throughout your entire development process may involve many compromises, as a language isn’t always well-adapted to and well-loved on every platform. With Swift, that is no longer the case: the language is designed to excel on every platform, and is excelling on every platform. That’s why it’s probably the best full-stack programming language in the world.

Further Reading:

  • Dave Y.

    #4 and #7 are the same?

  • rag

    What is the article about? What is its purpose? Who is the target audience? You tell us how great Swift is. But why? Do people constantly argue that Swift is a bad language? It would have been much better if you would have provided some context at the beginning of the article.

    Objectively, calling any language best is just silly. There are not enough metrics that everybody can agree on in order to qualify a language as being best.

    • Ariel Elkin

      The idea aim of the article is to promote usage of the Swift language. Many people may already be persuaded that Swift is a great language, but many others – i.e. our main target – aren’t as familiar with it, or with its server-side capabilities.

      You’re right to say that “there are not enough metrics that everybody can agree on in order to qualify a language as being best”, but we’re not trying to agree with everybody here. We’re opinionated. So we picked a handful of metrics and are confident that there will be a good amount of people to agree with those.

      • rag

        The biggest problem with the article was the missing context. After you published the “Swift Month” editorial it became obvious why you wrote this one. So it would have been better if the two articles would have been published in different order.

  • Ariel Elkin

    Full-stack usually refers to back-end (i.e. servers apps, which Swift can do), and front-ends, i.e. what the user sees and directly interacts with. We often associate HTML/CSS/JS as the tech that builds a front-end, but then again an iOS, tvOS, or watchOS app is equally a front-end.

    Swift will soon be ported to Android:
    https://github.com/apple/swift/blob/master/docs/Android.md

  • It did seem a bit too vague. Just like every language they all have their own purpose because they’re just tools and resources. But Swift is still new and it still has yet to prove its specialized purpose.

  • Roy Tyrell

    No. I’m sorry — but swift is a nightmare in any context. It is superficially easy – one can create trivial programs to do trivial things with little effort. But complexity rises exponentially in real world use. It is a scattershot of paradigms trying to be all things to everyone and does none of them well.

    It’s obsessive focus on “nil” is almost autistic. There is no rational for it. It offers confusion rather than solve a problem — which frankly doesn’t exist.

    Allowing enums to become full blown classes – complete with top-level lambda expressions, embedded functions within functions, inout parameters… it is a programming language that reads like a bad grad school acid trip. Semantics actually *do* matter.

    Structure is a good thing.

    Good intentions do not cut it.

  • Rasmus Schultz

    I’ve been interested for a while now, but: no Windows version.

    When the “best” language becomes available to the other 90% of us, I’ll take another look.

Recommended
Sponsors
Get the latest in Mobile, once a week, for free.