understanding oops by software outsourcing company india

9
iFour Consultancy Basics of OOPS

Upload: jignesh-aakoliya

Post on 13-Jan-2017

33 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Understanding OOPS by software outsourcing company india

iFour Consultancy

Basics of OOPS

Page 2: Understanding OOPS by software outsourcing company india

Definition

Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than “logic”. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.

For a programming language to be a true OOP language, the language must meet the following criteria:

Abstraction, Encapsulation, Polymorphism Inheritance

•A markup language is a set of markup tags •A markup language is a set of markup tags

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 3: Understanding OOPS by software outsourcing company india

FundamentalsClasses and ObjectsThe terms class and object are sometimes used interchangeably, but in fact, classes describe the type of objects, while objects are usable instances of classes. So, the act of creating an object is called instantiation. Using the blueprint analogy, a class is a blueprint, and an object is a building made from that blueprint.

AbstractionAbstraction manages the complexities of a business problem by allowing you to identify a set of objects involved with that business problem.

EncapsulationEncapsulation hides the internal implementation of an abstraction within the particular object.

PolymorphismPolymorphism provides for multiple implementations of the same method. For example, different objects can have a Save method, each of which perform different processing.

InheritanceThe excitement of Visual Basic .NET lies in inheritance. Visual Basic 5 introduced the concept of interface inheritance, which allows you to reuse the interface of a class, but not its implementation. Visual Basic .NET provides for true implementation inheritance whereby you can reuse the implementation of a class.

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 4: Understanding OOPS by software outsourcing company india

What is a class?

A class can be defined as a template/blueprint that describes the behaviors/states that object of its type support.

Example of Simple Class with member properties and member methods.public class Circle{ private decimal _radius;

public double radius {get{return _radius;} set{_radius = values} }

public double Area(){ return 3.141592 * _radius * _radius;}

}

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 5: Understanding OOPS by software outsourcing company india

An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.

Example of Simple instantiate of an object of the class in the example of previous slides.

Circle objCircle = new Circle(); //here objCirlcle is an instance of a class Circle objCir = new Circle(); //here objCir is an instance of a class

Both the instantiation(Objects) holds the related data and members of the class and can be used for different purposes.

What is Object?

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 6: Understanding OOPS by software outsourcing company india

Encapsulation

• Encapsulation is defined as hiding irrelevant data from the user.• A class may contain much information that is not useful for an outside class or

interface.• So classes use encapsulation to hide its members that are not relevant for an

outside class or interface.• Encapsulation can be done using access specifiers.

In the same example of Circle class “Private” is a specifier used for Member variable. So It hides the data to be used outside the class:

private decimal _radius;

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 7: Understanding OOPS by software outsourcing company india

Use in the small, when a derived class "is-a" base classenables code reuseenables design reuse & polymorphic programming

Example:a Student is-a Person

Inheritance

Undergraduate

Person

Student Employee

Graduate Staff Faculty

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 8: Understanding OOPS by software outsourcing company india

• It is a methodology to write the program where we specify the code in form of classes and objects.

• Object-oriented programming is the successor of procedural (structural) programming. Procedural programming describes programs as groups of reusable code units (procedures) which define input and output parameters. Procedural programs consist of procedures, which invoke each other.

• The problem with procedural programming is that code reusability is hard and limited – only procedures can be reused and it is hard to make them generic and flexible. There is no easy way to work with abstract data structures with different implementations.

• This is how objects came to be. They describe characteristics (properties) and behavior (methods) of such real life entities.

Procedure v/s Object Oriented Programming

Custom eCommerce Developershttp://www.ifourtechnolab.com

Page 9: Understanding OOPS by software outsourcing company india

Thank you

Software development company indiahttp://www.ifourtechnolab.com