Trending ▼   ResFinder  

ICSE Class IX Notes 2023 : Computer Applications (Ebenezer International School (EISB), Bangalore)

5 pages, 19 questions, 0 questions with responses, 0 total responses,    0    0
Divya SN
Ebenezer International School (EISB), Bangalore
+Fave Message
 Home > divyasn >   F Also featured on: School Page

Formatting page ...

CONCEPTS OF OBJECT ORIENTED PROGRAMMING PROGRAMMING LANGUAGE: A programming language is a set of instructions to perform a task. It is classified into two categories as: 1) Low Level Language 2) High-Level Language Low Level Language is a language in binary form that is understandable by the computer. It is further classified as: i) Machine level language It is a binary language i.e. language in the form of 0 s and 1 s which a machine understands easily. It requires no translation. ii) Assembly level language it is an intermediate language that uses symbols and mnemonics to develop a solution or perform a task. It was designed to overcome the difficulty of using binary language(MLL). It is a language easily understandable by the user and hence requires a translation into machine language. It uses an Assembler which is a translating program that converts an assembly level language to a machine level language High-Level Language is a language in English like statements that is easily understandable to the user. It requires a translator to be converted to a machine languages. There are two different types of translator used and they are: 1. Compiler A translating program that converts all instructions in high-level programming language into a machine level language at once. It is a faster process but difficult to debug all errors together. 2. Interpreter - A translating program that converts a high-level language line by line into a machine level language. Correction of errors is faster since the error is found at the end of each statement but it takes longer execution time. Source Code A program or code written in a high-level language Object Code/Machine code A program in binary form i.e. machine level program Difference between Compiler and Interpreter Compiler It converts the whole source program into object program at once It displays the errors for the whole program together after compilation Interpreter It converts the source program into object program line by line It displays the errors of one line at a time and after correction the control goes to the next line APPROACH TO PROGRAMMING: There are 2 basic approaches to programming. They are: 1. Procedural Programming 2. Object Oriented Programming Procedural Programming: Creates a step by step program that guides the application through a sequence of instructions. The program is divided into smaller parts called functions and emphasis is more on functions than on the data. It allows for sharing of global data and free movement of data between functions. Object Oriented Programming: An approach to standardize the program by creating partitioned memory area for both dad and function. It represents concepts as entities called objects that have some common attributes (data fields) and associated procedure called methods Provides data access mechanisms to control the access of data between functions, hence protecting the data from being edited or changed. Features of OOP: It emphasizes more on data rather than on procedure Makes the complete problem simpler by dividing it into a number of objects Objects can communicate with each other through functions It is easier to add new data and function wherever necessary Allows for reusability of code Advantage of using Object Oriented Programming : Inheritance - An existing class properties can be extended thereby eliminating redundant code. Data hiding facilitates generation of a secured program Multiple instance of an object can co-exist without any interference to each other. Reusability Functions and modules written by one user can be reused by other users without any modification(library functions) Reduced complexity of a program and hence easy to modify and maintain Message passing technique of message communication between objects makes the interface with external system easier. Different modules can be created through objects. ELEMENTS OF OBJECT ORIENTED PROGRAMMING: 1. 2. 3. 4. 5. 6. 7. 8. Objects Classes Data Abstraction Data Encapsulation Inheritance Polymorphism Data Hiding Objects: Every individual entity is referred to as an Object. It possesses the following feature: o Characteristics/Attributes as Data items o Behavior as methods or functions. Procedural Programming Program is divided into smaller parts called Functions Importance is not given to data but to functions as well as sequence of actions to be done. follows Top Down approach. Data can move freely from function to function in the system. New data and functions cannot be easily added Ex: C, FORTRAN, VB It is an instance of a class OOP Program is divided into parts called Objects Importance is given to the data rather than procedures or functions because it works as a real world. Follows Bottom Up approach objects can move and communicate with each other through member functions. New data and functions can be easily added Ex: C++, Java, VB.NET Example : Real world entities like car, television, telephone, table, gadgets etc. are all objects For example, an object Person has the following attributes: First Name Last Name Age Weight The methods of a Person object would be: Set_firstname() Set_lastname() Get_firstname() Get_lastname() Classes: It is a blueprint of an object. A group of similar objects of the same kind i.e. objects having same attributes and behavior under one unit. It wraps up all the information needed for an object in one unit. It is commonly referred to as an Object factory because each class can describe an infinite set of individual objects. For example, A class Car can have numerous objects as Hyundai, Audi, Chevrolet, Maruti etc. Example of a class: Class Student Some of the attributes and functions of a class Student that can wrapped under one class are as given: Attributes: Reg_ no : Registration Number Adm_date : Date of admission Name : name of the Student Class : The class to which the student belongs to Date of Birth :the date of birth of the student Address : Residential address of the student Methods: Getdata() : to input the data values Showdata() : To display all the details Compute_marks : to calculate the marks of the student Assign_grade : to assign the grade to the student depending on the percentage There are 5 basic concepts of object-oriented programming. They are: 1. Data Abstraction: It is a concept of hiding all the unnecessary details and representing only the essential features. It is always relative to the user. Example - The details of the structure and the circuit of a television is hidden and only the essential features like power button, volume, brightness control keys, channel changer keys are available for use. 2. Data Encapsulation: The process of binding and wrapping up of data and methods together into one unit is called Encapsulation. It keeps the data safe from being misused or altered. It provides for two aspects with respect to OOP: The source code of an object that can be maintained independently The object maintains privacy of the data members and ensures that the changes taking place within the functions don t affect the data of another object. ExampleA Samsung phone of Class Mobile_phones has its own attributes like memory, number of ringtones, maximum and minimum tone volume, its size and shape. It also has its own applications, games, send and receive mechanisms etc. Thus, its characteristics and behavior is bound into one unit as an Object (i.e. Samsung phone of class Mobile_phones) 3. Inheritance: It is a process by which an object acquires the properties of another object i.e. it allows to link and share common properties of one class with the other class. It can be done by extending the object of Class1 into another Class2 and using the functions of Class1 through Class2. Example Labrador is an object of Class Dog, which itself is a part of another class the Mammal Class and this Mammal class is under Animal Class. Inheritance can for the above set of classes will be : Mammal inherits characteristics from the class Animal, Dog inherits characteristics from class Mammal Labrador inherits characteristic from class Dog 4. Polymorphism The process of using one function for more than one purpose is referred to as Polymorphism. The same operation/function may behave differently on different classes. It supports function overloading. ExampleThe function Volume() of a class Shapes, will behave differently for different types of shapes. i.e. The function volume() may be used to calculate the volume of geometrical figures like cube, cuboid, cylinder etc by using different parameters but with the same function name Volume Volume (side) Object: Cube Volume (length, breadth, height) Object: Cuboid Volume (radius) Object: Sphere 5. Data Hiding: It is a process of creating a logical insulation between data and outside world. i.e. in OOP data cannot be accessed directly between functions, since it is kept hidden. It can be accessed only with related functions through objects.

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

divyasn chat