120 likes | 311 Views
COMPUTER PROGRAMMING. Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002. WHAT IS COMPUTER PROGRAMMING?. A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks.
E N D
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
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
THE PROGRAMMING PROCESS • Analyze the Problem • Develop an Algorithm • Document the Program • Write Code for the Program • Run the Program • Test the Results
ANALYZE 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.
ALGORITHMS • 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.
PSEUDOCODE • 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 towardthe bottom • Separating processes with spaces toform modules
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.
CODING • Coding is when a programmer translates an algorithm into a programming language.
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.
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.
WEB PROGRAMMING • 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.