Computer Programming

Introduction to Programming | Coding is a Superpower! | Introduction to Greenfoot | Exam reference Sheet | Review

Introduction to Programming

Computers are everywhere. They are in our pockets and on our wrists. They are on our walls. They are in our cars. They are a critical piece of our infrastructure, from power grids to traffic lights to the inner workings of our financial markets. And all of these computers have one thing in common. They depend on software to tell them what to do.

Manchester Baby

Manchester Baby is world's first stored program computer. Approximately 70 years ago, the Manchester Small Scale Experimental Machine, nicknamed "Baby", became the earliest computer in the world to run a program electronically stored in its memory. This was a flagship moment: the first implementation of the stored program concept that underpins modern computing.

Earlier computers had their instructions hardwired into their physical design or held externally on punched paper tape or cards. Reprogramming them to do a different task entailed internal rewiring or altering the physical storage media. The Baby marked a new computing era, described by some as the "birth of software," in which swapping programs was far simpler-requiring only an update to the electronic memory. Both instructions and data were held in the Baby's memory and the contents could be altered automatically at electronic speeds during the course of computation.

The Software Development Cycle

The software development cycle, also referred to as the application development life-cycle, is a series of steps programmers use to build computer programs. It is used in systems engineering, information systems and software engineering to describe a process for planning, creating, testing, and deploying an information system. The creation of software involves six basic activities:

software development modelThe software development models are the various processes or methodologies that are being selected for the development of the project depending on the project's aims and goals. There are many development life cycle models that have been developed in order to achieve different required objectives. The models specify the various stages of the process and the order in which they are carried out.

The selection of a model has a very high impact on the testing that is carried out. It will define the what, where and when of our planned testing, influence regression testing and largely determines which test techniques to use.

There are various Software development models or methodologies. They are as follows:

  1. Waterfall model
  2. V model
  3. Incremental model
  4. RAD model
  5. Agile model
  6. Iterative model
  7. Spiral model
  8. Prototype model

Choosing the right model for developing of the software product or application is very important. Based on the model, the development and testing processes are carried out.

Assignment: Software Development Models or Methodologies discussion board

Directions: Select one of the eight software development models or methodologies and describe how the model works. Then read posts by other classmates until you are familiar with all eight models. Your description should be approximately 100 words. Please spellcheck before posting.

Examples of the Importance of Good Upfront Design

"Just as a builder doesn't build a house before designing it, a programmer should not write a program without designing it first. Too often, programmers rush to the keyboard without thinking through the logic. A badly designed program results in lots of bugs and maintenance" (G. Perry). The development process is much more involved that this, but these are a few basic development activities

1940 Tacoma Narrows Bridge

Slender, elegant and graceful, the Tacoma Narrows Bridge stretched like a steel ribbon across Puget Sound in 1940. The third longest suspension span in the world opened on July 1st. Only four months later, the great span's short life ended in disaster. "Galloping Gertie," collapsed in a windstorm on November 7, 1940.

The bridge became famous as "the most dramatic failure in bridge engineering history." Now, it's also "one of the world's largest man-made reefs." The sunken remains of Galloping Gertie were placed on the National Register of Historic Places in 1992 to protect her from salvagers.

When Galloping Gertie splashed into Puget Sound, it created ripple effects across the nation and around the world. The event changed forever how engineers design suspension bridges. Gertie's failure led to the safer suspension spans we use today.

Like suspension bridges, computer software must also have good upfront design. Without good design, the resulting software will be full of bugs and doom for failure.

Ariane 5 Rocket Launch

What does the Ariane 5 rocket launch explosion have to do with computer programming? The answer might just surprise you. Watch the video on the Ariane 5 rocket launch.

"One bug, one crash. Of all the careless lines of code recorded in the annals of computer science, this one may stand as the most devastatingly efficient. From interviews with rocketry experts and an analysis prepared for the space agency, a clear path from an arithmetic error to total destruction emerges." Read James Gleick's article A Bug and a Crash: Sometimes a Bug is More Than a Nuisance to learn how a single run-time error brought the giant rocket to the ground.

