BFOIT - Introduction to Computer Programming

New TG Features - BFOIT Saturday - March 7, 2009

In this month's lesson I am going to start with a overview of what BFOIT's Introduction to Programming curriculum attempts to do.  For students that have attended at least one summer institute, we will discuss how programming relates to what you already knew before writing programs and the way you thought about stuff afterwards.  I'm going to give examples of program design and debugging, the process.

If we finish early, I will go over some current hot topics in high tech, e.g., Cloud Computing, multi-core processors, and... just ask. This will also be an interactive exercise.

ItP Concept Map

Figure 1

Program Design: HexRGBColor

jLogo supports 24-bit color. SETPENCOLOR's input has 16 commonly used colors assigned to numbers zero through fifteen. If the numeric value is greater than fifteen it is assumed to be a 24-bit RGB color (see the Color Numbers Applet; play with it a bit).

I want to write a couple of procedures that set the pen's color to a specified RGB color in a more friendly manner. Here's what I want:

    ; set pen's color to specified red, green, and blue values
    to setRGBPenColor :red :green :blue

    ; set pen's color to one specified as a word like the ones in
    ; HTML source, consisting of six Hex digits, e.g., "87CEEB
    to setHexPenColor :hexColorNum

So here's what's known:

  • The red, green, and blue values should be 8-bit numbers, so they should have values in the range of 0 to 255 inclusive.
  • Red, green, and blue values each take up 8 bits. This means that the red value must be multiplied by 2 to the 16th (65,536) and the green value must be multiplied by 2 to the 8th (256) before all three color values are added together.
  • The hex word is composed of characters that need to be converted to values of 0 to 15 inclusive. These values (4-bits each) are combined to form the 24-bit value expected by SETPENCOLOR.
  • Table 1.2 in the ItP lessons shows the values of characters as numbers. The ASCII operator can be used to convert a character into its numeric value.

As a group, we'll now use Hierarchical Design and Procedural Abstraction to write a program consisting of

  • the desired procedures,
  • lower-level support procedures, and
  • some support stuff which will help us test our procedures.

Cloud Computing

Cloud Computing is a mechanism for letting users of software run their programs anytime, anywhere and on a wide variety of devices.  In my opinion, it's not all that new; it's just an iteration of a concept we called timeshared computer services in the late sixties and the seventies.  Cloud Computing is access to software and computing resources in a manner similar to other utilities, e.g., cable TV sevice, electric service, telephone service, etc...

So, it's back in vogue and a lot more beautiful now that

  • computers are thousands of times faster,
  • are pretty much based on open standards or the Micro$oft monopoly,
  • the systems can store a lot more stuff,
  • lots of stuff that was only available in an analog form is now digital,
  • access times and bandwidth between computers and devices is tens of thousands or hundreds of thousands times better, and, finally,
  • access is not even dependent on wires.

I found a YouTube video that gives a good overview of Cloud Computing is here.

The video is part of a webpage about Cloud Computing located here, which is part of an online textbook: by author Christopher Barnatt.

Multi-core Processors

When physics got in the way of improving performance by increasing a microprocessor's clock speed, their manufacturers moved to multiple cores per chip.

Wikipedia Multi-core (explanation)

Further Reading:

  1. How to Solve It - A New Aspect of Mathematical Method, second edition, G. Polya, Princeton University Press, 1957.

Public Domain Mark
This work (BFOIT: Introduction to Computer Programming, by Guy M. Haas),
identified by Berkeley Foundation for Opportunities in IT (BFOIT),
is free of known copyright restrictions.