Computer

Revision of Class IX Syllabus

Part-1: Introduction to Object Oriented Programming Concepts

Learning Scope
  • Introduction
  • Procedure Oriented Language
  • Object Oriented Language
  • Principles of Object Oriented Programming (OOP)
    • Data Abstraction
    • Encapsulation
    • Inheritance
    • Polymorphism

Introduction
  • Language is a key medium for communication enabling interactions.
  • Users can only interact with a computer if they understand a computer language, hence the importance of learning computer languages.
  • Computer languages are broadly classified into two categories:
    • Low-level languages
    • High-level languages
    • High-level languages address limitations of low-level languages and offer a user-friendly platform for understanding and designing programming logic.
    • High-level languages are further subdivided into:
      • Procedure Oriented Programming (POP)
      • Object Oriented Programming (OOP)
Procedure Oriented Programming (POP)
  • Defined as a programming paradigm focusing on functions or procedures rather than on data values.
  • It utilizes variables, functions, statements, and conditional operators, maintaining a structured order for statements and functions applied to data values in order to achieve a task.
  • Key Principles of POP:
    • Problems are segmented into different modules called functions.
    • Functions share global data; data can move freely from function to function.
Illustration of Procedure Oriented Programming
  • Data values can flow freely between functions without restriction, leading to potential complications in advanced programming scenarios.
Limitations of Procedure Oriented Programming
  • No restrictions on data values: This can complicate debugging.
  • Lack of reusability: This results in increased programming time, testing, and length of code.
  • Examples of Procedure Oriented languages include BASIC, COBOL, FORTRAN, SL-1, PL-1, C, etc.

Object Oriented Programming (OOP)
  • Developed to address POP's shortcomings by focusing on data values over functions.
  • In OOP, data is encapsulated and used within a specified area, limiting accessibility.
Illustration of Object Oriented Programming
  • Objects in OOP are segments of code with contained data values, accessible only by their associated functions.
  • This segmentation enhances data security by preventing direct access from other objects.
Advantages of Object Oriented Programming
  • Data Security: Data values are well protected.
  • Error Management: Makes error detection and correction simpler.
  • Complex Coding: Facilitates easier handling of complex programs.
  • Notable Object Oriented languages include Java, C++, Small Talk, Eiffel, and Python.

Principles of Object Oriented Programming (OOP)

Once OOP programs are created using diverse objects, the following principles are integrated:

1. Data Abstraction
  • Definition: Data Abstraction is the concept of conveying essential features without delving into implementation specifics.
  • Example: Operating a car involves using controls like steering or brakes without needing to understand their design.
  • Reduces complexity by hiding unnecessary details.
2. Encapsulation
  • Definition: Encapsulation involves bundling data and functions together in a manner that restricts direct access to some components.
  • Data can only be accessed through functions linked to that data, supporting data security.
  • Data Hiding: A subset of encapsulation that prevents data access outside the object itself.
Differences between Data Hiding and Encapsulation
  • Data Hiding: Focuses on data security; ensures restricted access.
  • Encapsulation: More about wrapping data and methods to reduce system complexity.
3. Inheritance
  • Definition: Inheritance is a mechanism allowing one class to inherit features from another.
  • The class being inherited is known as the Superclass or Base Class, and the one inheriting is called Subclass, Derived Class, or Target.
  • Class: A blueprint describing data members and member functions for operations.
  • Example Illustration:
    • Mensuration class (Base class) shares features with Two Dimensional and Three Dimensional derived classes to calculate geometrical properties.
4. Polymorphism
  • Definition: Polymorphism allows a single function to perform various operations depending on the context.
  • Example: The term "cell" has different meanings in different disciplines (Physics, Biology).
  • In programming, polymorphism enables a function to handle multiple tasks, enhancing code flexibility and reusability.

Chapter at a Glance
  • Classification of high-level languages into Procedure Oriented and Object Oriented languages.
  • Examples of Procedure Oriented languages: COBOL, BASIC, etc.
  • Examples of Object Oriented languages: C++, Java, Python, etc.
  • Differences in data handling:
    • Procedure Oriented programming allows free flow of data values; Object Oriented programming secures them.
  • Four fundamental principles of OOP:
    • Data Abstraction, Encapsulation, Inheritance, and Polymorphism.
  • Everyday examples linking real life to programming concepts: Taking photographs illustrates Data Abstraction; Polymorphism provides functional versatility across elements.