Skip to main content

Learning to Code: The Tool(s)

If you want to learn Objective-C, it helps to know C. Learning C — or reviewing it — is a good way to become familiar with Apple's development tools, too.

Learning to program is a cause of mine. I advocate teaching programming to all students, not merely a handful of geeks, hackers, or nerds. When we teach everyone about coding, it demystifies how computers work and it introduces students from a wider variety of backgrounds to what could be an excellent career path.

Years ago, educators would use LOGO or BASIC in elementary school classrooms. Then, along came HyperCard. There are still introductory programming tools based on LOGO, BASIC, and HyperTalk languages. You can learn to program using AppleScript or by writing Microsoft Word macros in Visual Basic for Applications (VBA). Personally, I'm for using whatever tools a teacher might enjoy at the earlier ages (K-6). In high school, though, I am biased towards plain, simple, C as a foundation for future coding skills.

If you learn the basics of C, you can adapt to Java, C++, C#, or Objective-C. The skills you learn coding in C are portable — much like the language itself. C is not a fancy language. It has quirks, too.

I would advocate for Delphi or Free Pascal (both using Object Pascal), and I am a passionate defender of the Pascal family of languages. But, realistically the computing world today is dominated by "curly-braces" and languages influenced by C. (I wish Apple would embrace Pascal again, which was once the language of choice for high school programming courses. Apple helped create the Object Pascal standard. Pascal… well, that's a tangent I'll take in some other post.)

You Need an IDE. You Need Xcode

To start programming on the Mac, you first need to obtain Apple's Xcode integrated development environment (IDE). Even if you wish to use another editor, you'll need Apple's tools eventually. Thankfully, Xcode is a free download from Apple's App Store:

https://developer.apple.com/xcode/

Note: The basics of the next few posts will help anyone, on most any operating system platform. However, since my coding journey is from C to Objective-C on OS X and iOS, these posts will have a decidedly "Apple-centric" focus. You do need to use the Apple tools to create a proper iPhone or iPad application, and I'm convinced that most Apple computer users also want a "native" look-and-feel application, instead of the not-quite-right experience of Java of C++ apps that don't use the Cocoa frameworks.

There are other free IDEs that are ideal for learning C. On the Mac, Windows, and Linux, I often use NetBeans. When you download NetBeans, be sure to obtain the "All" bundle, which enables C, C++, Java, and PHP programming. Download NetBeans from:

https://netbeans.org

Eclipse might be the most popular free IDE for Java and C/C++ development. Eclipse is also available for Windows and Linux. I don't happen to like Eclipse as much as some of my colleagues, but it is only a matter of preference. For the topics I'm going to discuss, be sure to download the "C/C++" bundle of Eclipse. Download Eclipse from:

http://www.eclipse.org

Though I am not discussing the "how-to" of NetBeans or Eclipse, you can code and test any of the C applications I include on the blog. Technically, you can learn Objective-C on a platform other than Apple's OS X, too. For more information on free Objective-C tools for Windows and Linux, visit:

http://www.gnustep.org


Microsoft Freebies!

If you are a Windows user, Microsoft's basic programming tools are also available for free. That's right, you can get something for nothing from Microsoft. I won't be discussing any of those tools in this series of posts, though I might write a bit about them in the distant future. You can download the Microsoft Express tools from:

http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products

(You can search for "Microsoft Express" if the link above doesn't work.)


Nothing Else Required

After you download and install Xcode, you're ready to program. That's it — nothing else is required on a Mac. You're ready to write a program. Seriously. We're ready to discuss C programming in the next blog post. In the meantime, launch Xcode and feel a bit overwhelmed. You might also rush out and buy a few books. I'm using:

Clair, Robert. Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers. 2nd ed., 2013. 9780321832085 / 0321832086

Comments

Popular posts from this blog

MarsEdit and Blogging

MarsEdit (Photo credit: Wikipedia ) Mailing posts to blogs, a practice I adopted in 2005, allows a blogger like me to store copies of draft posts within email. If Blogger , WordPress, or the blogging platform of the moment crashes or for some other reason eats my posts, at least I have the original drafts of most entries. I find having such a nicely organized archive convenient — much easier than remembering to archive posts from Blogger or WordPress to my computer. With this post, I am testing MarsEdit from Red Sweater Software based on recent reviews, including an overview on 9to5Mac . Composing posts an email offers a fast way to prepare draft blogs, but the email does not always work well if you want to include basic formatting, images, and links to online resources. Submitting to Blogger via Apple Mail often produced complex HTML with unnecessary font and paragraph formatting styles. Problems with rich text led me to convert blog entries to plaintext in Apple Mail

Learning to Program

Late last night I installed the update to Apple's OS X programming tool suite, Xcode 4. This summer, in my "free" time I intend to work my way through my old copy of Teach Yourself C and the several Objective-C books I own. While I do play with various languages and tools, from AppleScript to PHP, I've never managed to master Objective-C — which is something I want to do. As I've written several times, knowing simple coding techniques is a practical skill and one that helps learn problem solving strategies. Even my use of AppleScript and Visual Basic for Applications (VBA) on a regular basis helps remind me to tackle problems in distinct steps, with clear objectives from step to step. There are many free programming tools that students should be encouraged to try. On OS X, the first two tools I suggest to non-technical students are Automator and AppleScript. These tools allow you to automate tasks on OS X, similar to the batch files of DOS or the macros of Wor

Learning to Code: Comments Count

I like comments in computer programming source code. I've never been the programmer to claim, "My code doesn't need comments." Maybe it is because I've always worked on so many projects that I need comments  to remind me what I was thinking when I entered the source code into the text editor. Most programmers end up in a similar situation. They look at a function and wonder, "Why did I do it this way?" Tangent : I also like comments in my "human" writing projects. One of the sad consequences of moving to digital media is that we might lose all the little marginalia authors and editors leave on manuscript drafts. That thought, the desire to preserve my notes, is worthy of its own blog post — so watch for a post on writing software and notes. Here are my rules for comments: Source code files should begin with identifying comments and an update log. Functions, subroutines, and blocks of code should have at least one descriptive comment.