<<

REUSABILITY AND IN OBJECT ORIENTED LANGUAGES Suvarnalata Hiremath1, C M Tavade2 1Associate Professor, Dept. of CS&E, BKEC, Basavakalyan, India, 2 Professor, Dept of E&TC, SIT-COE, Yadrav, India

Abstract In object-oriented languages, inheritance plays an important part for and maintainability. The separation of sub typing and inheritance makes inheritance a more flexible mechanism reusing code. Object-oriented programming has been widely acclaimed as the technology that will support the creation of reusable software, particularly because of the "inheritance” facility. In this paper, we Object Oriented Programming is a practical and explore the importance of reusability and useful programming methodology that maintainability in object oriented language. encourages modular design and software reuse. KEYWORDS: Object Oriented Object oriented Language make the promises of programming Language, Inheritance, reduced maintainance,code reusability, Software reuse and maintainability. improved reliability and flexibility and easier through better data encapsulation. I. INTRODUCTION To achieve these gains, object oriented Object-Oriented Programming (OOP) is the term language introduce the concepts of objects, used to describe a programming approach based classes, data abstraction and encapsulation, on objects and classes. The object-oriented inheritance and polymorphism. paradigm allows us to organise software as a collection of objects that consist of both data and In object oriented Language, the objects are behaviour. This is in contrast to conventional well-defined data structures coupled with a set practice that only of operations, these operations are called loosely connects data and behaviour. behavior and are only visible part of an object The object-oriented programming approach and only these operations can manipulate the encourages: objects. Each object itself is an instance of one • Modularisation: where the application class and is represented by a collection of can be decomposed into modules. instance variables, as defined by the class [1]. • Software re-use: where an application Each class also defines a set of named can be composed from existing and new operations called methods.A method defines the modules. behaviour of the objects that are created from the class. Object Oriented programming is a programming style that is associated with the concept of Class, Inheritance is a technique that allows new class Objects and various other concepts revolving from older. The new class is subclass and old around these two, like Inheritance, class is base/parent class. The subclass inherits Polymorphism, Abstraction, Encapsulation etc. all features of parent class. The subclass can add new features of their own in it. Inheritance

ISSN (PRINT): 2393-8374, (ONLINE): 2394-0697, VOLUME-5, ISSUE-12, 2018 100

INTERNATIONAL JOURNAL OF CURRENT ENGINEERING AND SCIENTIFIC RESEARCH (IJCESR) is used in several different ways. A subclass and deliver on this promise is an interesting, open can be modified to provide different or question. additional behaviour from its super class. Multiple inheritance allows for a class to Parul Gandhi Pradeep Kumar Bhatia[4] inherit traits from multiple classes and is Object-oriented metrics plays an import role in usually considered a dangerous design ensuring the desired quality and have widely mechanism. been applied to practical software projects. The benefits of object-oriented software II Literature Survey development increasing leading to development As per the literature survey there has been of new measurement techniques. Assessing the a lot of research done on reusability and reusability is more and more of a necessity. maintainability in object oriented language over Reusability is the key element to reduce the cost the years. and improve the quality of the software. helps us to achieve the Li XuanDong and Zheng GuoLiang[1] In concept of reusability through C++ Templates object-oriented languages, encapsulation and in- which helps in developing reusable software heritance play an important part for software modules and also identify effectiveness of this reusability and maintainability. The separation of reuse strategy sub typing and inheritance makes inheritance a more flexible mechanism reusing code. The main The advantage of defining metrics for templates enhanced flexibility is that it is allowed for is the possibility to measure the reusability of subclasses to redefine inherited methods to software and to identify the most change their specifications. However, it results in effective reuse strategy. The need for such an encapsulation issue derived from the metrics is particularly useful when an semantics of inheritance, which compromises organization is adopting a new technology, for severely reusability and maintainability in object- which established practices have yet to be oriented languages. In this paper, we present a developed. Many researchers have done modified inheritance mechanism, which research on reusability metrics overcomes this encapsulation issue, and give its denotation semantics. This modified in- heritance Alan Snyder[5] Object-oriented programming mechanism has been introduced in NDOOP, an is a practical and useful programming object-oriented extension of Pascal we are methodology that encourages modular design developing. and software reuse. Most object-oriented programming languages support data G. Butler L. Li I.A. Tjandra[2] Abstraction by preventing an object from being is a difficult creative task learnt from long manipulated except via its defined external experience. Reusable object-oriented design aims operations. In most languages, however, the to describe and classify designs and design introduction of inheritance severely fragments so that designers may learn from other compromises the benefits of this encapsulation. peoples' experience. Thus, it provides leverage Furthermore, the use of inheritance itself is for the design process. globally visible in most languages, so that changes to the inheritance hierarchy cannot be Shuguang Hong Barbara Koelzer[3] Software made safely. This paper examines the reusability has been regarded as one of the most relationship between inheritance and important areas for improving software encapsulation and develops requirements for development full support of encapsulation with inheritance. productivity and quality in the 1990's. The object-oriented approach to information systems 1.1 Outcome of the literature survey development has promised to achieve large-scale As per above papers we conclude that work software reuse. Object oriented analysis and done on the inheritance features to maintain design methodologies have aimed at the more flexible mechanism for reusing code realization of the promised benefits; however, the and encourages maintainability in object degree to which the methodologies support reuse orientation languages.

