Chapter 1 - pseudorandom bits

advertisement
Neal Stublen
nstublen@jccc.edu
Computer Systems
Hardware
Keyboard
Display
Microphone
Mouse
Microprocessor
Memory Chips
Computer Systems
System Software
Windows
Mac OS
Linux
Android
Hardware
iOS
Computer Systems
Application Software
Microsoft Word
Photoshop
Firefox
Visual Studio
Face Time
Angry Birds
System Software
Hardware
System vs. Application Software





Specialized skills target different levels of
software development
Application software provides specialized
services
System software makes common services
available to all applications
Application software performance affects
(most often) a single application
System software performance impacts
every application
Review Question

Classify the following as system
software or application software:
 Word processing software
 Printer driver software
 Video games
 Internet browser

The line may seem fuzzy at times, but
often individual developers may focus
on one or the other.
Software Operations
Input
Data Input
Sources of data input?
 Keyboard/mouse
 Touch screen
 Files on a hard drive
 Sound in a microphone
 Camera images
 Accelerometer/gyroscope sensor data

Software Operations
Input
Processing
Processing
Processing is done by the CPU
 Examples of processing
 Position cursor on screen
 Reformat text
 Perform voice recognition
 Sharpen photographic data
 Detect shaking gesture

Software Operations
Input
Processing
Output
Data Output
Examples of data output?
 Update display on monitor
 Play sounds through a speaker
 Write files on a hard drive
 Start or stop a motor

"Coding" Software


Software instructions are written in a computer
programming language
What programming languages can you
identify?








C/C++
Java
C#
Visual Basic
Python
PHP
JavaScript
Perl
Language Progression


Programming instructions are converted into
codes that can be understood by the computer
Languages progress to make programming
tasks easier and clearer
.DATA
var DB 0
mov eax, [var]
inc eax
mov [var], eax
int var = 0;
var++;
Language "Syntax"

Each language has its own syntax for
formatting instructions
 int value = 25; // C++, C#
 value = 25 // Python
 var value = 25; // JavaScript

Syntax must match expected formatting
or the computer program cannot be
converted into machine instructions
Compilers/Interpreters
Computer language instructions are
converted using a compiler or interpreter
 A compiler converts a program into lowlevel instructions before the program can
execute

 Syntax errors are found before the program runs
 C++, C#, Java

An interpreter converts a program into lowlevel instructions as the program executes
 Syntax errors may not be discovered for a long
time
 Python, PHP, Perl, JavaScript
Source Code and Object Code
We refer to our high-level computer
program as source code
 We refer to low-level machine
instructions as object code

Programming Logic
Instructions are performed in a specific
sequence to accomplish the desired
purpose
 Logical errors prevent a program from
working correctly
 Logical errors may exist when syntax
errors do not

Syntax Errors
Two add eggs
 Flour in stir
 One sugar add cup
 At minutes 350 45 bake degrees for

Logic Errors
Stir in flower
 Add two eggs
 Bake at 350 degrees for 45 minutes
 Add one cup sugar

May be referred to as "sematic errors"
 More commonly referred to as "bugs"

Sample I-P-O
input someNumber
someResult = someNumber * 2
output someResult
Pseudocode instructions are English-like
statements that represent the actions a
program will need to take.
Sample I-P-O
input someNumber
someResult = someNumber * 2
output someResult
Input some value and store it in a memory
location that's referred to using the name
"someNumber".
Sample I-P-O
input someNumber
someResult = someNumber * 2
output someResult
Retrieve the value stored in the memory
location referred to by "someNumber". Double
the value and store it in a memory location
referred to by " someResult".
Sample I-P-O
input someNumber
someResult = someNumber * 2
output someResult
Send the value stored in the memory
location referred to by "someResult" to an
output device.
Review Question
Which of the following best describes a
syntax error?
A. Syntax errors are found during user data
input processing.
B. Syntax errors are identified by the compiler
or interpreter.
C. Syntax errors are found when the program
is run.
D. Syntax errors may be identified by the
hardware device driver code.
Review Question
Which of the following best describes a
syntax error?
A. Syntax errors are found during user data
input processing.
B. Syntax errors are identified by the compiler
or interpreter.
C. Syntax errors are found when the program
is run.
D. Syntax errors may be identified by the
hardware device driver code.
Review Question
Which of the following best describes a
logic error?
A. Logic errors are found during user data
input processing.
B. Logic errors are identified by the compiler
or interpreter.
C. Logic errors are found when the program is
run.
D. Logic errors may be identified by the
hardware device driver code.
Review Question
Which of the following best describes a
logic error?
A. Logic errors are found during user data
input processing.
B. Logic errors are identified by the compiler
or interpreter.
C. Logic errors are found when the program is
run.
D. Logic errors may be identified by the
hardware device driver code.
Procedural Programming
Breaks down a programming task into a
series of smaller subtasks (or
procedures)
 Focus on procedures needed to
accomplish the task

Object-Oriented Programming
Breaks down a programming task into
objects that model the task
 Focus on objects that can be used to
accomplish the task

Objects
Attributes - features or properties of the
object (things it "has" or "is")
 Behaviors - actions that can be
performed on or by the object (things it
"does")
 Object state - values of an object's
collection of attributes

Stages of Development
Object-oriented analysis (OOA)
 Object-oriented design (OOD)
 Coding/Implementation
 Testing
 Maintenance

Object-Oriented Analysis
Determine user
needs
 Who is a user?
 What problem needs
to be solved?

Object-Oriented Design
Develop an object model to represent
the problem and its solution
 Consider object attributes and behaviors
 Determine relationships between objects
 How do they communicate and respond
to one another?
 has a, is a, creates a
 Each type of object will be represented
by a class

Object Examples
What objects can you identify on your
phone?
 What attributes and behaviors would be
defined for those objects?

Coding/Implementation

Develop the logic of the program
 Mental planning
 Simple to complex drawings
 Collaboration with others
Produce algorithms - a sequence of steps
to solve a problem
 Write source code in an appropriate
language
 Translate source code into object code that
can be understood by the computer

Language Selection
The choice of a programming language
may be dictated by the problem being
solved.
 Support multiple platforms?
 Run within a web browser?
 Performance is critical?
 Google App Engine?
 Extension for WordPress?
 Windows desktop application?

Testing

All software needs to be tested
 Confirms the program works as expected
Self-testing
 Testing team
 Automated testing

Maintenance
All software needs updates
 Why would you need to update an
application?

 Mistakes need correction
 User needs change
 Features can be improved
Pseudocode
English-like representation of the logical
steps needed to solve a problem
 Guidelines: http://bit.ly/pf-pcode

start
start
change
oil
input
radius
inflate tires
area
= fluids
radius * radius * pi
check
output area
end
end
Flowcharts





Visual representation of program logic
Terminal blocks
I/O blocks
Processing blocks
Decision blocks




Gliffy - http://www.gliffy.com
Draw.io - http://www.draw.io
Lucidchart - http://www.lucidchart.com
Visual Logic – http://www.visuallogic.org
Example

Approaching a stop light...
Programming Environments
Text editor
 Integrated development environment
(IDE)

 Editor
 Compiler
 Debugging Tools
Notepad++
 Visual Studio

User Environments
Command line
 Graphical user interface (GUI)

Exercise

Case Projects, p. 29, #1
Summary
Overview of computer systems
 System vs. application software
 Software operations (I-P-O)
 Programming terminology
 Programming methodology
 Planning tools
 Application environments

Download