"There is no life today without software," says Frank Lanza, an executive vice president of the American rocket maker Lockheed Martin. "The world would probably just collapse." Fortunately, he points out, really important software has a reliability of 99.9999999 percent. At least, until it doesn't. The ultimate problems with the launch of the Ariane 5 rocket was a run-time error in the computer software.

Assignment: The Risk Digest Current Event

Directions: Visit the Risk Digest: Forum On Risks To The Public In Computers and Related Systems and read a couple of articles compiled by Peter Neurmann associated with public risk related to computers. Begin reading with the latest edition. Select one article, summarize the article (~150 words) and paste your summary directly to the itsLearning textbox. Do not attach a separate document. Be sure to run spellcheck before submitting your summary. You must cite your source using appropriate MLA or APA style citation.

Coding is a Superpower!

Model and entrepreneur Karlie Kloss shares more about her own interest in learning to code, and why you should give it at least one hour.

Computer programming (often shortened to just programming) is a process that leads from an original formulation of a computing problem to executable programs. Computer programming involves activities such as:

Computer program solves problems that include verification of requirements of the algorithm including its correctness and its resource consumption, implementation of the algorithm in a target programming language, testing, debugging, and maintaining the source code, implementation of the build system and management of derived artifacts such as machine code of computer programs.

The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solve a given problem.

According to a growing number of experts, learning computer science will not only pave the way for future employment prospects - job growth in this sector is booming - but help to accelerate the United States economic recovery.

softwareCode is the foundation of computing. Whether you are using a social media app on your smartphone or working with a cloud server's API, the task relies heavily on a programming language. Ada Lovelace is recognized as the world's first programmer. She wrote an algorithm for Charles Babbage's Analytical Engine. Lovelace's contributions to computing marked the beginning of a rich history in programming despite the first programming languages predating the modern computer.

The first programming languages designed to communicate instructions to a computer were written in the 1950s but the first actual modern programming language is hard to identify.

There are four groups of programming languages and reflect the historical development of computer languages:

Slide Set created by Shannon Anderson-Rush with GoConqr -- Click on the down arrow located on the bottom right corner to advance the slide presentation

Assignment: Question for Thought 5.1

Directions: Compare and contrast past, current, and trending programming languages from low to high level, used in developing program applications. Your essay should be approximately 250 words and needs to use paragraph headings. You must cite at least two sources using MLA or APA style citations. Be sure to spellcheck your essay before submitting.

Assignment: Ethics in Computer Programming

Directions: Read the short article on The Programming Code of Ethics. While all of the ethics are important, select the one ethic that you think is most important and explain why. Respond to two classmates who chose a different standard and elaborate on their point.

Key Vocabulary Words

Flash Card Deck created by Shannon Anderson-Rush with GoConqr

Introduction to Programming with Greenfoot

Object-Oriented Programming in Java with Games and Simulations

Greenfoot logoGreenfoot is a programming environment that can be used by individuals, in schools, or in introductory university courses to learn and teach the principles of programming. It is flexible enough to be suitable for teenagers as well as older students.

Greenfoot supports the Java Programming Language, so students learn standard object-oriented programming in Java. The environment is designed specifically to convey object-oriented concepts and principles in a clean, easily accessible manner.

The Greenfoot environment makes creation of graphics and interaction easy. Students can concentrate on modifying the application logic, and engage and experiment with objects. Developing simulations and interactive games becomes easy, and feedback is immediate. The environment is designed to quickly engage students who may have no prior interest or experience in programming. Achieving simple animation results is quick, sophisticated, professional looking scenarios are possible.

Assignment: Chapter 1 - Introduction to Greenfoot and Java

Topics: the Greenfoot interface, interacting with objects, invoking methods, running a scenario

Concepts: object, class, method call, parameter, return value

Directions: This chapter will introduce you to the Java programming language and the Greenfoot game and simulation programming environment. You will complete the following assignments for Chapter 1:

  1. Setting up Greenfoot
  2. Read and complete Part1 - Getting to Know Greenfoot (pdf)
  3. Chapter 1 - Part 1 Quiz
  4. Read and complete Part2 - Further Exploration, using Asteroids (pdf)
  5. Chapter 1 vocabulary

