How much computer programming can you learn to do in just one hour?
Four people came out to Linx 8 Computer Repair and IT Services on Raritan Avenue early in the afternoon on April 4 to find an answer to that question, as part of a complimentary foray into computer programming called Hour of Code. Led by employee Luke Miller, the Hour of Code offered both children and their parents an immersion in the thought process of writing an original computer program.
The programming language in use was Scratch, developed by the Massachusetts Institute of Technology for children. Scratch also is useful for adults unaccustomed to computer programming or whose most recent connection with computer programming dates back to BASIC on a Commodore 64 or Apple IIe in the 1980s.
Because of its intended audience, Scratch is suited for writing simple games with simple animation. Users can download the Scratch interface for free from the MIT web site to run on personal computers that use Windows, Linux or Macintosh operating systems.
“The advantage of using Scratch is that it’s in plain English,” said Mr. Miller. “It’s very easy to read.”
Over the course of the session, Mr. Miller walked attendees through the programming behind a simple game he had created, of navigating a green block through a black maze while avoiding nine bouncing red blocks. Get hit by a red block, and the game starts over.
Some computer classes involve learning a piece of code and then writing something around it. The Hour of Code took the opposite approach. As the class progressed, Mr. Miller pulled out specific pieces of the programming to show how the game worked, and removed pieces to demonstrate how the game would work with those pieces missing.
“There’s no ambiguity in the way a computer thinks,” said Mr. Miller. “Once you get that mindset, it’s really pretty straightforward.
Want to go through the walls of the maze? It turns out there is a section of code attached to the green block the user steers. There are a few lines there dedicated just to the walls of the maze, so that if the green block touches something black, it gets returned to the exact place it was before it touched the black a space. Remove that piece of code, and suddenly it’s possible to move through walls.
It turns out that Scratch is much simpler than languages like BASIC and Turbo Pascal. Unlike conventional computer languages, in which users traditionally have to write programs line by line, there is very little typing involved in Scratch.
To write a program like Mr. Miller’s game, the user simply locates the appropriate snippet of prewritten code, drags it into a work area, and adds it to the appropriate place in the program. The snippets appear on building blocks color-coded to their function, and snap themselves into place so that debugging becomes easier when it is needed. And rather than relying on technical language, the snippets are written in more or less plain English, although some commands do require a little familiarity with graphing.
The Hour of Code is a free service that Linx8 Computer Repair and IT Services schedules for weekends. The business provides other services for customers, such as removing viruses from infected computers and repairing damaged machines. It also provides information technology support services for small businesses in the area. For walk-in customers coming in off Raritan Avenue, Linx 8 sells used and refurbished notebook and desktop computers from a variety of makers, both Apple and Windows-based. It also sells a variety of computer components and other electronics.
At 12 years old, Nate Roslewicz of Highland Park was not only the youngest of the programmers to attend the Hour of Code, but also the most successful. While Mr. Miller walked other attendees through the ways and means of Scratch, Nate built his own program from the ground up or from scratch!.
Nate’s program could be described best as a short comic or video. It uses principally two pre-supplied images, a cat and an apple. As the program runs, the cat approaches an apple. When it reaches it, the words “It’s poison!” appear. The apple vanishes, the cat having eaten it; and a moment later, the cat disappears in a swirl.
“I thought it was pretty easy to use,” Nate said of Scratch. He has plans to learn other, more advanced programming languages. “You just have to think, ‘If this happens, what happens then?’”
“I liked it, in terms of just introducing the basic code concepts, in terms of wrapping your head around code,” said Nate’s father, Rob Roslewicz of Highland Park. “I’d like to bring my daughter to try.”
Despite the low attendance on Saturday, Linx 8 plans to schedule more Hour of Code sessions in the near future. Dates will be announced on the business web site, www.linx8.com, and reservation forms will be available online and in person at the business.