CSE131: Introduction

Copyright © 1996-2005, Kenneth J. Goldman

This course is called Computer Science I, but we won't be doing science. We won't be constructing theories or doing experiments. Also, we won't be spending significant time on how computers work!

Someone once said that naming this discipline Computer Science is like calling carpentry "Hammer Science." We use computers as tools, and the tools are important, but the discipline is not only about the tools themselves.

So, if CSE131 is not really science and it's not really about computers, then what is this course about?

This course is about

Solving computational problems through abstraction and decomposition.
What does this mean? Let's pick it apart...

Process and Procedure

For our purposes, we define:
PROCESS
any activity

COMPUTATION
a process that takes place inside a computer
To solve computational problems, we need to describe processes to be carried out by a computer.
PROCEDURE
a step-by-step description of a process
Some examples from real life:

some processes -- the activity of making a cake or filing a tax return or walking to my house
some procedures -- recipe or filing instructions or walking directions

Abstraction

When people describe activities, though, they don't like to keep every single detail in their heads. For example, if you asked me for walking directions to my house, you would be annoyed if I began, "first, uncross your legs and get out of your chair. Then, put your right foot in front of your left..."

We like to hide the details, not because they are unimportant, but because they are not "interesting." If we had to keep all the details in our heads, we could never get anything done.

ABSTRACTION
a mechanism for hiding detail

In this course, we'll see many forms of abstraction for hiding different kinds of detail. Abstraction is extremely important for building any kind of complex system, because without it the problem becomes overwhelming and unmanageable. Also, abstraction to allows us to model the world (real or imagined). We often like to represent physical or virtual reality inside the computer in order to simulate events, make predictions, or just store and retrieve information. We do this by creating an abstraction of real world, retaining only the relevant information and ignoring other details. For example, in a database of people, the people aren't really in the computer, but there's a collection of attributes that describe them. Which attributes we choose to represent depends upon the problem to be solved. Making this choice is an important part of the design of our solution.

Decomposition

It's also important not to solve the whole problem at once.
DECOMPOSITION
breaking down a problem (or system) into smaller sub-problems (or components)
Decomposition involves finding structure in the problem and determining how the various components will fit together in the final solution. Doing decomposition well makes it easier to modify the solution later by changing individual components, and also enables the reuse of components in solutions to other problems.

Software Systems

To reiterate, this course is about

Solving computational problems through abstraction and decomposition.

Our solutions will be software systems consisting of collections of communicating components. The components will be implemented using various forms of abstraction to hide detail, and will work together to carry out the desired computation.

The processes to be carried out to and the components that embodies them will be described as computer programs written in some language.

Syntax and Semantics

Every language has:
SYNTAX
the notation used to write things
SEMANTICS
the meaning of what is written
EXAMPLES

Elements of Programming Languages

The languages we use to describe processes that take place inside a computer are called PROGRAMMING LANGUAGES.

We want programming languages to support writing programs that are

Designing programming languages is an ART (not a science) and using them is also an art. We strive for elegance & simplicity in the way we describe software systems.

According to Abelson and Sussman, in The Structure and Interpretation of Computer Programs, a good programming language must have the following four elements. Some examples of each one are given.

PRIMITIVES (built-in things)
PRIMITIVE DATA (like numbers)
PRIMITIVE PROCEDURES (like addition)
MEANS OF COMBINATION
EXPRESSIONS (putting together values)
COMPOSITION (putting together objects or procedures)
CONTAINMENT (putting objects inside of other objects)
MEANS OF ABSTRACTION
NAMING
PROCEDURAL ABSTRACTION
DATA ABSTRACTION
MEANS OF CAPTURING COMMON PATTERNS
CREATION OF TYPES OF OBJECTS
INHERITANCE (creating object types similar to others)
DESIGN PATTERNS AND FRAMEWORKS (ways of putting objects together)

Java and Object-Oriented Programming

The programming language we will use in this course is called Java. Java is object-oriented, meaning that we structure our software systems as a collection of communicating objects. To accomplish this, we first define classes that describe the types of objects we want. Then we instantiate objects of those classes and put them together in various ways.

You can think of each object as modeling some real world or abstract thing. Each object has:

INTERNAL REPRESENTATION
the information kept inside the object
METHODS
the things the object can do

For example, a telephone book object might have a list of names and phone numbers as its internal representation. One of its methods might be to look up the phone number for a name you provide.

Most of this introduction may seem kind of vague right now, but it is a useful overview to keep in mind as we proceed through the course. Don't worry. Things will become clearer as we go. In your first programming assignment in CS101, you will define one simple class with some simple methods. Then we will build up gradually to solve more complex problems using abstraction and decomposition. Sometimes, we will provide you with objects (to create graphics, for example) that you will incorporate into your own programs.

Now, let's start from the beginning...