COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea,...

12
COMPUTER COMPUTER PROGRAMMING PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

Transcript of COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea,...

Page 1: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

COMPUTER COMPUTER PROGRAMMINPROGRAMMIN

GG

COMPUTER COMPUTER PROGRAMMINPROGRAMMIN

GG

Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

Page 2: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

WHAT IS COMPUTER PROGRAMMING?

WHAT IS COMPUTER PROGRAMMING?

A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks.

The term programming language usuallyrefers to high-level languages, such as BASIC,C, C++, COBOL, FORTRAN, Java, and Pascal.

Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions.

Regardless of what language you use, you eventually need to convert your program into machine language so that the computer can understand it. There are two ways to do this:

– compile the program

– interpret the program

Page 3: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

THE PROGRAMMING PROCESS

THE PROGRAMMING PROCESS

1. Analyze the Problem

2. Develop an Algorithm

3. Document the Program

4. Write Code for the Program

5. Run the Program

6. Test the Results

Page 4: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

ANALYZE THE PROBLEMANALYZE THE PROBLEM

A programmer must know what information will go into the software, how it will process the information, and what will result. All software must work with three concepts to be successful:

– Input: Information that comes from an external source and enters the software. Input can come from typing on a keyboard, from records in a database, or from clicking on an image with the mouse

– Processing: Manages information according to a piece of software’s logic. Processing is what the software does to the input it receives. This can be anything from adding a few numbers together to mapping the earth’s climate.

– Output: The information software produces after it has processed input. Output can appear on a computer screen, in a printout, or in records in a database.

Page 5: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

ALGORITHMSALGORITHMS

Algorithms are the steps needed to solve a problem using pseudocode or flowcharts.

After creating an algorithm,programmers check its logic.

A logic error is a mistake in theway an algorithm solves aproblem.

Programmers check their algorithms by inputting test data and checking the logic by hand or with a calculator.

Page 6: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

PSEUDOCODEPSEUDOCODE Pseudocode uses English statements to create an outline of

the necessary steps for a piece of software to operate. Programmers call these steps an algorithm. An algorithm is

a set of specific steps that solves a problem or carries out a task.

While there is no set of rules for writing pseudocode, it usually follows rules such as:– Using simple English– Putting one command on a line– Placing any important words in bold– Starting from the top and work toward

the bottom– Separating processes with spaces to

form modules

Page 7: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

PROGRAM FLOWCHARTS

PROGRAM FLOWCHARTS

Programmers also use program flowcharts to plot the software’s algorithm.

A program flowchart is a graphical depiction of the detailed steps that software will perform.

Unlike pseudocode, whichhas less structure, in flowcharts programmersmust use symbols.

Page 8: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

CODINGCODING

Coding is when a programmer translates an algorithm into a programming language.

Page 9: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

TESTING PROGRAMS

TESTING PROGRAMS

Debugging – the process of finding errors in software code.

Bugs – are a common name for software errors. When programmers debug code, they look for syntax, run-time, and logic errors.

Syntax errors – mistakes in a software code’s grammar. If you are supposed to use a semi-colon (;) and you use a colon (:) instead, you have made a syntax error.

Run-time errors – mistakes that occur when a programmer runs the software code.

Logic errors – mistake made in the way an algorithm solves a problem.

Page 10: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

OBJECT-ORIENTED PROGRAMMING

OBJECT-ORIENTED PROGRAMMING

Object-oriented programming (OOP) is any programming language that uses objects to code software.

An object instance is an exact copy of an object in OOP.

An event-driven language responds to actions users perform on the program. It’s an event when you click on a button, use a pull-down menu, or scroll down a window.

In an event-driven language, each event triggers the program to action.

Page 11: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

WEB PROGRAMMIN

G

WEB PROGRAMMIN

G

HyperText Markup Language (HTML) is the basic language for web programming.

JavaScript – a scripting language that allows you to add interactivity and other features to a Web page.

Java Applets – A small piece of software that enables applications to run on a Web page.

Dynamic HTML – combines cascading style sheets, JavaScript, etc., to bring high interactivity to Web sites.

VBScript – an interpreted scripting language based on Visual Basic. It is similar to JavaScript but only Microsoft’s Internet Explorer Web browser can use it.

Page 12: COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.

PROGRAMMING LANGUAGES

PROGRAMMING LANGUAGES

BASIC Stands for Beginner’s All-purpose Symbolic Instruction Code. Basic was developed in 1964 and is still in use today. Many variations of it exist and it’s on most desktop and notebook computers. It’s a procedural, interpreted language.

Visual Basic

Developed by Microsoft, VB uses a graphical interface to develop event-driven Windows programs. Visual Basic for Applications (VBA) is a subset of VB that allows programmers to develop macros in the Microsoft Office environment.

COBOL Stands for Common Business Oriented Language, COBOL is a widely used procedural language in business applications. It’s primarily used on mainframe computers.

C C is a compiled procedural program used to develop operating systems and application software. It is a powerful and efficient program, but it’s difficult to use.

C++ An object-oriented version of C. It’s used for man of the same applications as C as well as database and Internet programs. You don’t need to know C to learn C++.

FORTRAN Stands for Formula Translator. FORTRAN is the oldest high-level language still in use. Scientists and engineers use it to handle complex mathematical and scientific calculations.

Pascal Developed in the late 1960s to help students learn structured programming concepts. It’s named after the 17th-century French mathematician, Blaise Pascal. Turbo Pascal is an object-oriented version.

Java A high-level, object-oriented programming language based on C++. Java is optimized for Web and Internet appliance applications.

SQL Stands for Structured Query Language. SQL was developed to provide a common means to work with databases. SQL is a declarative fourth generation language that assists programmers in deriving the necessary information from databases.