You are on page 1of 2

Object Oriented Programming (OOP) Introduction to OOP Existing programming approaches deal with Structured programming approach There

are a lot of dis-advantages to structured programming such as a) !ifficult to develop(bug-free) programs b) !ifficult to maintain the developed programs (in case of major changes to the code) c) !ifficult to develop re-usable program The latest programming paradigm is Object Oriented Programming (OOP) li"e #$$%&ava etc that overcomes the difficulties encountered in traditional languages such as #O'O(% #%P)S#)(%')S*# etc+ Few definitions Programming paradigm Paradigm means a the organi,ing principle of a program + *t is a specific wa- of thin"ing+ T-pes of programming paradigms .) Procedural programming paradigm The paradigm states !ecide which procedures -ou want and use the best algorithms -ou can find+ *n this paradigm% the emphasis is on implementing the functionalit- and not on the data To overcome this dis-advantage% we go for other approaces+ Procedural program consists of a single procedure/program in which each line executes a particular functionalit- - Eg 0eading a data or writing a data+ Primar- importance is given to the function and secondar- importance is given to the data+ 1) 2odular programming approach *n case the program becomes ver- large% we need to brea" it up into smaller units where each sub-unit can perform a specified functionalit-+ Example write a procedure to read the data % another procedure to manipulate the data - example (perform addtion% subtraction etc) on the data that has been read +write another procedure to displa- the

manipulated data !efinition of a module ) set of related procedures with the data that the- manipulate is called as a module !ecide which modules that -ou want3 partition the program so that the data is hidden in the modules - (also called as data-hiding principle) The main dis-advantage of procedural and modular programming is that the- do not model the real world entities ver- well+ 4) Object Oriented approach The netire problem is modeled in terms of objects rather than the procedure for solving the problem+ !efinition of an object Object is an identifiable entit- with certain characteristics and behavior Eg consider the object Orange #haracteristics - Spherical shaped% colour is orange (represented b- the data) 'ehavior it is juic- 3 it tastes sweet-sour (represented b- the associated funtions) *n order to model objects % we need to go for a concept called #lass+ Eg autos% scooters% lorr-% buses all such real world objects come under a general categor- or a class called 5ehicle+ Definition of a Class ) class is a group of objects that share common properties and relationships+ eg 5ehicle class !ata Properties 6o of wheels% 6o of lights% 6o of passengers% 2odel #haracteristics !riving()% Stopping()% Turning()% 'ra"ing()%Starting()

You might also like