Programming Concepts Main Menu roll your cursor over and click the main menu items. IntroductionBasicsIntroduction to Data and Control StructuresIntroduction to Condition StatementsSelection Control StructureLoopsMore About LoopsModularityFunctionsControl Break LogicArrays. Introduction M
Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 2
Overview of Computers
Brief History of Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 3
Computer Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .page 6
Computer Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 8
Computer Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 9
Overview of Programming
Brief History of Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 14
Basic Concepts of Problem Solving. . . . . . . . . . . . . . . . . . . . . . . . .page 18
The Problem-Solving Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . page 19
Structured and Procedural Programming . . . . . . . . . . . . . . . . . . . page 21
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . page 23
Upon completion of this lesson, the student will be able to:
1. Discuss and give examples of the terms: algorithm, syntax, data, information, source code, object code.
2. Identify and give examples of computer operations and computer systems.
3. Describe, give examples, and compare the evolution of hardware as it relates to the evolution of
programming languages, from the early days of performing calculations and operations manually,
to the concept of stored programs.
4. Discuss and give examples of computer operations and the related sets of instructions in computer
programs that perform those operations.
5. List and describe the elements of the visual tools used for documenting and testing the program's
algorithm: flowcharts, pseudo code, hierarchy charts, IPO charts, and other tools for algorithm
6. List and describe the problem-solving stages.
7. Define and compare and contrast structured and unstructured programming, procedural programming,
and object-oriented programming.
8. Evaluate and write a simple program's flowchart, pseudo code, and IPO chart.
Prior to the evolution of the computer as it is known today, the word computer Referred to human beings who performed calculations, such as counting and
Eventually, mechanical calculators were developed.
More Info: The instructions for the calculations were stored mechanically within the device. The operator no longer had to memorize the instructions. With these devices, all that was required of the operator was to simply enter the figures in order for the device to perform the appropriate information.
The next level of development involved machines that could operate without human power. The various prototypes of these machines evolved in to the computers we use today. This evolutions is defined by five generations of computers.
The word computer, today refers to electronic devices that make use of electronic impulses (either on or off bits) to transformdata(raw bits) into information (data in a usable format.) Modern computers are distinguished in to three specific categories.
Bits : is a contraction of binary digit, which is the smallest unit of data; a single 0 or 1.
Data : is the raw material processed by the computer system, each data value describes some characteristics of a person, place or thing.
Information : is data that has been processed and manipulated in some way to make it meaningful to the user.
Microcomputers : Also known as personal computers (PCs), have the speed and memory capabilities to serve individual computer users.
Minicomputers (now replacing mainframes) : Have the speed and memory capabilities to handle large amounts of data for hundreds of thousands users.
Supercomputers : Are the fastest computers, and because of their speed and memory, are capable of performing operations that would not be practical for PCs or mainframes.
The IPO chart list the programs input data, processes and outputs.
IPO charts : are used to clearly define the inputs, process and outputs to be used in program. As the course advances, it will become clear why this kind of planning is important. As the saying goes Weeks of programming can save you hours of planning author is unknown.
Input : The data or information the program will use to produce the out put.
Process : The steps the programming will follow in order to process the input into output.
Output : The information produced by the program after processing the input.
There are several steps in the program development cycle.
program development cycle consists of five steps.
1. Analyze the problem : At this stage of the problem-solving process, the programmer must determine what the program is supposed to do (the purpose of the program): what data the program will use ( the programs input); what the program is supposed to produce (the programs output); the process the program will use to transform the data into the desired output information.
Visual tools for this stage can include impute layout charts that represent how the input data is stored in the records of a file or how input prompt will appear on the screen. Output layout spacing charts represent what the finished output report or screen will look like.
2. Plan the solution : During the planning stage of the programming development cycle, the programmer utilizes visual tools such as flow charts, pseudocode and hierarchy charts to develop the programs algorithm, or solution to the problem.
A flow chart is a graphical representation step-by-step that shows the flow of control of the program using symbolic diagrams. Pseudocode is a visual representation of the same step-by-step logic, but pseudocode Englishlike phrases instead of symbols. Hierarchy (or structure) charts show the major operational tasks required for the program solution. In addition, the charts demonstrate the relation ships between each of the major sections.
Once the algorithm has been documented using one or more of the visual tools, the programmers desk checks the programs logic by stepping through the algorithm with realistic test data. At this point the logic errors may be detected and corrected.
3. Code the program : The program (or source) code is written in the programming language selected by the programmer following the rules (or syntax) for that language. Once the source code is written. The program is processed by the language translator program. Any syntax errors are detected by the translator must be corrected before the machine language (object) can be generated. When all debugging and syntax errors is complete, a run-time version of the program can be executed.
Language translator : A language translator human-readable source code statements into the machine-readable object code; depending on the language, the translator will be an assembler, interpreter, or compiler program.
4. Test : testing the program is done using sets of data designed to produce the expected results. If the program language is faulty, the desired results will not be produced. The programmer must then debug the source code and revise the logic in the planning stages, this stage should require minimal effort.
Debug and revise : To debug a program, the programmer finds and corrects syntax errors in the source code.
5. Implement and maintain : The final stages of the programming process is to put the program into production. At this stage, all program documentation must be completed and presented at the time the program is implemented. The documentation includes all the documents used in the planning stage (such as input, output charts).The printed source code also becomes also a part of the documentation. In addition, user training manuals are provided as well as any other information that the end user might require to properly run the program.
Maintaining the program includes making appropriate updates to the program as needed. For instance, if income tax rates change, an update to the tax amounts would be required for a payroll program.
Structured programming, a subset of procedural programming, was develop in the 1970s as an alternative to the unstructured programming practiced at the time. Early programs were considered unstructured because they allowed they allowed the execution of flow of the programs instructions to be altered with GOTO statements that jumped out of the main flow of control of the program.
Structured Programming : Is supported by three basic control structures: sequence, selection, and iteration. These operations are covered in depth in the upcoming modules on Introduction to control Structures, the decision control structure, and looping.
Procedural programming : Specifies the steps a program must take in order to reach a specific goal (s) of the program. It is based on calls to pre-defined process (or routines, subroutines method, or functions, depending on the language). Pre-defined process can be called from any where in the program and they can be called by other processs. they can also call themselves. Pre-defined process are covered in more depth in modules on Modularity and Functions.
GOTO : A GOTO statement is an unconditional branching statement located elsewhere in the program. Improper or excessive use of the GOTO statement leads to a condition know as Spaghetti code. The end results of the unrestricted branching is the program be comes more complex and difficult for other programmers to maintain. GOTOs interrupt the intended sequential order in which the program instructions are executed.
Structured programming can be written in any programming language. Although it is most often associated with procedural languages, structured techniques and control are also used with object-oriented languages in Object-oriented languages.
Object-oriented languages : Is used for developing windows based programs and combines procedural programming techniques with the objects data members and methods.
Object-oriented design is based upon the creation of objects ;0 representing the real-world person, place or thing that the programs data represents. An object consist of various members that are an integral part of the object. The members describe the characteristics of the object e.g.. (name, weight, age, hair color). The members may also be self contained procedures that can process and manipulate the objects data. Thus, the object can do some of its own processing in addition to that perform by the programs instructions that are external to the objects.
OOP : Object oriented Programming relies on classes that describe objects which represent the data, as well as methods, that can be used to solve a particular programming problem.
Object : An object also has one, or more, member functions. A member function is sometimes referred to as a method or behavior. Each instance of the object will have its on set of built-in methods that can be called by the object its self to perform a pre-defined processing operations associated with the method.
Members : one data value or built-in function that is contained within the class within the class that defines an object. Each object instance that is created from the class will possess every member defined by the class. Members are accessed by the following notation:
Object variable. Member for data members
Object variable. Member for member functions (or methods)
Object-oriented programming concepts and procedural programming are not mutually exclusive. In other words, Modern programming takes full advantage of the best practices from each style of programming development. The over riding principle is to produce a structured, modular, easily maintained, solution to a given problem. Currently, within the programming profession, application development utilizes techniques from both traditional procedural coding and object oriented programming with objects.
Congratulations! You have completed introduction lesson.