Ashraf Ali

Ashraf Ali

Swift has me thinking about programming languages

I found ArsTechnica's recap of Swift, Apple's new programming language to be a simple and clear overview. This article had me thinking about programming languages.

I find programming are designed for the logical human being. For everyone else, applying a mental model of the abstracts of programming is an exercise in frustration. As a person who can't programming effectively*, it can be difficult to understand specialized features and functionality of a programming language. Abstract terminology is used to represent different models of storing data, handling data, and executing queries for processing.

Coming from a strong creative background, this can be a deterrent in learning a language. It requires a change in thinking. I'm used to manipulating typography on screen in Illustrator by dragging bars and handles until it feels right. When it comes to programming, there is no room for error. For the most part, it either compiles or it doesn't.

There is creativity in the presentation of your code, the clarity, and cleverness of execution. However, you can't break the box. You can hack outside the box, but the box is your safety net. You have to work with those constraints and your APIs and your classes. You can write your own, but then you feel like you are entering expert territory.

In some instances, Swift makes it easier to programming by determining the type of your variables:

You declare these as variables with a type, or you can simply assign a variable a value and Swift will figure out which type you actually want (i.e., if you assign something a value of 5.7, Swift will make the variable a double-precision floating point). Swift also encourages you to use constants when you've got a value that's not likely to change; instead of "var," those are assigned using "let."

But it also makes it difficult when it comes to handling the difference between verbose and concise code:

In lots of other ways, Swift is quite a bit harder to read. In key places, the presence of a single character—an exclamation point or question mark—buried in a chain of function calls will completely change the behavior of the line of code. You can do much more with function definitions, like set default values and give the arguments internal and external names, but doing so means the function definition has to be read carefully in order to understand what it does.

When I hacked together a web view-based javascript app a few years ago, I remember reading code online and asking myself "What is that?" And even though StackOverflow is my friend, it can be infinitely difficult to search for answers to some of your programming questions.

I wouldn't say Apple's programming language has a simplicity like BASIC or HyperCard or Visual Basic. However, kudos to them for taking a step in the right direction. For the first time, learning Swift feels as simple as learning Java for the first time.

That is, until you can build your first mobile app. Then, perhaps, all hell will break loose. I'll let you know in a few years.

*I say "effectively" because while I can program some javascript or hack together some PHP, it is cobbling text that barely compiles. I can read code pretty well. It's programming clean, beautiful, functional code that becomes an enormous struggle. I'm still working on it.