Kategóriák: Minden - encapsulation - abstraction - inheritance - polymorphism

a Muhd Anas 4 éve

248

Chapter 1: Introduction To Object-Oriented Programming

Object-oriented programming (OOP) is a programming paradigm that uses objects and classes to structure software in a way that is both modular and reusable. Key features of OOP include data abstraction, which focuses on representing only essential details; polymorphism, allowing objects to take multiple forms; inheritance, enabling one class to derive properties from another; and encapsulation, which bundles data and methods into a single unit.

Chapter 1: Introduction
To
 Object-Oriented Programming

Chapter 1: Introduction To Object-Oriented Programming

Procedural Programming

Defiinition:Procedural programming is a programming paradigm, derived from structured programming, based on the concept of the procedure call.
C
Pascal
BASIC
COBOL
ALGOL
Fortran

Unified Modelling Language (UML)

Provides you with a way to create and document a model of a system.
Is a graphical language designed to capture the artifacts of an OOAD process.

Features

Polymorphism - Refers to the ability of an object to take on many form. Eg: buttons on remote control
Inheritance - Refers to the concept by which one class derives the properties of another class
Encapsulation - Refers to the mechanism of wrapping up of data and methods (that operate on the data) into a single unit (class)
Data Abstraction - Refers to the concept of representing only the essential features of a data without including the non-essential details

Programming Techniques

Types
Object-Oriented Approach & Design (OOAD)

A combination of both OOA and OOD.

Disadvantages

Does not lead to successful reuse on a large scale without an explicit reuse procedure

Most of our project development teams are familiar with traditional analysis & design

Hard to determine all the necessary classes and objects required for a system

Advantages

Improves the quality of the system due to program reuse

Reduced development time & cost

Provides re-usability

Easy to maintain

Easy to understand

Object-Oriented Design (OOD)

Tasks Inclue:

Implementation of associations

Implementation of control

Implementation of methods

Restructuring the class data

A process of defining the components, interfaces, objects, classes, attributes, and operations that will satisfy the requirements.

Object-Oriented Approach (OOA)

Tasks Include:

Describing how the objects interact

Defining the behaviour/ function of the objects

Defining the object attributes

Organizing the objects

Identifying objects

A process of defining the problem in terms of real-world objects with which the system must interact.

Examples
Swift
Perl
PHP
Ruby
C#
C++
Python
Javascript
Java

Concept & Terminologies

Classes & Objects
Object - An instance of a class
Class - A template or blueprint to create an object
Object, Attribute, Behaviour
Behavior – operation or function that an object can perform
Attributes - data value or a state that describes an object and helps you to tell one object from another of the same class
Objects - an instance or specific example of a class