Transcript Chapter 1

An Introduction to
Programming and
Object-Oriented
Design Using Java
By Jaime Niño and Fred Hosch
Slides by Darwin Baines and
Robert Burton
Chapter 1
Introduction
This chapter discusses




Computing as a science.
Analysis of large software systems.
Fundamental hardware and
software concepts.
Basic notions necessary to survive.
What is Computer
Science?
Computer science is a science of abstraction –

creating the right model for a problem and
devising the appropriate mechanizable technique
to solve it.
– A. Aho and J. Ullman



Not the “science of computers.”
Many concepts were framed and studied
before the electronic computer.
To the mathematicians and logicians of
the ‘20’s and ‘30’s, a computer was a
person with pencil and paper.
The Science of
Computing




Automated problem solving.
Automated systems that produce
solutions.
Methods to develop solution
strategies for these systems.
Application areas for automatic
problem solving.
Foundations of
computing

Fundamental mathematical and
logical structures for
 Understanding
computing.
 Analyzing and verifying the
correctness of software and
hardware.
Systems definitions



computer architecture:
organization and structure of
hardware.
operating systems: fundamental
resource management software.
distributed systems:connecting
computers together in order to
share resources and information
(networking).
Applications

There are numerous applications
of computer science.
 Artificial
intelligence
 Data base management
 Computer graphics
 Etc.
Methods


Design and assessment of
techniques and software tools for
creating automated problem
solutions.
programming language: a
precise, formal notation for
expressing and analyzing a
natural, correct, efficient program
solution.
Methods (cont.)

software engineering: the study
of methods for producing and
evaluating software. This is the
primary topic of the course.
What is a Software
System?



Sometimes called a program or
application.
A temporary solution to a changing
problem.
2 major attributes inherent in
Software Systems:
 dynamics
 complexity
Dealing with complexity:
Composition



composite structure: a software
system composed of manageable
pieces.
The smaller the component, the
easier it is to build and understand.
The more parts, the more possible
interactions there are between
parts and the more complex the
resulting structure.
Dealing with complexity:
Composition (cont.)


Balance between simplicity and
interaction minimization.
Example: An audio system is easy
to manage because each
component has a carefully
specified function and the
components are easily integrated
i.e. The speakers are easily
connected to the amplifier.
Counterexample

The function of a “Rube Goldberg”
device is not obvious, modification
is almost unthinkable, the parts
lack an intrinsic relationship to the
problem the device solves, and the
complexity is high.
Dealing with complexity:
Abstraction





Dealing with system components and
their interactions without worrying about
specific details.
Not “vague” or “imprecise.”
Limitation of view to a few properties.
Elimination of the irrelevant and
amplification of the essential.
Capturing commonality between different
things.
Two aspects of a
system:


data: the information the program
deals with.
functionality: what the program
does with the data.
Systems:Data



data descriptions: the type of
data to be stored; fixed for a
program.
data values: actual values stored
for each descriptor. Variable each
time the program is run.
Example:
Descriptor: Name Value:John
Systems: Functionality



computation: Performance of
some sequence of goal-directed
actions with a set of data values.
processor: Whatever performs the
actions.
algorithm: A set of instructions
describing a pattern of behavior
guaranteed to achieve some goal.
Components of a
computation
Object-oriented systems



Composite, modular constructions, built
using abstraction, consisting of
components, and organized around the
data.
model: an abstraction of a real-world
problem that can be represented and
manipulated with a computing system.
software system: a collection of
abstractions that work together to solve
problems.
Object-oriented systems
(cont.)



These abstractions are called
objects.
Each object has its own
properties and functionality.
Reusable components are the
key to the efficient production of
reliable systems.
Computer system





Input/Output:communication with the
outside world.
processor: performs computation using
the instruction set.
memory: stores the data and algorithms
the system is using, i.e. RAM.
file system: stores data and algorithms
not currently being used. i.e. disks.
network: several connected computers
and other devices.
Simple model of a
computer system
Memory


Data encoding schemes: letters, digits,
punctuation marks, etc. often are
encoded as 8-bit sequences.
 “A” might be represented as
01000001.
Memory is divided into fixed size
locations, each with a unique address.
 Data and instructions are accessed
using their addresses and by knowing
their sizes.
Successive snapshots
of a machine
Software tools



operating system: fundamental
hardware-resource management
software.
programming language: the formal
expression of data descriptions and
algorithms.
text editor: the means provided for us to
write and edit programs.
Software tools (cont.)


compiler: a program that translates
programs written in a specific
programming language into a a more
machine-like language.
interpreter: software that reads and
executes a machine-independent
intermediate language (called “bytecode” in the case of Java).
Operating system


MS-DOS, Windows NT, Solaris,
etc.
Performs functions such as verifying
user names and passwords, deciding
where in memory a program will be
loaded, loading programs from disk, etc.
Programming languages




Java, C++, Pascal, etc.
syntax: the set of grammatical and
punctuation rules for the language.
semantics: the set of rules that
specify the meaning of
syntactically legal constructs.
Each legal construct has exactly
one meaning.
Errors in the
programming process



error: a mistake made in the
design, programming, or use of a
system.
failure: inability of the system to
perform its intended function.
Errors cause failures.
Errors in the
programming process
(cont.)


Computer systems fail because of
 conceptual errors
 data errors
 hardware failures
 software errors
Conceptual errors:
misunderstanding of the system.
Errors in the
programming process
(cont.)


data errors: incorrect data.
software errors:
 Syntactic errors: writing something
that the programming language
doesn’t understand. They are found
during compilation.
 Logical errors: syntactically correct
but not programmed logically (“wok
your dog”)
We’ve covered




Large systems are complex and change
over time.
To address this, we build systems that are
modular, with composite construction, and
make extensive use of abstraction.
We also covered, a conceptual model of
the supporting hardware system;
And a basic understanding of the purpose
of fundamental software such as operating
systems, compilers, and interpreters.
Glossary
Glossary (cont.)
Glossary (cont.)
Glossary (cont.)
Glossary (cont.)
Glossary (cont.)