BFOIT - Introduction to Computer Programming

Table of Contents

Background

Preface
1.

What's Computer Programming?

Introduction

Programming Using the English Language

Programming Using A Blocks Environment

Programming Languages - High-Level Languages

Programming Languages - Assembler Language

Inside Computers - Bits and Pieces

Numeric Representation With Bits

Symbols as Bits - ASCII Characters

Check Your Understanding So Far

Pixels

Programming Languages - The Microprocessor's Language

Debugging

Who was the first computer programmer?

Summary

Exercises

Additional Reading

Logo Programming

2.

Commanding a Turtle

Introduction

An Overview of Logo and Turtle Graphics

The Graphics Canvas - TurtleSpace

Four Basic Commands

Exploration: Additional Commands

Practice: Draw Some Figures

Help at Your Fingertips

Running TG as an Application

Summary

Exercises

3.

Pseudocode

Introduction

How To Write Non-Trivial Programs

Using TG's Editor

Throttling Graphics Aids Debugging

Practice: More Divided Boxes

Practice: Draw a House

Summary

Things to Think About

4.

Adding New Commands

Introduction

Procedural Abstraction

Practice: Draw a Word

Introducing "TO"

"TO" in Detail

Practice: Define a Procedure Yourself

Problem Solving: Errors in Procedure Definitions

Practice: Define Procedures for Other Letters

Symmetry, Generalization, and Black Boxes

Practice: Complete Your Own Word Program

Tracing the Steps Of Your Program

Logo Animation - Procedures in Action

Practice: Rewrite DrawHouse

Investigation

5.

Iteration and Animation

Introduction

Drawing a Circle, Step by Step, Point by Point

Walking in a Circle

Summary of Drawing a Circle

Iteration, aka Repeating Something

Logo Interpreter Animation - Watching Iteration

Nested REPEAT

Simple Animation - Movement On the Graphics Canvas

Practice: Additional Projects

Summary

6.

Hierarchical Structure

Introduction

Hierarchical Structure - Why It's Important

Drawing a Street of Houses

Practice: Islamic Art

Practice: Another Islamic Art Project

Summary

7.

Procedure Inputs

Introduction

Similar, But Different, Boxes

Similar Procedures

Defining a Procedure With an Input

Multiple Inputs

Logo Animation - Watching Inputs in Action

Practice: Cartesian Axes

Practice: drawRect and fillRect

Projects: Pick One

Summary

8.

Operators & Expressions

Introduction

Operators

Expressions - Operator Combinations

Practice: Expressions And Plumbing Diagrams

An Improved fillRect Procedure

Project: Lots of Boxes

BUG: ?Partial Boxes at Top, Right, and Left?

Practice: Boxes Changes/Extensions

Project: A Street of Different Houses

Summary

9.

Defining Operators

Introduction

Symbolic Constants

Creating Your Own Operators

Practice: A Couple More Operators For You To Write

Practice: Random In Range

TRACE - A Debugging Tool

Project: A Grid Toolkit

Summary

10.

Words and Sentences

Introduction

Lists of Words - Sentences

Symbolic Values - Words

Sentences Can Be Used to Represent Compound Data

WORD and SENTENCE Operators

WORD and SENTENCE Expressions

SETPOS: Moving to a Point in TurtleSpace

Project: More Grid Expressions

Drawing Text on the Graphics Canvas

Revisiting Characters As Numbers

Practice: Random Words in Random Spots

One More Grid Toolkit Extension

Practice: Simple Grid Extension

Summary

11.

User Interface Events

Introduction

The User Interface

Responding to a mouseClicked Event

mouseClicked - Three Flavors

Following mouseMoved Events

(MOUSEX,MOUSEY) Where the Mouse Is

Responding to keyPressed Events

Projects

Yet Another Grid Extension

Practice: GridToolkit Paint Program

Summary

Procedures Introduced in This Lesson

12.

What If? (Predicates)

Introduction

Boolean Values

Predicates - Operators Which Output Boolean Values

IF - Maybe Execute a List of Instructions

Grid Toolkit Paint Program Bug

Project: Moving the Turtle Around the Grid

Additional Boolean Operators

Project: MousedQuadrants

Project: A User Interface

Summary

13.

Recursion

Introduction

Drawing a Squiral

Recursion

Project: Drawing a Tree

The von Koch Curve and Snowflake

Sierpinski Triangle

Advanced REPEAT

Project: Graphing Equations

Summary

14.

Local Variables

Introduction

Local Variables - What Are They?

Project: A Simple Drawing Program

Project: String Art

The State of the Turtle

Project: More Realistic Looking Trees

Summary

15.

Global Variables

Introduction

Global Variables

Use of Global Variables as Symbolic Constants

Project: A Four-Function Calculator

A Four-Function Calculator: How It Works

A Four-Function Calculator: Program Design

A Four-Function Calculator: Program Structure

