220 likes | 301 Views
GENERAL CONCEPTS OF OOPS INTRODUCTION
E N D
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming more and more complex. In view of the increasing complexity of software system , the software industry and software engineer continuously look for new approaches to software design and development. The increased complexity had become the chief problem with computer programmers in traditional languages. Large programs , because of this complexity, are more prone to errors, and software error can be expensive and even life-threatening. The most adopted and popular programming approach, structured programming approach, failed to show the desired result in terms of bug free, easy to maintain and reusable programs. The latest programming approach, object-oriented programming (OOP), offers a new and powerful ways to cope with this complexity. Its goal is clearer, more reliable, more easily maintained programs. This introduces general OOP concepts that the traditional languages like C, Pascal , COBOL and BASIC lack in and the new generation languages.
EOVOLUTION OF SOFTWARE A program serves the purpose of commanding the computer. The efficiency and usefulness of a program depends not only on proper use of commands but also on the programming language it is written in. The two major types of programming languages: Low Level languages and High Level languages offer different features of programming. Low Level languages (i.e. machine language assembly language) are machine-oriented and require extensive knowledge of computer circuitry. Machine language, in which instructions are written in binary code (using 1and 0), is the only language the computer can execute directly. Assembly language, in which instructions are written using symbolic names for machine operations (e.g. read, add, store etc.)And operands, makes programming less tedious than machine language programming. However, assembly program is then converted into machine language using assembler software. High level languages, (hills) on the other hand, offer English like keywords, constructs for sequence, selections (decision) and iteration compared to low level languages. The programs written in hlls are converted into machine language using compiler or interpreter as a computer can work with machine language only.
A programming language should serve two related purposes: (1) It should provide a vehicle for the programmer to specify Actions to be executed and (2) It should provide a set of concepts for the programmer to Use when thinking about what can be done. The first aspect ideally requires a language that is “close to the Machine”, so that all important aspects of a machine are handled simply and efficiently in a way that is reasonably obviously the programmer. The second aspect ideally requires language that is “close to the problem to be solved” so that the concepts of a solution can be expressed directly and concisely. The low level languages serve only the first aspect i.e., they are close to the machine and the high level languages serve only the second aspect i.e., they are close to the programmer. However, the languages ‘C’ and ‘C++’ serve both the aspects, hence can be called as ‘middle level languages’.
Programming paradigms By paradigm one means a way of thinking or doing things Paradigms mean organizing principle of program. It is an approach to programming.
Procedural programming A program in a procedural language is a list of instruction where each statement tells the computer to do something. The focus is on the processing, the algorithm needed to perform the desired computation.
Modular programming With the increase in program size, a single list of instructions becomes unwieldy. Thus a large program is broken down into smaller units i.e., functions (sub programs). The idea of breaking a program into functions can further be extended by grouping a number of functions together into a larger entity called a module, but the principle is similar: grouping of components that carry out specific tasks.
Module A set of related procedure with the data they manipulate is called a module.
Object Object is an identifiable entity with some charities and behavior.
Basic concepts of oop • Data abstraction • 2. Data encapsulation • 3. Modularity • 4. Inheritance • 5. Polymorphism
Data abstraction Abstraction refers to the act of representing essential features without including the background details.
Encapsulation The wrapping up of data and operation/functions (that operate on the data) into a single unit (called class) is known as encapsulation.
Modularity Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules.
Inheritance Inheritance is the capability of one class of things to inherit capabilities or properties from another class.
Polymorphism Polymorphism is the ability for a message or data to process in more than one form.
Advantages of OOP 1. It models the real world. 2. With OOP programs are easy to understand. 3. OOP facilities quick development as parallel development of classes is possible. 4. With OOP programs are easier to test manage and maintain.
Disadvantages of OOP 1. With OOP classes tend to overly generalized. 2. The relation among classes becomes artificial at times. 3. The OOP programs design is tricky. 4. Also one need to proper planning and proper design for OOP programming.
Unsolved question type: A Q1. What are the two major types of programming languages? Ans. The two major types of programming languages are: Low level language and High level language. Q2. How are programs written in 1? Machine language 2. Assembly language? Ans. Machine language in which instruction are written in binary code using 1and 0) is the only language the computer can execute directly. Assembly language in which instruction is written using symbolic names for machine language operations. Q3. Why are low level language considered close to the machine? Ans. The low level language serves only the first aspect i.e., they are close to the machine. Q4. Which two related purposes should be served by a programming language? Ans. A programming language should serve two related purposes: 1. It should provide a vehicle for the programmer to specify actions to be executed and 2. It should provide a set of concepts for the programmer to use when thinking about what can be done.
Q5. Why c++ called middle level language? Ans. C++ serves both the aspects, i.e. low level language serve the first aspect and high level language serve the second aspect. Q6. What do you understand by programming paradigm? Ans. Programming paradigm means organizing principle of a program. It is an approach to programming. Q7. What are the characteristics of procedural paradigm? Ans. In procedural paradigm the emphasis is on doing things. Data is after all the reason for a program existence. The important part of an inventory program is not a function that display or checks data; it is the inventory data itself. Yet data is given second class status while programming. Q8. What is a module? What is modular programming? What are its characteristics? Ans. A set of related procedure with the data they manipulate is called a module. Modular programming: A Modular programming is a programming in which a large program is broken down into smaller units i.e. functions (sub programs). Characteristics: In modular programming since many modules access the same data, the way the data is stored becomes artificial.
Q9. What is an object? What is a class? How is class different from object? Ans. Object is an identifiable entity with some characteristics and behavior. Class is a template/ blue print representing a group of objects that share some common properties and relationships. Object is an instance of class i.e. why class is different from object. Q10. What is meant by abstraction? Ans. Abstraction refers to the act of representing essential features without including the background details or explanations. Q11. What is modularity? Ans. Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules . Q12. What is a base class? What is derived class? How are these two interrelated? Ans. A derived class is a class that inherits properties from some other class. A base class is a class whose properties are inherited by derived class. A derived class has nearly all the properties of base class but reverse of it is not true.
Unsolved question type: B Q1. What is polymorphism? Ans. Polymorphism is the ability for a message or data to be processed in more than one form. Q2. Write a short note on inheritance? Ans. Inheritance is the capability of a class to inherit properties from another class. Those classes that inherit from other class is subclass or derived class and the other class is a base class . Q3. Write a short note on modular programming? Ans. A modular programming is a programming in which a large program is broken down into smaller units i.e. functions (sub-programs). In modular programming since many modules or (functions) access the same data the way the data is stored becomes critical. The arrangement of the data cannot change without modifying all the functions that access it. Q4. What is the difference between class and an object? Ans. An object is an identifiable entity with some characteristics and behavior. It represents an entity that can store data and its associated functions. A class is a group of objects that share some common properties and relations. It represents a group of similar objects.
Q5. Write a short on procedural programming? Ans. A program in a procedural language is a list of instructions where each statement tells the computer to do something. The focus is on the processing the algorithm needed to perform the desired computation. In procedural programming the emphasis is on dong things. The important part of an inventory program isn’t a function that displays or checks data; it is the inventory data itself. Yet data is given second- class status while programming . Q6. Explain the transitive nature of inheritance? Anstey transitive nature of inheritance states that if a class A inherits properties from its base class B then all its subclasses will also be inheritating the properties of base class of an i.e. B. Q7. What is the benefit nature of inheritance? Ans. Suppose a class A inherits from class B. Classes C and D inherit from A. if there is a bug in B then correction is required only in B as it will be automatically reflected to all subclasses A,C and D if class B has been inherited without changes.