Skip to main content

Learning to Program, Learning to Think

Visalia Direct: Virtual Valley
August 2, 2010 Deadline
September Issue

Learning to Program, Learning to Think

Several times a month I create or modify computer code, but I use the skills I have gained from programming on a daily basis. The more I learn about computer languages and programming, the more I learn to think creatively to solve problems.

Our schools are asked to prepare students for standardized tests, primarily on English and math skills. We frequently claim we want students to learn creative problem solving, but we test memorized knowledge. State and national tests focus on knowing such things as the meanings of words and how to solve math problems with memorized equations. I don’t question the value of memorizing Latin and Greek roots or the quadratic equation, but teaching how to think is essential to the future.

Computer programming requires analyzing a problem, breaking a possible solution into small parts and then writing the code to perform the steps required by the solution. Rarely is there one solution to a problem. Even the best solution depends on specific situations.

When I teach programming and Web design, I find students are perplexed that there can be more than one “best” solution. This is a business problem as much as a technical problem, which forces students to demonstrate the ability to think beyond memorized algorithms. Sometimes a program must be ready on deadline, so the speed of development is more valuable than the elegance of the solution. In other instances, a program will have to calculate and display results as quickly as possible, so development time and cost is secondary to final execution speed.

Programming, then, is about situational analysis. Life is also about situational analysis, however much we might crave “right vs. wrong” and single best solutions to problems.

Teaching programming does not have to mean teaching an advanced computer language such as Microsoft’s C#, Apple’s Objective-C or Sun’s Java. These are great final destinations for aspiring programmers, but far beyond what is needed to solve common problems.

Most of the coding I do falls under the categories of “scripts” and “macros,” not full-fledged applications. I enhance my personal efficiency with brief bits of code.

During the 1980s, what made Lotus 1-2-3 the most popular spreadsheet and WordPerfect the leading word processor was not their ease of use. These were complex, often annoying, applications that required cheat sheets and keyboard templates to fully exploit their features. What made these applications special was their ability to execute “macros,” allowing the automation of complex tasks.

The term “macro” in computer science describes a collection of functions expressed as a single “user-defined” function.

The success of Microsoft Office has been linked to the existence of Visual Basic for Applications (VBA) macro language in Word, Excel, Access, and almost every other Microsoft business application. Office 2007 and 2010 for Windows include extensive VBA support. Arguably, one of the dumbest choices Microsoft made recently was shipping Office 2008 for Mac without VBA macros — a decision Microsoft promises to reverse later this year.

I use a Word VBA macro I coded named “Problem Words.” This macro searches student papers for words and phrases to avoid in academic papers. The macro also creates a report for students on the readability and grade level of a submitted assignment.

The macros I create are listed on a menu and on a toolbar as icons. The “Problem Words” macro appears as a single function, while executing dozens of functions. Best of all, I don’t need to recall the exact steps when I grade a paper: the macro ensures I search for the same problems in every student paper. Like most teachers, I would rather focus on the quality of ideas in a paper than the basic mechanics, but students should be reminded of English rules and academic style. My macro frees me to grade ideas, not grammar.

I teach my students how to create and modify macros in Excel and Word. For many of my students, this is their first experience with computer programming. By the end of each semester, most students have customized Office applications with a dozen or so macros.

In some ways, Apple has taken the macro concept much further than Microsoft. The AppleScript language is available throughout the OS X operating system. AppleScript programming is supported by Apple applications and by thousands of other applications, including Microsoft Office and Adobe Creative Suite. I have AppleScript versions of my favorite Word and Excel VBA macros.

If writing computer code is daunting, Apple also provides Automator, an application that allows you to create scripts without having to master AppleScript. I use Automator to convert and resize graphic images for Web pages. This allows me to process a “batch” of hundreds of pictures without having to edit them individually.

Any time I am going to be dealing with the same problem several times, I ask myself if creating a macro is reasonable. I save hours of time each month with macros and scripts. Each one began as the solution to a problem. Over time, my macros have been improved and expanded to perform their tasks more effectively.

Once students learn to code macros, many ask me about “serious” programming. Usually the students want to learn how games and phone “apps” are created. I’m pleased to report that several of my students have pursued their interest in coding, realizing anyone with an interest can program.

We need to encourage all students to view computer programming as a useful skill, not as a field limited to math wizards and technology fanatics. You don’t need to be a computer scientist to make computers do what you want.




Microsoft Office and Visual Basic for Applications

There are many good books on VBA for Excel. Users with complex spreadsheets tend to benefit more from macros than other computer users. I suggest the following books, listed from beginning skills to advanced:

1. Excel VBA Programming for Dummies by John Walkenbach
2. Excel 2010 Power Programming with VBA by John Walkenbach, part of the series “Mr. Spreadsheet’s Bookshelf”
3. Mastering VBA for Office 2010 by Richard Mansfield

For Word users, I suggest Word 2007 Macros & VBA Made Easy by Guy Hart-Davis. The macros explained work in Word 2010 without any problems.

Advanced Programming

If you want to learn applications programming, both Apple and Microsoft distribute tools for free. Both companies require registering to download the free programming languages and tools from their sites.

Apple Developer Central: http://developer.apple.com/

Microsoft Express Programming: http://www.microsoft.com/express/


Comments

Popular posts from this blog

Slowly Rebooting in 286 Mode

The lumbar radiculopathy, which sounds too much like "ridiculously" for me, hasn't faded completely. My left leg still cramps, tingles, and hurts with sharp pains. My mind remains cloudy, too, even as I stop taking painkillers for the back pain and a recent surgery.

Efforts to reboot and get back on track intellectually, physically, and emotionally are off to a slow, grinding start. It reminds me of an old 80286 PC, the infamously confused Intel CPU that wasn't sure what it was meant to be. And this was before the "SX" fiascos, which wedded 32-bit CPU cores with 16-bit connections. The 80286 was supposed to be able to multitask, but design flaws resulted in a first-generation that was useless to operating system vendors.

My back, my knees, my ankles are each making noises like those old computers.

If I haven't already lost you as a reader, the basic problem is that my mind cannot focus on one task for long without exhaustion and multitasking seems…

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 and then format th…

Screenwriting Applications

Screenplay sample, showing dialogue and action descriptions. "O.S."=off screen. Written in Final Draft. (Photo credit: Wikipedia) A lot of students and aspiring writers ask me if you "must" use Final Draft or Screenwriter to write a screenplay. No. Absolutely not, unless you are working on a production. In which case, they own or your earn enough for Final Draft or Screenwriter and whatever budget/scheduling apps the production team uses.

I have to say, after trying WriterDuet I would use it in a heartbeat for a small production company and definitely for any non-profit, educational projects. No question. The only reason not to use it is that you must have the exclusive rights to a script... and I don't have those in my work.

WriterDuet is probably best free or low-cost option I have tested. It is very interesting. Blows away Celtx. The Pro version with off-line editing is cheaper than Final Draft or Screenwriter.

The Pro edition is a standalone, offline versio…