Read the Code You've Been Given

A Four-Function Calculator: Display Current Number

A Four-Function Calculator: Mouseclick on a Number Key

A Four-Function Calculator: The Operation Keys

A Four-Function Calculator: Mary Math, the Computer

A Four-Function Calculator: Bugs

Practice: Some Extensions You Can Make

Summary

16.

Word/Sentence Iteration

Introduction

Accessing Parts of Words and Sentences

Word/Sentence Iteration:
Print Pieces of Words and Sentences

Practice: Program Generated Stories

Building a Collection and Then Examining It

Practice: Acronym Operator

The Hangman Game

Summary

17.

Mastermind Project

Introduction

An Assignment - Write the Game: Mastermind

How to Proceed

Virtual Mentor - FAQs

Edge Conditions

Summary

18.

Turtles As Actors

Introduction

Demonstration: A Falling Ball

Multiple Turtles

A Falling Ball With Multiple Turtles

Exercise: Turtles Acting as Eyes

Exercise: Racquetball

Project: Frogger

Project: SpaceWar

Animate a Projectile

Responding to Keyboard Events - the keyPressed Procedure

Combining keyPressed Events and Animation

The Turtle Can Only Do One Thing at a Time

Exercise:

Communicating Between Turtles

The Target

Hitting the Target

A Detailed Look at my Version of the Program

A Detailed Look at Detecting a Hit

Getting More Than One Shot: Multiple Projectiles

Exercises

Summary

19.

Arrays

Introduction

TurtleSpace Pixels

Representing Lots of Pixels in a Program

Accessing Graphics Canvas Pixels

Changing Graphics Canvas Pixels

More Pixels

The Game of Life

Other Procedures for Working With Arrays

Summary

20.

File Input/Output

Introduction

File Input/Output Procedures

Summary

Java Programming

21.

A Java Program

Introduction

Why Java?

What is a Java Program and How do I Create One?

A Java Application, Our First!

Tips

22.

What's a Class?

Introduction

If Java programs are built from things called classes, what is a class?

A class Consists of...

Java Keywords

The Special Method: public static void main(String[ ] args)

Summary

Exercises

23.

Extending Existing Classes

Introduction

Specialization Comes to Programming

Inheritance in Object-Oriented Programming

Using "extends" to Create a Window-based Application

Instantiation - Turning a class into an object

Invoking a Method

Learning About What's Available and How to Use It

Summary

24.

Types

Introduction

Why Have Strict Typing in a Programming Language

A Sampling of Commonly Used Types

int and String Literals

Arguments and Parameters

The Syntax of Method Declarations

Invoking Methods, Given Method-Header Information

Summary

Exercises

25.

Turtle Graphics

Introduction

Turtle Graphics in a Java Program

Cross.java

Additional Example Programs

26.

Control Flow

Introduction

Java's for Statement

27.

User Interface Events

Mouse and Key Events

Appendices

A.

Jargon

B.

What Is TG?

C.

TG Directives

D.

jLogo Primitives

Introduction

Data Manipulation

Flow-Control Procedures

Graphics Procedures

Logical Procedures

Math Procedures

Multi-Threading Support

Predicates

User-Interface Procedures

Variables

E.

TG Editor

Introduction

WinEdit Mode Editor Commands

Emacs Editor Commands

F.

Java Tables

G.

Example Programs

H.

Installation Notes

My Experience

You Need Java

Obtaining the TG Programming Environment (TG.jar)

How To Start TG

Media Files

Current Working Directory

Java Turtle Graphics Source Code

TG Updates

-

December 13, 2008

Procedure Invocations Before Their Definitions

jLogo in a Webpage

Background and Turtle Images

READWORD and READLIST

-

January 6, 2012

Introduction

Improved Help

New Graphics Pixel Stuff

Procedures With a Variable Number of Inputs

Bit Twiddling

Audio Support

Turtle-to-Turtle Interaction

Finally...

-

March 15, 2013

Introduction

Multi-line Commands

LABEL Enhancements

Three Flavors of mouseClicked and mouseMoved

Directive Additions/Changes

New Value: null

Finally...

-

January 20, 2014

Introduction

New Pen Colors

Editing Modes

Editor Coloring

CommandCenter Enhancements

New Directives

Command and Operator Enhancements

Finally...

-

February 13, 2014

Introduction

New Turtle Graphics Functionality

Keyboard and Mouse Input

Example Programs

Finally

-

July 29, 2014

Introduction

Support for .gif, .jpg, and .png Image Files

SAVEPICTURE Command

THROTTLE Command

Finally...

-

January 18, 2016

Introduction

Symbolic Operators

Infix Operators

New Commands

New Operators

Finally...

-

January 29, 2016

Introduction

Additional Turtle Graphics Functionality

Error Reporting

Graphics Performance

Finally

Lastly

- Acknowledgements
- About Me

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.