1 . SIBO PRASAD PATRO ASSISTANT PROFESSOR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING GIET, GUNUPUR Sibo Prasad Patro,Asst. Prof, Department Of CSE. GIET, GUNUPUR.
2 MODULE - I INTRODUCTION A language is used for the mode of communication. To communicate and interact with computer system similarly we may use a language. The languages are broadly divided into 3 categories: 1. Machine-level or low-level language: Programs written using this language only uses 0‟s and 1‟s. Disadvantages: Machine dependent Difficult to program Error prone Difficult to modify 2. Assembly-level or middle-level language Programs written using this language uses symbols known as mnemonics instead of 0‟s and 1‟s which are easy to remember. It is easier to use than machine language. Disadvantages: Machine dependent Knowledge of hardware required 3. High-level language Programs written using this language uses simple English-like instructions. Advantages: Machine independence Easy to use and learn Fewer errors Lower program preparation cost Better documentation Easier to maintain The high-level languages developed are categorized into different types such as: Monolithic programming In this type of language, the data variables declared are global and the statements are written in sequence. Data is not fully protected since they are global Sibo Prasad Patro,Asst. Prof, Department Of CSE. GIET, GUNUPUR.
3 To transfer control to any statement goto statements are used. The concept of subprograms does not exist and hence useful for smaller programs. Example- BASIC. Procedural programming The program is divided into a number of subprograms. Data is not fully protected since they are global To transfer control to any statement goto statements are used. These languages are generally used in developing medium size applications. Examples- FORTRAN and COBOL. Structured programming The program is divided into multiple sub modules and procedures. They use different control structures like for, while, do-while to transfer control to statements. Each procedure performs different tasks. Structured programming languages are also procedural since they contain sub modules. Each module has its own set of local variables and program code. They also share global variables. User-defined data types are introduced. Examples- PASCAL and C. Object-oriented programming The task is divided into objects. Global data is rarely used, so it is more secure. Examples- C++, SMALLTALK, JAVA, DIFFERENCE BETWEEN PROCEDURED-ORIENTED PROGRAMMING (pop) APPROACH AND OBJECT-ORIENED (oop) APPROACH Procedure-Oriented Programming: Conventional programming using high level languages such as COBOL, FORTRAN and C is commonly known as procedure-oriented programming. In the procedure-oriented approach, the problem is viewed as a sequence of things to be done, such as reading, calculating and printing. A number of functions are written to accomplish these tasks. The primary focus is on functions. A typical program structure for procedural programming is shown below. The technique of hierarchical decomposition has been used to specify the tasks to be completed in order to solve a problem. Sibo Prasad Patro,Asst. Prof, Department Of CSE. GIET, GUNUPUR.
4 Procedural-oriented programming basically consists of writing a list of instructions for the computer to follow, and organizing these instructions into groups known as functions. We normally use a flowchart to organize these actions and represent the flow of control from one action to another. While we concentrate on the development of functions, very little attention is given to the data that are being used by various functions. In a multi-function program, many important data items are placed as global so that they may be accessed by all the functions. Each function may have its own local data. The following figure shows the relationship of data and functions in a procedure-oriented program. In a large program, it is very difficult to identify what data is being used by which function. In case we need to revise an external data structure, we need to revise all functions that access the data. This provides an opportunity for bugs to creep in. Another serious drawback with the procedural approach is that it does not model the real world problems very well. This is because functions are action-oriented and do not really corresponding to the elements of the problem. Some characteristics/paradigms exhibited by procedure-oriented programming are: 1. Emphasis is on doing things (algorithms). 2. Large programs are divided into smaller programs known as functions. 3. Most of the functions share global data. 4. Data move openly around the system from function to function. 5. Functions transform data from one form to another. 6. Employs top-down approach in program design. Sibo Prasad Patro,Asst. Prof, Department Of CSE. GIET, GUNUPUR.