We have seen what Greenfoot scenarios can look like and how to interact with them. We have seen how to create objects and how to communicate with these objects by invoking their methods. Some methods were commands to the object, while other methods returned information about the object. Parameters are used to provide additional information to methods, while return values pass information back to the caller.

Objects were created from their classes, and source code controls the definition of the class (and with this, the behavior and characteristics of all the class's objects).

We have seen that we can change the source code using an editor. After editing the source, classes need to be recompiled.

Assignment: Chapter 2 - Little Crab Game

Topics: writing code: movement, turning, reacting to the screen edges

Concepts: source code, method call, parameter, sequence, if-statement

Directions: You will complete the following assignments for Chapter 2 (Little Crab Game):

  1. Read and complete Part1 - Little Crab, Getting Started (pdf)
  2. Read and complete Part2 - Little Crab, Edge Detection, if-Statement (pdf)
  3. Complete Greenfoot - Chapter 2 Quiz
  4. Complete - Chapter 2 Video & Report

Bill Gates introduces IF & IF/ELSE Statements

We have seen how to call methods (such as move()), with and without parameters. This will form the basis for all further Java programming. We have also learnt to identify the body of the act method-this is where we start writing our instructions.

You have encountered some error messages. This will continue throughout all your programming endeavors. We all make mistakes, and we all encounter error messages. This is not a sign of a bad programmer-it is a normal part of programming.

We have encountered a first glimpse of inheritance: Classes inherit the methods from their super classes. The Documentation view of a class gives us a summary of the methods available. And, very importantly, we have seen how to make decisions: We have used an if-statement for conditional execution. This went hand in hand with the appearance of the type Boolean, a value that can be true or false.

Assignment: Chapter 3 - Improving the Crab

Topics: random behavior, keyboard control, sound

Concepts: dot notation, random numbers, defining methods, comments

Directions: You will complete the following assignments for Chapter 3 (Little Crab Game):

  1. Read and complete Part3 - Little Crab, Random Behavior (pdf)
  2. Complete Chapter 3 - Part 3 Quiz
  3. Read and complete Part4 - Little Crab, Adding Classes & Methods (pdf)
  4. Complete Chapter 3 - Part 4 Quiz
  5. Read and complete Part5 - Little Crab, Adding an Enemy (pdf)
  6. Read and complete Part6 - Little Crab, Keyboard Control (pdf)
  7. Complete Chapter 3 - Part 6 Quiz
  8. Read and complete Part7 - Little Crab, Adding Sound (pdf)
  9. Complete - Chapter 3 Video & Report
  10. Chapter 2 & 3 Test

Chris Bosh explains Functions

We have seen more examples of using an if-statement-this time for turning at random times and reacting to key presses. We have also seen how to call methods from another class, namely the getRandomNumber, isKeyDown, and playSound methods from the Greenfoot class. We did this by using dot notation, with the class name in front of the dot.

Altogether, we have now seen examples of calling methods from three different places. We can call methods that are defined in the current class itself (called local methods), method that were defined in a superclass (inherited methods), and static methods from other classes. The last of these uses dot notation. (There is one additional version of a method call: calling methods on other objects-we will encounter that a little later.)

Another important aspect that we explored was how to read the API documentation of an existing class to find out what methods it has and how to call them.

Assignment: Chapter 4 - Finishing the Little Crab Game

topics: world initialization, setting images, animating images

concepts: constructors, state, instance variables (fields), assignment, new (creating objects programmatically)

Directions: You will complete the following assignments for Chapter 4 (Little Crab Game):

  1. Read and complete Part8 - Little Crab, Initializing the Game (pdf)
  2. Complete - Chapter 4 Part8 Quiz
  3. Read and complete Part9 - Little Crab, Animation (pdf)
  4. Complete - Chapter 4 Part9 Quiz
  5. Read and complete Part5 - Little Crab, Keeping Score and Extensions (pdf)
  6. Complete - Chapter 4 Video & Report

Mark Zuckerburg teaches REPEAT LOOPS

Chris Bosh explains REPEAT UNTIL

We have seen a number of new programming concepts. We have seen how constructors can be used to initialize objects-constructors are always executed when a new object is created. We have seen how to use instance variables-also called fields-and assignment statements to store information, and how to access that information later. We have used the new statement to programmatically create new objects, and finally, we have seen the full version of the if statement, which includes an else part that is executed when the condition is not true.

Assignment: Internet Game Discussion

Directions: You had an opportunity to create a computer game. Now it's time to analyze a game. Find a free internet game that provides education in one or more fields of study. Explain the game, how it works, and the connection to the world today. Describe the game in your thread and discuss how using this game can help educate people and what they learn, and how the game uses sound, images, color, and motion to engage the player. You must also provide the URL to the game. Read and respond to at least two other posts to learn more about educational internet games.

Assignment: Chapter 5 - Making Music: An On-Screen Piano

Topics: sound

Concepts: abstraction, loops, arrays, OO structure

Directions: You will complete the following assignments for Chapter 5 (Making Music: An On-Screen Piano):

  1. Read and complete Part1 - An On-Screen Piano (pdf)
  2. Read and complete Part2 - An On-Screen Piano (pdf)
  3. Read and complete Part3 - An On-Screen Piano (pdf)
  4. Read and complete Part4 - An On-Screen Piano (pdf)
  5. Read and complete Part5 - An On-Screen Piano (pdf)
  6. Read and complete Part6 - An On-Screen Piano (pdf)
  7. Complete - Chapter 5 Video & Report

We have seen two very fundamental and important concepts for more sophisticated programming: loops and arrays. Loops allow us to write code that executes a sequence of statements many times over. The loop construct we have discussed is called a while loop. Java has other loops as well, which we will encounter shortly. We will use loops in many of our programs, so it is essential to understand them. You have also seen great examples of abstraction.

Assignment: Chapter 7 - Asteroids

Topics: more about movement, keyboard control and collision detection

Concepts: collections (again), for loop, for-each loop (again), casting

Directions: You will complete the following assignments for Chapter 7 (Asteroids):

  1. Read and complete Part1 (pdf)
  2. Chapter 7 - Part 1 On-line Assessment
  3. Read and complete Part2 (pdf)
  4. Chapter 7 - Part 2 On-line Assessment
  5. Read and complete Part3 (pdf)
  6. Complete - Chapter 7 Video & Report

Here are some helpful videos for creating explosions:

We have worked on completing an asteroids game that was initially half-written. In doing this, we have encountered several important constructs again that we had seen before, including loops, lists, and collision detection.

We have seen one new style of loop-the for loop-and we have used it to paint the stars, and to generate the proton wave images. We have also revisited the for-each loop when we implemented the proton wave functionality.

Two different collision detection methods were used: getOneIntersectingObject and getObjectsInRange. Both have their advantages in certain situations. The second one of those returned a list of actors to us, so we had to deal with lists again.

Understanding lists and loops is initially quite difficult, but very important in programming, so you should carefully review these aspects of your code if you are not yet comfortable in using them. The more practice you get, the easier it becomes. After using them for a while, you will be surprised that you found them so difficult at first.

CollegeBoard Programming Reference Guide

As AP Computer Science Principles does not designate any particular programming language, a reference guide provides instructions and explanations to help students understand the format and meaning of the questions you will see on the exam. The reference sheet includes two programming formats, text-based and block-based. You need to be familiar with College Board's pseudocode. The reference guide will be available for you to use on the AP test in May.

AP Computer Science Principles Exam Reference Sheet

Assignment: Programming Worksheet with College Board Pseudocode

Directions: Complete the online worksheet in itsLearning. These questions use College Board's pseudocode and can be completed using the College Board AP Computer Science Principles Reference Guide (which will also be available on the AP Test).


Quiz created by sarush with GoConqr


Channel Greenfoot:

Download Greenfoot (free):

Introduction to Programming with Greenfoot by Michael Kolling:

Java Game Programming with Greenfoot Part 1:

Java Game Programming with Greenfoot Part 2:

Greenfoot Tutorial Videos on YouTube:


Software picture:

We've Come a Long Way Baby:

Beginning Programming: Designing a Program. G. Perry (2002).