Copyright © 2002 W. A. Tucker 1
Chapter 1 Lecture Notes
Bill Tucker
Austin Community College
COSC 1315
Copyright © 2002 W. A. Tucker 2
Programming
• Programming is Problem Solving
• People use programs to “solve problems”
• Designing a program is like “solving a
problem”
• Make a program run properly is also
“solving a problem”
Copyright © 2002 W. A. Tucker 3
My Favorite Phrase
• The computer made a mistake!
• Computers don’t make mistakes unless
they are BROKEN
• People make mistakes
• People write programs
• People write programs that make mistakes
Copyright © 2002 W. A. Tucker 4
Computer Hardware
• The main parts of a computer are
– Memory
• Main memory
– RAM
– Volatile memory
• Secondary memory (secondary storage)
– Files
– Non-Volatile
– Input / Output
– Central Processing Unit
Copyright © 2002 W. A. Tucker 5
Processing Data
• Processing of data occurs within the CPU
– Data must be moved from storage to the CPU for
processing to occur
– The CPU must be told where the data is located
– All data stored in main memory is referenced by a
memory address
– Example: A = B + 12
• Get the contents of memory location 00BE34 (B)
• Add 12 to the value
• Store the value into memory location 00BE38 (A)
Copyright © 2002 W. A. Tucker 6
Computer Software
• Operating Systems manage and control
the resources of a computer
– EX: Windows 98, Windows 2000,
Windows XP, UNIX, Lynix, MAC/OS, etc
– Most operating systems provide a graphical
user interface (except UNIX and Lynix)
• Application Software
– Programs written to perform a specific task
– EX: Office 2000, Office XP, Quicken, etc.
Copyright © 2002 W. A. Tucker 7
Computer Instructions
• Programmers must “tell the computer what
to do”
• The computer will do exactly what the
programmer tells the computer to do,
nothing more and nothing less.
Copyright © 2002 W. A. Tucker 8
Computer Language
• Computers understand only the binary
number system (zeros and ones)
– All data stored in the computer is stored as a
series of zeros and ones
– All instructions telling the computer what to do
are stored as a series of zeros and ones
• People do not naturally think in terms of
zeros and ones (the binary number
system)
Copyright © 2002 W. A. Tucker 9
Programming Languages
• Programming languages allow a programmer to
give the computer instructions in a manner that
the programmer can understand
• Assembly Language is a low level language,
where the programmer uses a mnemonic
(abbreviation) to communicate an instruction to
the computer
– EX: “A” or “add” for addition
• This mnemonic is translated into machine
language (binary) by a program called an
assembler
Copyright © 2002 W. A. Tucker 10
More on Programming Languages
• Assembly language is a one for one mapping to the
machine language and has to be rewritten for each
machine (not all machine languages are the same)
• An Assembler translates assembler code into
machine language that a computer may execute
• High level languages were created to allow
programmers to write at a level where one
programming instruction is converted into several
machine language instructions and to avoid having
to constantly rewrite the program
• A compiler converts high level language into
machine language that a computer may execute
Copyright © 2002 W. A. Tucker 11
Examples of Languages
• High Level Languages
– BASIC, C, COBOL, FORTRAN, PASCAL
• Object Enabled Languages
– C++
• Object Oriented Languages
– Java, C#
Copyright © 2002 W. A. Tucker 12
Development Environment
• Developing a program in a high level
language requires certain tools
– Editor – type in a program and save as a file
(called the source program)
– Compiler – converts source program into
machine language (called the object program)
– Linker – Combines object program with other
programs (include files) to produce
executable code (called the load module)
– Loader – Loads executable code into memory
Copyright © 2002 W. A. Tucker 13
Integrated Development
Environment (IDE)
Editor
Source
File
Compiler
Object
File
Linker
Object
File
.cpp extension
.exe extension
Loader
Syntax
Errors
Linker
Errors
Loader
Errors
Copyright © 2002 W. A. Tucker 14
Software Development Method
1) Specify the problem
2) Analyze the problem
3) Design the algorithm to solve the problem
- Desk Checking
4) Implement the Algorithm
- Coding
5) Test and verify the completed program
- Compiling and Executing
6) Maintain and update the program
Copyright © 2002 W. A. Tucker 15
Structured Programming
• Dividing a larger problem into smaller parts
– AKA: tops-down design, stepwise refinement,
modular programming
– Identify what steps need to be done, usually VERBS
– (ie: calculate, process, get, display, etc)
• Each smaller part is then solved using one of
three types of programming structure
– Sequential structure
– Selection structure
– Repetition (looping) structure
Copyright © 2002 W. A. Tucker 16
Procedural Solutions
• Using structured programming, most
problems can be solved using the
following general procedural steps
– Get the input
– Process the input
– Display (output) the results
Copyright © 2002 W. A. Tucker 17
Object Oriented Programming
• Humans interact with objects every day
– Driving a car
– Purchasing groceries
• OOP involves defining the attributes (data)
and behaviors (operations) of objects
(usually NOUNS)
• Combining these attributes and behaviors
into a class is called encapsulation
Copyright © 2002 W. A. Tucker 18
Advantages of Objects
• Once an object is designed, implemented
and tested everyone can use it
– Improves productivity
– Supports portability or reuse of code
– All of which reduce development time

