Understanding Computers, Chapter 12

Download Report

Transcript Understanding Computers, Chapter 12

Programming
Creating programs that run on your PC
(BTW- groups of programs are called software applications)
Learning Objectives
1.
2.
3.
Understand the differences between structured
programming, object-oriented programming (OOP),
aspect-oriented programming (AOP), and adaptive
software development.
Identify and describe the activities involved in the
program development life cycle (PDLC).
Understand what constitutes good program design and
list several tools that can be used by computer
professionals when designing a program.
Understanding
Computers: Today and
22
Learning Objectives
4.
Explain the three basic control structures and how they
can be used to control program flow during execution.
5.
Discuss some of the activities involved with debugging a
program and otherwise ensuring it is designed and
written properly.
6.
List some tools that can be used to speed up or
otherwise facilitate the program development process.
7.
Describe several programming languages in use today
and explain their key features.
3
Understanding
Computers: Today and
Breaking into Program development
From SDLC, break into PDLC
1. Analysis
•
What should it do?
2. Design
•
How will it do it?
3. Develop
•
Creation
4. Implement
•
Get rid of the “bugs”
5. Maintain
•
Keeping it running
Programs & Programming

Computer program –


Programming: Process of designing, writing, testing,
debugging & maintaining the source code of computer
programs


a sequence of instructions for a computer written to perform
a specific task
Programs need to be designed before they can be developed
One thing to remember:

Programs use computer memory


Space to Run in
Space to save pieces of information in for later use (variables)
Programming Languages

Programming – writing a computer program




Programming language


Flowcharts, business documents, models
Categories of programming languages




A set of rules, words, symbols, and codes used to write computer programs
Programming Tools


Write from scratch in selected language– write reusable code
Use Software Development Kit (SDK)
Use Application Programming interface (API)
Low-level languages
High-Level languages
4GL languages
Once written, prepare for execution (running)

.exe or .dll

Loads in memory
Uses memory to save information (variables)

6
Programming Languages
Low Level




Difficult to code in; machine
dependent
Machine language: 1’s and 0’s
Assembly language
Includes some names and other
symbols to replace some of the 1s and
0s in machine language
High Level





Closer to natural languages
Machine independent – run on windows and Mac
OS’s
Easier to learn
Many generations (4), as time passes and
hardware gets better
Translated to machine language







FORTRAN - mathematical, scientific, and
engineering applications
BASIC family (BASIC, Visual Basic, VB.NET) –
games to web services
COBOL - business transaction processing
C family (C, C++, C#, objective C) – mainframes,
web services, iPhones
Pascal – for midrange servers – taught
STRUCTURE
Java - web services, applets – most popular
today
Python – todays games
Languages (LOW LEVEL – HIGH LEVEL)
• Programmers write comments in code to explain complicated parts (ignored by computer)
• Each programming language has its own set of rules to follow
• Many programming languages to choose from – 3rd gen are quite similar
8
Fourth Generation Languages




Closer to natural languages
Easier to work with than high-level
Much of the code written is reusable!
Mostly used with:

Databases



Apps


Includes structured query language (SQL)
DB2, SQL Server, Oracle, Access, Foxpro, Powerbuilder, Natural,
FOCUS
Software development kits (SDK’s)
Web Services

Application Program Interfaces(API’s)
9
PROGRAMMING LANGUAGES
Programmers write out complicated logic
visually – in diagrams called flowcharts
START
RESERVE MEMORY
• Variable to indicate how many numbers we have gotten
• Variable to save the first number
• Variable to save the second number
GET A NUMBER
SAVE THE NUMBER IN MEMORY
TELL MEMORY VARIABLE WE HAVE A NUMBER
NO
Got 2
numbers
?
YES
ADD THE NUMBERS IN MEMORY
DISPLAY SUM
Other symbols, like an ellipse or
circle, mean other things
STOP
WRITE THE PROGRAM
USING CHOSEN
LANGUAGE
TRANSLATE THE PROGRAM
(LANGUAGE COMPILER)
INTO MACHINES LANGUAGE
Programs can have errors
• Compiler errors: Program doesn’t run
− Typically syntax errors: When the programmer has not followed the
rules of the programming language
• Run time error: Error that occurs when the program is running
• Usually an operation that cannot be completed
• Logic errors: Program will run but produces incorrect results
USERS CLICK
ON ICON TO
RUN “APP”
Creates .EXE
EXECUTE (RUN) THE
PROGRAM
- PROGRAM LOADS IN
MEMORY, and USES
MEMORY TO SAVE INFO
Programs use computer memory -Need “run space”
Save pieces of information for later use (variables)
Approaches to Design and Development

Procedural Programming


Object-oriented


Steps to accomplish task are separated into
small modules and execute in a certain
order or when needed
Programs consist of a collection of
objects that contain data and methods to
be used with that data and are used when
needed
Aspect oriented

Separates functions so program components
can be developed and modified individually
from one another


One program does all the database work,
another program presents the web page, etc..
Adaptive

Building the program in small steps of
functionality
13
Understanding
Computers: Today and