- CS 102 - Intro to Computer Science
- Problem Solving
- Algorithm Development
- Programming in C++
There is no CS prerequisite and no specific math prerequisite.
Do you know C++? Are you proficient with programming? If so, skip CS 102 and
take CS 140 if your advisor approves. You may not take 102 and 140 together.
- CS 100 vs. CS 102
- 100 is computing (3 hr); 102 is Computer Science (4 hr).
- 100 is about computers with a bit of python programming; 102 is
algorithm development, problem solving, and C++ programming.
- Doubts? Check requirements for your major;
see your advisor; look at both texts.
- Assignment and Labs
- For The next class meeting, look at the Preface,
read Chapter 1, and begin Chapter 2 in the text.
- Labs begin Wednesday, August 27. Please be on time and
bring your UT ID with you.
- Lab materials will be available
in lab at no charge.
- What is Computer Science?
Computer Science is the systematic study
of algorithmic processes that describe and transform
information: their theory, analysis, design, efficiency,
implementation, and application.
The fundamental question underlying all of computing
is: What can efficiently be automated?
Computer Science is MORE than programming. It
incorporates the paradigms of
- theory - mathematical
- abstraction - experimental
- design - engineering
within many topic areas, including:
- algorithms, data structures
- architecture
- artificial intelligence (AI) & robotics
- bioinformatics and systems biology
- computer systems
- computational science
- databases and data mining
- high-performance computing
- human-computer communication
- programming languages
- software engineering
What is a computer? An electronic machine that can
process information according to a set of instructions
(an algorithm).
algorithm - a finite sequence of steps that
solves a problem.
| input --> |
  process   |
--> output |
- Computer Organization
Computers are divided into six units:
- Input unit. Receives data or a computer program from an
input device, such as a keyboard, mouse, etc.
- Output unit. Makes processed information available on an
output device, such as a monitor screen, a printer, a file, etc.
- Memory unit. This primary memory provides rapid-access,
low-capacity storage to store data, processed information, and
programs while they are being executed.
- Arithmetic and logical unit (ALU). Performs calculations
and makes logical (true/false) decisions.
- Central processing unit (CPU). The brains of the
machine coordinates and supervises all other sections.
The CPU contains registers, high speed memory
locations for temporary storage. This is where the control
unit fetches program instructions and where a program is
executed. Systems
with multiple CPUs are called multi-processors and can
perform many operations simultaneously.
- Secondary storage unit. This secondary memory provides
long-term, high-capacity storage. Examples include your hard
drive, CDs, and DVDs.
- Computer Memory
Memory is an ordered sequence of storage locations or memory cells,
each of which has a unique address. In the cetus lab, addresses
are four bytes and are written as eight hexadecimal digits.
- One byte = eight bits (binary digits);
four bytes = a word. A byte is the smallest
addressable unit of memory.
- Individual bits are always off (zero / false) or on (one / true).
- Data storage - setting each bit of a memory
location to 0 or 1. The previous contents are
destroyed.
- Data retrieval - copying the contents of a memory location to
another storage area.
- Data is stored on a hard disk and is organized into files.
A directory is a listing of the files on the disk that are
logically together. A directory is also a file.
- Computer Software - Programs
Software should be reliable and efficient, well-documented and easy
to maintain.
- Program - a set of explicit and finite
instructions, written in a computer language; an
algorithm. Two types of programs are system programs
and application programs.
- Operating System - the collection of programs that controls
the interaction between the user and the hardware; the
interface between the user and the machine. The OS directs all
operations and manages the allocation of resources. The cetus
and hydra machines run Debian Linux.
- Computer Languages
- machine language - binary number codes understood
by a specific CPU
- assembly language - mnemonic codes that
correspond one-to-one with machine language instructions.
- high-level language - machine independent
programming language that combines algebraic expressions
and English symbols. Examples: C, FORTRAN, COBOL, C++,
LISP, Java, Python, Perl, Ada, Prolog.
- Compilers - software to translate a program
written in a high-level language into machine language.
We use g++, from the GNU Compiler Collection, which is
both a compiler and a linker.
- Source file - file containing a program
written in a high-level language; the input to a
compiler.
- Object file - file of machine language
instructions; the output of the compiler. Note: this
is a binary file.
- C++ - an object-oriented programming language with
a set of grammar rules that describes how the elements of the
language are used together (syntax). The meaning
of combinations of elements is the semantics of the language.
- C++ programs are composed of classes and functions.
While you can write each piece yourself, most programmers use the
classes and functions in the C++ Standard Library. This makes
for more consistent and portable code. Additional class libraries
are available for free download or from software vendors.
- C++ uses software objects. Objects are an instance of a
class and are essentially
reusable software components that model real-world items. They have
attributes (how they look) and behaviors (operations or
what they do).
- Object-oriented design allows us to encapsulate or wrap attributes
and operations into objects. These objects have the property of
information hiding, which means that communication between
objects is only through well-defined interfaces. This allows us to
abstract the functionality of an object from the details of its
implementation.
- Execution Cycle
Several systems programs are used to prepare a high-level program for
execution, and there are generally six phases.
- An editor is used to enter a high-level program into a file
to create the source code.
- The preprocessor executes any preprocessor directives in the
source code.
- A compiler translates the source code into machine language, also
called object code.
- The linker links the object code with the libraries and other
object files to create an executable file.
- The loader loads the executable file into memory for execution.
- The CPU executes each instruction and stores the results.
- How to Solve a Problem:   Software Development
Method
- Specify problem requirements:
State the problem clearly; understand what is required.
This is what needs to be done, not how it will
be accomplished.
- Analyze the problem:
Identify the program inputs (data), outputs (results),
and any additional requirements.
- Design the algorithm:
Use top-down design to develop the list of
steps to solve the problem.
Desk check the algorithm to
verify that it works as intended.
- Implement the algorithm:
Convert the algorithm to a programming language.
- Test and verify:
Run the code with many sets of test data using
a bottom-up approach.
Use statistical methods on vital code.
- Maintain and update code:
Modify the program as needed.