very short oop introduction

13
OOP Introduction Cristian Gherghinescu

Upload: cristian-g

Post on 14-Apr-2017

311 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Very short OOP Introduction

OOP IntroductionCristian Gherghinescu

Page 2: Very short OOP Introduction

“Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods.”

Wikipedia (source of all truth)

Page 3: Very short OOP Introduction

Main Selling points

Increase reusability and maintainability

Manage complex systems

Page 4: Very short OOP Introduction

Abstraction

Encapsulation

Inheritance

Polymorphism

Page 5: Very short OOP Introduction

Abstraction

Grouping the common behaviors

Representing essential features without including the background details or explanations

Hide the implementation

Page 6: Very short OOP Introduction

Encapsulation

Separate the contractual interface of an abstraction and its implementation

Allows an object’s behavior to be used without knowing its implementation (“black box”)

Packaging structure and behavior together in one unit - Makes objects more independent

Changes can be done to the behavior implementation without affecting other objects

Page 7: Very short OOP Introduction
Page 8: Very short OOP Introduction

Inheritance

“Is-a” relationship

Subclass reuses code from the base class (could also override behaviour)

Favor composition (has-a) over inheritance

Page 9: Very short OOP Introduction
Page 10: Very short OOP Introduction

Polymorphism

One name, many forms.

2 basic types of polymorphism:

Overridding - run-time polymorphismOverloading - compile-time polymorphism.

Page 11: Very short OOP Introduction
Page 12: Very short OOP Introduction
Page 13: Very short OOP Introduction

Thank you !