Writing a Software Program
Download
Report
Transcript Writing a Software Program
Software Development
CS 1
Rick Graziani
Spring 2007
Definitions
Software or Program
Instructions that tell the
computer what to do
Programmer
Someone who writes
computer programs
Rick Graziani [email protected]
2
CPU Instruction Set
Instruction Set
0001
0010
0011
0100
0101
0110
0111
1000
1001
Instruction
Move
Compare
Bit test
Bit clear
Bit set
Add
See group 10
See groups 11, 13, 14
Move byte
Instruction Set
A vocabulary (list) of instructions which can be executed
by the CPU
• The only instructions the CPU can run or execute
• Example of a CPU’s Instruction Set
Rick Graziani [email protected]
3
First Generation Languages
(Machine Language)
• Programming computers using the CPU’s instruction set
• Also known as Machine Language
Machine Code File
A software file which contains the instructions from the CPU’s
instruction set.
Rick Graziani [email protected]
4
First Generation Languages
(Machine Language)
Advantages of First Gen.
• Software programs execute (run) relatively very
quickly
• Software programs are relatively small in size
• (Insignificant advantages today)
Disadvantages of First Gen.
• Difficult to write, very detailed and takes a long time
• Difficult to read
• Difficult to debug
debug = the process to find mistakes in a software
program
Rick Graziani [email protected]
5
Second Generation Languages
(Assembly Language)
Instruction Set
0001
0010
0011
0100
0101
0110
0111
1000
1001
Instruction
Move
Compare
Bit test
Bit clear
Bit set
Add
See group 10
See groups 11, 13, 14
Move byte
Assembly Language = The English-like instructions which are
equivalent to the CPU’s instruction set
Source Code= The actual instructions written by a programmer
Compiler = Software which translates source code instructions of a
particular language into machine code
Rick Graziani [email protected]
6
Second Generation Languages
(Assembly Language)
Question: Which of these two files (source code file or
machine code file) will the user need to run this
software program?
Advantages of Second Gen.
• Easier to read than first gen.
• Easier to write than first gen.
• Easier to debug than first gen.
Disadvantages of Second Gen.
• Still very difficult to write programs
Rick Graziani [email protected]
7
Using a compiler
Rick Graziani [email protected]
8
Third Generation Languages
(High level languages)
Languages which are somewhere between
machine language and the human
language.
FORTRAN (Formula Translation) - 1950's
Language to allow scientists and engineers to program
computers.
COBOL (Common Business Oriented Language) - 1960
Language primarily designed for US government and
defense contractors to program business
applications on the computer. Grace Hopper was
one of the developers of COBOL.
BASIC (Beginner's All-purpose Symbolic Code) - 1960's
Alternative language to FORTRAN for beginning
programming students.
Rick Graziani [email protected]
9
Third Generation Languages
(High level languages)
Pascal (named after Blaise Pascal, 17th century French mathematician) 1970's
Language to teach proper structured programming.
Structured programming = Programming technique used to make
programming more productive and easier to write. Stresses simplistic,
modular programs.
ADA (named after Ada Lovelace (programmed the 19th century 'analytical
engine') - late 1970's
Language developed to replace COBOL.
Rick Graziani [email protected]
10
Third Generation Languages
(High level languages)
C (successor to BCPL or "B") - 1970's
Popular programming language on computers from
microcomputers to super computers.
Faster and more efficient language. Very powerful language.
Source code example of a C Program (Displays Hello World!
on the screen.)
#include <stdio.h>
main()
{
printf("Hello World!");
}
C++ (pronounced "C plus plus") - 1980's
Object oriented language which is compatible with C.
Rick Graziani [email protected]
11
Third Generation Languages
(High level languages)
Advantages
• Easier to read, write and
debug
• Faster creation of programs
Disadvantages
• Still not a tool for the average
user to create software
programs
• Requires very good
knowledge of programming
and of the language
Rick Graziani [email protected]
12
Third Generation Languages
(High level languages)
Advantages
• Easier to read, write and debug
• Faster creation of programs
Disadvantages
• Still not a tool for the average user to create software
programs
• Requires very good knowledge of programming and
of the language
Rick Graziani [email protected]
13
Writing a Software Program
Steps in writing a software program
1. Hardware (CPU)
2. Operating System
3. Programming Language
4. Brand of Compiler
5. Writing the Program
Rick Graziani [email protected]
14
Writing a Software Program
Task
Write a program to convert binary numbers to decimal
and decimal numbers to binary
Rick Graziani [email protected]
15
Writing a Software Program
1. Determine what kind of computer you want your
program to run on
Macintosh?
Windows PC?
Mainframe?
Rick Graziani [email protected]
16
Writing a Software Program
2. Determine which operating system this computer
(and the user) will be using
Windows XP?
Mac OSX?
Linux?
Rick Graziani [email protected]
17
Writing a Software Program
3. Determine which language you will be programming
in.
C?
C++?
Java?
•
C++
Rick Graziani [email protected]
18
Writing a Software Program
4. Determine the compiler for your language, operating
system and hardware
Microsoft Visual C++?
Borland C++?
Watkins C++?
•
Microsoft Visual C++
Rick Graziani [email protected]
19
Writing a Software Program
5. Write the program
Rick Graziani [email protected]
20
Writing a Software Program
Compile the program into a machine code file and
distribute it to the users via floppy diskette.
Rick Graziani [email protected]
21
Fourth Generation Languages
Languages which are more like
natural human languages
• uses English phrases
• common with data base
languages
search for name equals “graziani”
and state equals “ca”
Examples
dBase FoxPro Access
Oracle Informix SQL
Rick Graziani [email protected]
22
Fourth Generation Languages
Advantages
• Average users can quickly learn to “query” the
database
• Average users can easily learn how to write
programs
• Programs are written faster
Disadvantages
• Can not write sophisticate programs like word
processors, graphics, etc.
• Mostly for data base applications like phone
information.
Rick Graziani [email protected]
23
The Year 2000
What is the big deal?
Older computer systems
• limited RAM memory
• limited disk storage
• slower processors (CPUs)
The YEAR was stored using two bytes instead of four
bytes, in order to save bytes in RAM and storage
• 67 instead of 1967
Rick Graziani [email protected]
24
The Year 2000
What is the big deal?
Example:
• 500,000 records
Save 1 million bytes
500,000 x 4 bytes (19xx)
= 2 million bytes
500,000 x 2 bytes (xx)
= 1 million bytes
• less storage on disk
• less RAM memory needed
• faster processing
Rick Graziani [email protected]
25
The Year 2000
What is the big deal?
Problem
The year 2000 will be “00” or looked at by the
computers as the year “1900”
Will cause miscalculations for everything from pension
funds to horoscopes.
Rick Graziani [email protected]
26
Databases and Relationships
Relationships
•
•
•
One-to-One
One-to-Many
Many-to-Many
Rick Graziani [email protected]
28
One-to-One Relationships
Rick Graziani [email protected]
29
One-to-Many Relationships
Rick Graziani [email protected]
30
One-to-Many Relationships
Rick Graziani [email protected]
31
Many-to-Many
Relationships
(Not
recommended)
Rick Graziani [email protected]
32
Software Development
CS 1
Rick Graziani
Spring 2007