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 for mobile developers.
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”.
Continue reading %Swift: Probably The Best Full-Stack Language in the World%
by Ariel Elkin via SitePoint
No comments:
Post a Comment