Clip Art Programming Basics
Pierce Home
Computer Science 555 Website Development using JavaScript and AJAX - 3 Units
Section:
3179
Instructor:
Brad Gilbert
Pierce Mailbox:
612
Email:
pierce@wavethunder.com
Wednesday Office Hours:
5:00 -   5:40 PM COSC 1507
Wednesday Lab:
5:45 -   7:50 PM COSC 1507
Wednesday Lecture:
7:55 - 10:00 PM MATH 1511
Other classes:
CS-575
programming basics
Question:

What is a program?

Answer:

A computer program is a set of instructions that manipulate hardware, such as a monitor, printer, and storage device. Computer programs can perform calculations, collect information from various sources, including computer users and the Internet, draw pictures and play sounds - just to name a few activities.

Question:

What do I need to write a program?

Answer:

All you need is a text editor, and knowledge of the rules of syntax for the programming language you choose.

Question:

What is syntax?

Answer:

Syntax means rules of grammar and spelling you must follow, so that the computer will understand your instructions, in much the same way rules of grammar help humans understand each other.

Question:

Is there a standard process for writing a program?

Answer:

Wikipedia offers 2 excellent pages about the software development process:

  1. Software development process defines 5 phases
    1. Requirements Analysis
    2. Specification
    3. Architecture
    4. Design, Implementation, and Testing
    5. Deployment and Maintenance
    as well as several development models.
  2. Systems Development Life Cycle defines 6 phases
    1. Initiation/Planning
    2. Requirements Gatherings and Analysis
    3. Design
    4. Build or Coding
    5. Testing
    6. Operations and Maintenance
    as well as several other SDLC topics.
Question:

How do I write a program to accomplish the things I need?

Answer:

All programs share some basic features:

  • Variables to manipulate data
  • Decisions to direct the flow of the program
  • Arrays to store collections of similar data
  • Loops to repeat instructions
  • Functions to organize instructions
  • Comments to explain the source code to the programmer
Question:

What are variables?

Answer:

Variables are locations in memory whose data can be changed by your program. For example, you may have a variable to store a person's age. As different people use your program, the value of that variable will change.

Question:

What are decisions?

Answer:

Decisions ask questions about the value or data of variables, and the answers determine what code will be executed next, just like decisions are used to turn left or right when walking to school. Because the values of variables can be different, certain criteria can be applied to determine how a program should proceed. For example, if your program asks a user for a favorite color, your program might decide to change the background color of a form from red to blue, based on the user response.

Question:

What are arrays?

Answer:

Arrays are groups of variables that store similar data. For example, a teacher might have an array of 20 variables to store grades for each of 20 students for a midterm. The teacher might have another array to store final exam grades.

Question:

What are loops?

Answer:

Loops repeat the same instructions over and over again, until instructed to stop. For example, instead of writing separate code to write 20 grades to an array of variables, a loop can repeat the exact same lines of code 20 times, updating necessary variables so each student receives the proper grade. For more information, please see the Loops page in the Class Links section.

Question:

What are functions?

Answer:

Functions are blocks of code that perform a collection of similar actions. They are a way for programmers to organize their code. For example, a function might perform page-initialization duties. One function might calculate student grades while another function displays those grades.

Basically, all code is written inside functions. Statements inside functions can call other functions to perform a set of instructions, and return their results. For more information, please see the Functions page in the Class Links section.

Question:

What are comments?

Answer:

Comments are text that the computer ignores. Comments help explain statements in the source code that may otherwise be difficult to understand. Especially, comments explain why a block of code does what it does, or what a particular variable represents.

Question:

I've heard of "Object Oriented Programming", what is that?

Answer:

OOP (Object Oriented Programming) is a source code design concept that defines an object, and places all code pertaining to that object inside a container, often called a "class". Basically, it is like a group of related functions on steroids, all in one place.

The above paragraph on functions describes 2 examples: one to calculate student grades, and another to display those grades. An object would place both functions, as well as any other code needed to manage student grades, inside a single container. Then simply put, I would just need to declare a variable for a student, associate that variable with a particular student and send it to my student object/class and let it do all of the work of going to the database and collecting all of her grades and attendance, calculating the total, and displaying that information.

Brad Gilbert · Fall 2011
Computer Science · Pierce College · Woodland Hills CA · 818-719-6401