Sie sind auf Seite 1von 15

PROGRAMMING PARADIGM

1. Procedural Programming Style of Programming in which the programming task is broken down into a series of operations (called procedures) applied to data (or data structures)

C and Pascal

2. Object-Oriented Programming

Extension of procedural programming

Breaks down a programing task into a series of interactions among different entities or objects

Java, C++, and Smalltalk

OBJECT ORIENTED
PROGRAMMING
Type of programming in which programmers define not only the data stuctures, but also the types of operations (methods) that can be applied to the data stuctures.

Enables programmers to create modules that do not need to be changed when a new type of object is added.

Most widely used paradigm

Instead of focusing on what the system has to do, focus on:


what objects the system contains

how they interact towards solving the programming problem

ILLUSTRATION OF OOP

OBJECT ORIENTED
PROGRAMMING
Advantages of OOP over Conventional Approaches: it provides a clear modular structure for programs which makes it good for defining abstract data types where implementation details are hidden and the unit has a clearly defined interface.

it makes it easy to maintain and modify existing code as new objects can be created with small differences from existing ones.

it provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.

OBJECT ORIENTED
PROGRAMMING

Key OOP Concepts:

Objects Classes Abstraction Inheritance Encapsulation Polymorphism

OBJECT AND CLASSES


Objects

Represent things from the real world Made up of Attributes characteristics that define an object Methods self-contained block of program code similar to procedure

Example: A cars attributes are make, model, year, & purchase price

A cars methods are forward and backward

Classes
Term that describes a group or collection of objects with common properties Define a type of object

Specifies methods and data that type of objects has

Example: Employee

Car

ABSTRACTION
Allows a programmer to hide all but the relevant information (to the problem at hand) about an object in order to reduce complexity and increase efficiency

Closely related to encapsulation and information hiding

ENCAPSULATION
refers to the hiding of data (attributes) and methods within an object

protects an objects data from corruption

protects the objects data from arbitrary and unintended use

hides the details of an objects internal implementation from the users of an object

separates how an object behaves from how it is implemented.

easier to modify programs since one object type is modified at a time.

ILLUSTRATION OF ENCAPSULATION

INHERITANCE
the process by which objects can acquire (inherit) the properties of an ojects of other class

Provides

reusability, like adding additional features to an existing class without modfying it.

INHERITANCE

POLYMORPHISM
refers to the ability to process objects differently depending on their data type or class

the ability to redefine methods for derived classes

request for an operation can be made without knowing which specific method should be invoked

POLYMORPHISM

ABSTRACT CLASSES
Class

that is not used to creare (instantiate) objects

designed to act as a base class (to be inherited by other classes)

design concept in program development and provides a base upon which other classes are built.

can only specify members that shoukd be implemented by all inheriting classes

INTERFACES
Allow

you to create definitions for component interaction

provide another way of implementing polymorphism

specify methods that a component must implement without actually specifying how the method is implemented

Das könnte Ihnen auch gefallen