Don of the Day

Don of the Day


Adventures in software development with Xamarin and the Web

Software developer, building things with code in sunny Scottsdale, AZ.

Share


Twitter


The Road To Swift From a C# Developer's Perspective - Introduction

Don FitzsimmonsDon Fitzsimmons

Starting a blog series is hard. It's a commitment. I'm not sure how frequently I'll post about this, but my goal is to write about my experience learning the Swift language with some regularity. Why would an experienced C# developer learn a new language? And why would said developer learn Swift? Let's get right to the back-story.

I've been using C# for about 12 years now. That's a long time. When I look at a program written in C#, I can immediately understand what's going on. Okay, code is more or less readable depending on how well it's written and who wrote it, but when I look at a C# program, there's no translation needed. It's like voices immediately start talking in my interior monologue. Just like glancing up at billboard while driving. You don't consciously read it, it just speaks to you.

Contrast that with something like Javascript. I think Javascript is the next most-known language in my repertoire. But with Javascript, there's a bit of pause before the concepts start clicking. I have to shift gears. It's like reading the New King James version of the Bible. It's English, but it's an antiquated version of English which requires a certain degree of effort to parse.

I'm conscious that I'm reading when I read the NKJ version of the Bible and when reading Javascript. I can do it, and after a while, it flows, but I'm aware that I'm reading. Not so with C# due to the years of experience. And that's what it takes to become truly fluent in any language: day-to-day usage over the course of years. Learning a new language is agonizing. Learning all the conventions and APIs that go along with that new language is torture. It hurts, but it's always worth it.

Okay, back to the point at hand. Why am I learning Swift? I ask myself that same question. I mean, I'm not even writing code for a living anymore. I've joined the ranks of management. But, I can't help but create things. If I'm not creating software or photos, I'm miserable. So I must create. The desire to create along with a desire to build something for a mobile platform led me to iOS for a number of reasons (my preferred platform, users more willing to pay for software, etc).

I landed a side job writing an iOS app. Funny thing is, I agreed to discuss the app with my soon-to-be client before I even owned a Mac. I did have a Xamarin license and the willingness to go through the pain of learning the iOS APIs, but no Mac. Things worked out.

I ended up finding a Mac. My father-in-law had one lying around and he gave it to me. Whoo hoo! I can write iOS apps now. I have a Mac, a Xamarin license and C# skills. Shortly thereafter, I met with my client, the one who who needed the app, drew up a contract and I started writing my second app (I did build a Windows Phone app). That last sentence would have sounded way more inspirational if this had been my first app. "I started my first app!" But no, this wasn't my first one.

So, here I am, using Xamarin and C# to create this app and things are going as well as they could. Other than the fact that Apple is years behind Microsoft in terms of development tools. I mean, who the hell likes Autolayout? It's an abomination. That's where most of my time and frustration are spent. Fighting the Xcode design tools. Apple should really take a look at XAML and Visual Studio to see how well UI design can be done.

The other struggle is learning the iOS API. NS this, NS that. Why the hell is everything prefixed? Oh, because these fools don't have namespaces. Sucks. Prefixes make code ugly. Things are very different over hear in iOS land. I miss my .Net APIs. They're so much cleaner and familiar. But, I'm getting the hang of Apple's APIs. I'm using C# to access them so that's nice. But is it really? I mean, I feel like I'm cheating by using C#. I'm faking it, aren't I?

This is where my desire to learn Swift comes in. For whatever reason, I have a strong desire to build apps using all of the native tools, including the language. Now if I had to learn Objective-C, forget it. When I look at that syntax, stomach acid breaches the upper-level of my esophagus, touching the back of my tongue, causing horrible discomfort. It's so clunky and un-readable. I'm sure Objective-C people would strongly disagree and say similar things about C#. But when I saw Swift I thought, "Hey, that's pretty cool." It's sort of a mix of C#, Java, Javascript and some other semi-familiar languages.

Other attractions to Swift are that it's a modern language. Like, very modern. That's fun. And, I'm not the only fool learning it. It's so new that everyone using Swift is currently learning Swift. That's a unique thing. I've been reading the Apple documentation for Swift when I can find the time and I like a lot of things about it. But hey, learning new things is pain. Language learning is horrible, frustrating, rag-twisting pain.

Over the next few months, I plain to cuss, spit, bang on my keyboard in anger and eventually, emerge fluent in Swift. I also plan to write about the experience here. So join me as I drag myself kicking and screaming to learn this new language, the conventions and the APIs. I hope my experience aids you. More than that, I hope I can at least write frequently enough to really call this a series. Shit, if I hit that publish draft button, I'm committed. Here goes...

Software developer, building things with code in sunny Scottsdale, AZ.

Comments