Why Swift? It's Fun!
Here it is, my pitch for “Why Swift?”
I had an opportunity to develop a full-stack web application to assist in the collection of public comments on regulatory change proposals. The existing practice is to publish an email address and read the comments that are sent in. There is a bit of a scramble to extract all the comments that relate to the many sections of the proposed regulation amendment.
We agreed to build a Minimal Viable Product based on expert knowledge of the domain professionals in the Government of Canada and to synthesize and test a solution on a real regulatory amendment. We started the engagement in December 2016, and a contract followed in mid-January. It was in this time frame that the technical choices were made as there would be only 6-weeks to the live deployment of the first phase of the product on March 4th.
For the front-end browser code, React was investigated. I stuck with the JQuery tool set that was in use with the Canada.ca website.
The MongoDB database was investigated as there might be evolutionary flexibility. A specific data model emerged as we talked to the domain experts, and I decided that MySQL was sufficient for the minimal product.
Now for the choice of the server platform, I was intrigued with the emerging use of pure Swift as a server option. I am an iOS developer, and my experience is that Swift code is almost half the length as Objective-C and it also allowed easier checking of bad and missing input.
Apple was releasing Swift as an open source project detached from iOS and Mac.
So the answer is: I chose Swift because it was fun to use.
I still had to pick a server library as there are a few bold implementers that are “all-in” with the building of emerging swift server platforms.
First up was IBM Kitura. Impressive that IBM is serious with Swift but they are little late to the Cloud rumble and maybe are just differentiating? Nevertheless, solid support.
Next was Perfect, being built in Canada, perfect! Documentation and many utilities; this was almost my choice.
Then Vapor, smart developers in New York City, great effort in documentation and helping new adopters while evangelizing and coding like crazy.
This confirmation of Vapor by Nodes, a European app development shop swayed me to go with Vapor. The Nodes Agency had strategically decided to use Vapor for new projects. They were an experienced Laravel shop willing to make this jump. They also sponsored the Vapor developers, putting money in to make the switch; so Vapor would be vibrant for at least another year. With Kitura and Perfect as backups, I went with Vapor and am still happy with the decision. I also know that you can only really know after 5 years whether any architectural decision is good.
From the Nodes technology page
Vapor – Server Side Swift
Vapor is the most used web framework for Swift. It provides a beautifully expressive and easy to use foundation for your next website or API. Nodes have a full system setup for supporting and maintaining Vapor Server Applications, and have already produced Vapor Server Applications for large corporations in industries such as pharma, aviation, transportation, and financial.
I was implementing the Minimum Viable Product – the Vapor team was working on the Vapor 2 release. This was reassuring, but I had to go with Vapor 1. I have now spent 3 to 4 weeks restructuring my original app to use Vapor 2; painful but necessary as early adopters need to live with such pain.
Some argue that only trusted proven frameworks are the best choice to find programmers. My argument here is that fun is more of an incentive to hire good programmers. Apple is helping with the training of future Swift programmers.
Watch the movie on this next page; it makes me cry with happiness.
Let your kids do the kind of things on these next few pages and then PHP will not look like a sensible path for you to take if you want to hire them, eventually.
- Swift Playgrounds A new way to learn to code with Swift on iPad.
- Apple’s Swift Playgrounds will make robots and drones dance
- Apple brings dancing robots and backflipping drones into Swift Playgrounds
If you are a hardcore geek then Total programming in Swift nicely summarizes why coding in Swift makes your program better than it would have been.
Google is working to add Swift to their Fushia OS.
Feel free to blame me if you have fun being a Swift coder.
Shrug You asked!