Skip to main content

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 WordPerfect and Lotus 1-2-3. Automator and AppleScript are great for taking routine tasks and converting them to one-step actions.

An example use for AppleScript or Automator might be creating a folder that instantly resizes and converts images into JPEG thumbnails. I also have an Automator action attached to a "rename" folder. I use this folder to append prefixes or suffixes to files I am going to archive. Learning these tools saves me hours of time each year.

Programming Environments
When I introduce students to VBA, I explain that Microsoft Office macros are programs. You develop, edit, and debug VBA code in an Integrated Development Environment (IDE). Most modern programming suites are built around an IDE, so VBA offers a great starting point. You edit code using a special editor that provides "code completion" (called by different names in various IDEs) and syntax checking. The user interface is created visually, often with drag-and-drop ease.

If you are comfortable with VBA macro editing, then moving to another IDE experience isn't that difficult.

What if you do decide to to learn "real" programming, beyond macros and scripts?

Programming on OS X
I do suggest sticking to C/C++/Objective-C on the OS X and iOS platforms. Plus, free is a good price — which is what Apple's tools are. Xcode is a good IDE, though it can confuse people familiar with the VBA environment or Microsoft's Visual Studio. The Xcode experience is improving with each update, thankfully. Some developers prefer Xcode to other IDEs, but I'm still not persuaded. It is a matter of preference.

I do want to offer a link to REALstudio, though (http://www.realsoftware.com/). Formerly REALbasic, RS supports OS X, Windows, and Linux. Not a bad product, but you have to consider the fact that Apple is notorious for leaving third-party tools behind. If a school wanted to teach object-oriented programming using a tool that is flexible and cross-platform, RS should be considered. The fact REALstudio supports Web development makes it worth a look, too.

Programming on Windows
If you want to learn to program on Windows, Microsoft offers free "Express" learning editions of their tools. I happen to like Visual Basic (I know, blasphemy) as a starting point for many people. To obtain the free editions of the Microsoft tools, visit the Express website (http://www.microsoft.com/express).

"Universal" Programming Tools Java remains an important alternative on all major platforms, though I'm not sure I'd teach Java to beginning programmers. If you do want to learn OOP using Java, try BlueJ (http://www.bluej.org/). There is also another education edition of Java tools, Project Greenfoot (http://www.greenfoot.org/).

Many programmers now use Eclipse and NetBeans for C, C++, and Java development. While Eclipse (http://www.eclipse.org/) is the better known of the two IDEs, I prefer NetBeans (http://netbeans.org/). Either way, what you learn will be easily transferred form one to the other.

Some "old-fashioned" programmers have suggested teaching to code using a text editor and command line compiler instead of some fancy IDE. The reality is, today's applications are generally visual. Also, the IDE editors are a better experience. You could teach C/C++ from a command prompt, but why?

Learn a Language!
I encourage everyone to learn something about coding on his or her platform of choice. You will gain a great deal of appreciation for how the technology you use daily is developed. You will also gain new appreciation for the need to analyze problems in "chunks" to solve them consistently and accurately.

Comments

  1. I completely agree that the key to success in programming is learning to think about problems in the "right" way - to break the problem down and consider the steps required to solve each part.

    The choice of programming language does influence the way you think about problems, and I would highly recommend making the effort to become fluent in more than one language: preferably languages that are significantly different. This will give you the tools to solve a wider range of problems that require different approaches, in much the same way as having more than just a screwdriver allows you to tackle different jobs around the home. I would recommend choosing programming languages that are widely-used because these benefit from better on-line support through various websites, forums and blogs.

    I started programming as a hobby, progressing to making a living from it. I use IDEs (Eclipse and Visual Studio) as well as text editors with command line tools. I recommend using a modern IDE when learning because the built-in tools make for a much richer experience and it is so much easier to explore the facilities of whatever language you are writing in. By all means, once you have gained a degree of proficiency, explore the command line tools that underpin the majority of IDEs because that will improve your understanding of how it all works, but that is not something you need to know to get started.

    ReplyDelete
  2. I am an English instructor, so getting the students to master one language would be an accomplishment. I consider it important, though, just as I consider learning calculus or physics important to the development of problem solving skills. Nothing bothers me more than hearing a student in an English class say, "I hate science" or "I hate math." The reality is, knowing a bit of everything helps one see the connections around us.

    ReplyDelete

Post a Comment

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 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.