Skip to main content

Learning to Code: Starting Point for Objective-C

As readers of this blog know, the more I delve into programming, the more convinced I am that it should be a standard school subject — not merely an elective sought after by a few enthusiastic students. Programming skills reinforce the value of breaking problems into simpler pieces. In the end, a computer must reduce problems to simple tasks. Good writers, historians, chemists… we all break problems into little, digestible, solvable tasks.

And just as a musician must practice scales, the basics of programming need to be practiced and sometimes revived. It is no secret that my C skills have atrophied, so I am starting from the beginning. My journey towards Cocoa Goodness begins with two books:


In the early pages of Clair's text, he mentions that you need a good understanding of C to work effectively in Objective-C. Turning to my bookcase, I found several C books, but settled on the Absolute Beginner's Guide because it is operating system and compiler agnostic. It is an old and simple book (1994 being the ancient past in computer time), yet it is precisely what I needed for a quick review.

I'm strange, I realize. Not many people like to go back and read basic grammar books, yet I always enjoy recalling the little bits about English I forget. Any time I teach a writing or literature class, I review the materials and feel like I'm discovering something new. Programming has that same feel.

As Clair reminds readers of the basic syntax and common functions in C, I turn to the Perry text and read the short chapters on the same topics. Clair assumes that his readers know C, C++, Java, and similar languages. He also stresses that Objective-C is closer to C than C++ — so you need to unlearn (C++) and relearn (basic C) as you move into Objective-C.

Many, many years ago, when I was an undergraduate, USC had several NeXT computers. The language used to program the NeXT was Objective-C and the operating system was NeXTSTEP (with the silly all-caps but "e" format). As I start writing about Obj-C, you'll be able to recognize this legacy. I graduated from USC in 1990, so a fair number of years (22+) have elapsed since I last used Objective-C. Even as a Mac owner and user, I clung to other tools for as long as possible. Now, I must go back to the future.

Programmers might wonder why I'm not turning to that fabled classic, The C Programming Language by Brian Kernighan and language creator Dennis Ritchie. Or maybe an O'Reilly book, such as C in a Nutshell. The Absolute Beginner's Guide is a better text for me. It's much better than a "Dummies" or "Idiots" text, sparing readers the attempts at humor. Perry keeps chapters focused on one topic. At the end of the book, there is a code listing for a complete blackjack game. I like that the code heads towards a real project, something I can play with and modify.

Going back and forth between a dense technical text (Clair) and a more project-based text (Perry) helps me consider issues from two perspectives. Beginners don't think about pointers and memory, which is an essential aspect of coding. The better you understand computing theory, I believe the better your code. You don't need to understand the finest details, but enough to appreciate what is happening "under the hood" when you create an application.

Young writers can get overwhelmed when we focus too much on grammar and mechanics. Beginning programmers can also be overwhelmed by too much deep theory. Focusing on ideas first, then developing an appreciation for how a language works seems perfectly logical to me. We don't teach children grammar before they speak! We teach them about nouns and verbs, periods and commas, long after a child is speaking.

As a programmer, I like to see how problems are solved, and then I study the code. After I study the code, I enjoy going that extra level or two deeper — which is why I love learning about the magic performed by compilers.

A good enough comparison: When I learned BASIC, I didn't need to understand what the interpreter or compiler was doing. As I learned C, it helped to learn how memory worked. Later on, I learned how to optimize C code, based on what the compiler would do and how a particular CPU worked. Yet, learning BASIC was an ideal introduction to programming: I learned to express simple ideas (BASIC) before learning how to write properly structured programs (Pascal, Fortran, and C). Yes, I know you can do a lot with modern BASIC derivatives — but early BASIC, was called BASIC for a reason. BASIC allowed mere mortals to program.

What have I learned as I revisit C and begin to learn Objective-C? I'm going to bore readers with a bit of C in my next post, since that's what I've been revisiting. I'll also discuss how learning something like C helps me as a creative and academic writer. Yes, coding can be poetic. It is certainly inspiring.

Comments

  1. I've never been a fan of K&R. It's a nice historical curiosity, but not as the first introduction to a new C programmer.

    ReplyDelete
  2. I can really identify with your description of coding as poetic: there is a beauty to a well-written piece of code that I find very pleasurable.

    ReplyDelete

Post a Comment

Popular posts from this blog

Comic Sans Is (Generally) Lousy: Letters and Reading Challenges

Specimen of the typeface Comic Sans. (Photo credit: Wikipedia) Personally, I support everyone being able to type and read in whatever typefaces individuals prefer. If you like Comic Sans, then change the font while you type or read online content. If you like Helvetica, use that.

The digital world is not print. You can change typefaces. You can change their sizes. You can change colors. There is no reason to argue over what you use to type or to read as long as I can use typefaces that I like.

Now, as a design researcher? I'll tell you that type matters a lot to both the biological act of reading and the psychological act of constructing meaning. Statistically, there are "better" and "worse" type for conveying messages. There are also typefaces that are more legible and more readable. Sometimes, legibility does not help readability, either, as a type with overly distinct letters (legibility) can hinder word shapes and decoding (readability).

One of the co…

Let’s Make a Movie: Digital Filmmaking on a Budget

Film camera collection. (Photo credit: Wikipedia) Visalia Direct: Virtual Valley
June 5, 2015 Deadline
July 2015 Issue

Every weekend a small group of filmmakers I know make at least one three-minute movie and share the short film on their YouTube channel, 3X7 Films.

Inspired by the 48-Hour Film Project (48hourfilm.com), my colleagues started to joke about entering a 48-hour contest each month. Someone suggested that it might be possible to make a three-minute movie every week. Soon, 3X7 Films was launched as a Facebook group and members started to assemble teams to make movies.

The 48-Hour Film Project, also known as 48HFP, launched in 2001 by Mark Ruppert. He convinced some colleagues in Washington, D.C., that they could make a movie in 48 hours. The idea became a friendly competition. Fifteen years later, 48HFP is an international phenomenon, with competitions in cities around the world. Regional winners compete in national and international festivals.

On a Friday night, teams gathe…

Edutainment: Move Beyond Entertaining, to Learning

A drawing made in Tux Paint using various brushes and the Paint tool. (Photo credit: Wikipedia) Visalia Direct: Virtual Valley
November 2, 2015 Deadline
December 2015 Issue

Randomly clicking on letters, the young boy I was watching play an educational game “won” each level. He paid no attention to the letters themselves. His focus was on the dancing aliens at the end of each alphabet invasion.

Situations like this occur in classrooms and homes every day. Technology appeals to parents, politicians and some educators as a path towards more effective teaching. We often bring technology into our schools and homes, imagining the latest gadgets and software will magically transfer skills and information to our children.

This school year, I left teaching business communications to return to my doctoral specialty in education, technology and language development. As a board member of an autism-related charity, I speak to groups on how technology both helps and hinders special education. Busin…