chapter1lecturenotes sdsdasdddadad(2).ppt

  • 1.
    Copyright © 2002W. A. Tucker 1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315
  • 2.
    Copyright © 2002W. A. Tucker 2 Programming • Programming is Problem Solving • People use programs to “solve problems” • Designing a program is like “solving a problem” • Make a program run properly is also “solving a problem”
  • 3.
    Copyright © 2002W. A. Tucker 3 My Favorite Phrase • The computer made a mistake! • Computers don’t make mistakes unless they are BROKEN • People make mistakes • People write programs • People write programs that make mistakes
  • 4.
    Copyright © 2002W. A. Tucker 4 Computer Hardware • The main parts of a computer are – Memory • Main memory – RAM – Volatile memory • Secondary memory (secondary storage) – Files – Non-Volatile – Input / Output – Central Processing Unit
  • 5.
    Copyright © 2002W. A. Tucker 5 Processing Data • Processing of data occurs within the CPU – Data must be moved from storage to the CPU for processing to occur – The CPU must be told where the data is located – All data stored in main memory is referenced by a memory address – Example: A = B + 12 • Get the contents of memory location 00BE34 (B) • Add 12 to the value • Store the value into memory location 00BE38 (A)
  • 6.
    Copyright © 2002W. A. Tucker 6 Computer Software • Operating Systems manage and control the resources of a computer – EX: Windows 98, Windows 2000, Windows XP, UNIX, Lynix, MAC/OS, etc – Most operating systems provide a graphical user interface (except UNIX and Lynix) • Application Software – Programs written to perform a specific task – EX: Office 2000, Office XP, Quicken, etc.
  • 7.
    Copyright © 2002W. A. Tucker 7 Computer Instructions • Programmers must “tell the computer what to do” • The computer will do exactly what the programmer tells the computer to do, nothing more and nothing less.
  • 8.
    Copyright © 2002W. A. Tucker 8 Computer Language • Computers understand only the binary number system (zeros and ones) – All data stored in the computer is stored as a series of zeros and ones – All instructions telling the computer what to do are stored as a series of zeros and ones • People do not naturally think in terms of zeros and ones (the binary number system)
  • 9.
    Copyright © 2002W. A. Tucker 9 Programming Languages • Programming languages allow a programmer to give the computer instructions in a manner that the programmer can understand • Assembly Language is a low level language, where the programmer uses a mnemonic (abbreviation) to communicate an instruction to the computer – EX: “A” or “add” for addition • This mnemonic is translated into machine language (binary) by a program called an assembler
  • 10.
    Copyright © 2002W. A. Tucker 10 More on Programming Languages • Assembly language is a one for one mapping to the machine language and has to be rewritten for each machine (not all machine languages are the same) • An Assembler translates assembler code into machine language that a computer may execute • High level languages were created to allow programmers to write at a level where one programming instruction is converted into several machine language instructions and to avoid having to constantly rewrite the program • A compiler converts high level language into machine language that a computer may execute
  • 11.
    Copyright © 2002W. A. Tucker 11 Examples of Languages • High Level Languages – BASIC, C, COBOL, FORTRAN, PASCAL • Object Enabled Languages – C++ • Object Oriented Languages – Java, C#
  • 12.
    Copyright © 2002W. A. Tucker 12 Development Environment • Developing a program in a high level language requires certain tools – Editor – type in a program and save as a file (called the source program) – Compiler – converts source program into machine language (called the object program) – Linker – Combines object program with other programs (include files) to produce executable code (called the load module) – Loader – Loads executable code into memory
  • 13.
    Copyright © 2002W. A. Tucker 13 Integrated Development Environment (IDE) Editor Source File Compiler Object File Linker Object File .cpp extension .exe extension Loader Syntax Errors Linker Errors Loader Errors
  • 14.
    Copyright © 2002W. A. Tucker 14 Software Development Method 1) Specify the problem 2) Analyze the problem 3) Design the algorithm to solve the problem - Desk Checking 4) Implement the Algorithm - Coding 5) Test and verify the completed program - Compiling and Executing 6) Maintain and update the program
  • 15.
    Copyright © 2002W. A. Tucker 15 Structured Programming • Dividing a larger problem into smaller parts – AKA: tops-down design, stepwise refinement, modular programming – Identify what steps need to be done, usually VERBS – (ie: calculate, process, get, display, etc) • Each smaller part is then solved using one of three types of programming structure – Sequential structure – Selection structure – Repetition (looping) structure
  • 16.
    Copyright © 2002W. A. Tucker 16 Procedural Solutions • Using structured programming, most problems can be solved using the following general procedural steps – Get the input – Process the input – Display (output) the results
  • 17.
    Copyright © 2002W. A. Tucker 17 Object Oriented Programming • Humans interact with objects every day – Driving a car – Purchasing groceries • OOP involves defining the attributes (data) and behaviors (operations) of objects (usually NOUNS) • Combining these attributes and behaviors into a class is called encapsulation
  • 18.
    Copyright © 2002W. A. Tucker 18 Advantages of Objects • Once an object is designed, implemented and tested everyone can use it – Improves productivity – Supports portability or reuse of code – All of which reduce development time

Editor's Notes