ISSN (PRINT): 2393-8374, (ONLINE): 2394-0697, VOLUME-5, ISSUE-12, 2018 101

INTERNATIONAL JOURNAL OF CURRENT ENGINEERING AND SCIENTIFIC RESEARCH (IJCESR) 1.2 Objective This helps in to use the same code over and The main objective of this work is to examine again without writing it multiple times which the duplicate and to avoid duplication and to saves time, coding effort and code reduction. capture commonality in undertaking classes of inherently similar task . Code that is organized IV. Working with Reusability and so that it is easy to find and fix errors and to Maintainability in OOL improve performance. Set of programming The object orientation programming languages idioms with other programmer which improves classes can be reused in several ways. Once a communications. class has been written and tested, it can be adapted by another programmer to suit their III. Need of Reusability in OOL requirements. This is basically done by creating One of the promises which object new classes, reusing the properties of the oriented languages holds is that it enhances existing ones. The mechanism of deriving a new software reusability. Indeed, software class from an old one is called inheritance. The components designed in Object oriented old class is referred to as the base class and the languages are easier to be reused than those new one is called the derived class or subclass. designed in conventional programming. A derived class includes all features of the generic base class and then adds qualities The first thing here we discuss about is Code specific to the derived class. Reuse. is probably one of the most important part why we use Object Oriented Re is when a class inherits or Programming languages in general. derives another class, it can access all the functionality of the inherited class. The concept itself looks very easy. You have • . written a class and some parts of your class like Re usability enhanced reliability The base class code will be already some Methods or Attributes should be reused in tested and debugged. another class • Re usability saves the

. Reusability is not an OOP term, it is about programmer time and effort • As the existing code is reused, it reusing existing code to solve problems. This leads to way you don’t have to write the same thing less development and twice. Writing the same code twice obviously maintenance costs. means that you will spend more time on writing Class Department code, but it has another disadvantage. If you want to modify the code, for example fix a bug in the algorithm or extend it with a new Createstudents() parameter, then you have to modify it in two or Averagemarks() more different locations. Which means even more typing, and more opportunity to add new Class bugs to the code. So reusability is a must if you Class Class SectionC want an maintainable code. SectionA SectionB

Reusability in OOP achieves through the Using Reusability , we have to write the features of C++ where it possible to extend or functions only one time instead of three times as reuse the properties of parent class or super we have inherited rest of the three classes from class or base class in a subclass and in addition base class(Department).So ,maintainability to that, adding extra more features or data becomes easy and low cost. members in the subclass or child class or derived class. This whole set of mechanism is known as Inheritance. V. CONCLUSION In this paper we discussed how reusability and maintainability has a relationship and an important part for code reuse and also to

ISSN (PRINT): 2393-8374, (ONLINE): 2394-0697, VOLUME-5, ISSUE-12, 2018 102

INTERNATIONAL JOURNAL OF CURRENT ENGINEERING AND SCIENTIFIC RESEARCH (IJCESR) examine the duplicate and to avoid duplication [3] Open Issues in Object-Oriented and to capture commonality in undertaking Programming: OLE LEHRMANN MADSEN classes of inherently similar task On the Dept., Aarhus University, Ny Munkegade , DK- contrary, the basic idea of our work is that the 8000 Aarhus C, Denmark (e-mail: designers should know nothing about the [email protected]) implementation of a class so that they can define a class by inheritance and maintain a [4] Do We Need Inheritance?: Wolfgang Weck class correctly and easily. ETH Zürich [email protected] and Clemens Szyperski Queensland University of Technology REFERENCES [email protected] [1] A Modified Inheritance Mechanism

Enhancing Reusability and Maintainability in [5] Inheritance and development of Object-Oriented Languages Li XuanDong and Encapsulated software components: Alan Zheng GuoLiang Department of Computer Snyder. Science Nanjing University, Nanjing Jiangsu,

P.R.China 210093 [6] Inheritance and Modularity in Specification and Verification of OO Programs: Liu Yijing ; [2] Encapsulation and Inheritance in Object- Dept. of Inf., Peking Univ., Beijing, China ; Ali, Oriented Programming Languages :Alan H. ; Qiu Zongyan. Snyder

[7]Object-oriented programming concepts: Inheritance by Michelle Yaiser

ISSN (PRINT): 2393-8374, (ONLINE): 2394-0697, VOLUME-5, ISSUE-12, 2018 103