Code reuse

Code reuse

Code reuse, also called software reuse, is the use of existing software, or software knowledge, to build new software.[1]

Contents

Overview

Ad hoc code reuse has been practiced from the earliest days of programming. Programmers have always reused sections of code, templates, functions, and procedures. Software reuse as a recognized area of study in software engineering, however, dates only from 1968 when Douglas McIlroy of Bell Laboratories proposed basing the software industry on reusable components.

Code reuse is the idea that a partial computer program written at one time can be, should be, or is being used in another program written at a later time. The reuse of programming code is a common technique which attempts to save time and energy by reducing redundant work.

The software library is a good example of code reuse. Programmers may decide to create internal abstractions so that certain parts of their program can be reused, or may create custom libraries for their own use. Some characteristics that make software more easily reusable are modularity, loose coupling, high cohesion, information hiding and separation of concerns.

For newly written code to use a piece of existing code, some kind of interface, or means of communication, must be defined. These commonly include a "call" or use of a subroutine, object, class, or prototype. In organizations, such practices are formalized and standardized by Domain_engineering aka software product line engineering.

The general practice of using a prior version of an extant program as a starting point for the next version, is also a form of code reuse.

Some so-called code "reuse" involves simply copying some or all of the code from an existing program into a new one. While organizations can realize time to market benefits for a new product with this approach, they can subsequently be saddled with many of the same code duplication problems caused by cut and paste programming.

Many researchers have worked to make reuse faster, easier, more systematic, and an integral part of the normal process of programming. These are some of the main goals behind the invention of object-oriented programming, which became one of the most common forms of formalized reuse. A somewhat later invention is generic programming.

Another, newer means is to use software "generators", programs which can create new programs of a certain type, based on a set of parameters that users choose. Fields of study about such systems are generative programming and metaprogramming.

Types of reuse

Concerning motivation and driving factors, reuse can be:

  • Opportunistic - While getting ready to begin a project, the team realizes that there are existing components that they can reuse.
  • Planned - A team strategically designs components so that they'll be reusable in future projects.

Opportunistic reuse can be categorized further:

  • Internal reuse - A team reuses its own components. This may be a business decision, since the team may want to control a component critical to the project.
  • External reuse - A team may choose to license a third-party component. Licensing a third-party component typically costs the team 1 to 20 percent of what it would cost to develop internally.[2] The team must also consider the time it takes to find, learn and integrate the component.

Concerning form or structure of reuse, code can be[3]:

  • Referenced - The client code contains a reference to reused code, and thus they have distinct life cycles and can have distinct versions.
  • Forked - The client code contains a local or private copy of the reused code, and thus they share a single life cycle and a single version.

Fork-reuse is often discouraged because it's a form of code duplication, which requires that every bug is corrected in each copy, and enhancements made to reused code need to be manually merged in every copy or they become out-of-date. However, fork-reuse can have benefits such as isolation, flexibility to change the reused code, easier packaging, deployment and version management[4].

Examples

Software libraries

A very common example of code reuse is the technique of using a software library. Many common operations, such as converting information among different well-known formats, accessing external storage, interfacing with external programs, or manipulating information (numbers, words, names, locations, dates, etc.) in common ways, are needed by many different programs. Authors of new programs can use the code in a software library to perform these tasks, instead of "re-inventing the wheel", by writing fully new code directly in a program to perform an operation. Library implementations often have the benefit of being well-tested, and covering unusual or arcane cases. Disadvantages include the inability to tweak details which may affect performance or the desired output, and the time and cost of acquiring, learning, and configuring the library.[5]

Design patterns

A design pattern is a general solution to a recurring problem. Design patterns are more conceptual than tangible and can be modified to fit the exact need. However, abstract classes and interfaces can be reused to implement certain patterns.

Frameworks

Developers generally reuse large pieces of software via third-party applications and frameworks. Though frameworks are usually domain-specific and applicable only to families of applications.

Systematic software reuse

Systematic software reuse is still the most promising strategy for increasing productivity and improving quality in the software industry. Although it is simple in concept, successful software reuse implementation is difficult in practice. A reason put forward for this is the dependence of software reuse on the context in which it is implemented. Some problematic issues that needs to be addressed related to systematic software reuse are :[6]

  • a clear and well-defined product vision is an essential foundation to an SPL.
  • an evolutionary implementation strategy would be a more pragmatic strategy for the company.
  • there exist a need for continuous management support and leadership to ensure success.
  • an appropriate organisational structure is needed to support SPL engineering.
  • the change of mindset from a project-centric company to a product-oriented company is essential.

See also

References

  1. ^ Frakes, W.B. and Kyo Kang, (2005), "Software Reuse Research: Status and Future", IEEE Transactions on Software Engineering, 31(7), July, pp. 529-536.
  2. ^ McConnell, Steve; Rapid Development: Taming Wild Software Schedules, (1996), ISBN 978-1556159008
  3. ^ Colombo, F. (2011), "It's not just reuse" - http://sharednow.blogspot.com/2011/05/its-not-just-reuse.html
  4. ^ Colombo, F. (2011), "It's not just reuse" - http://sharednow.blogspot.com/2011/05/its-not-just-reuse.html
  5. ^ "Code reuse". DocForge. http://docforge.com/wiki/Code_reuse. Retrieved 15 December 2009. 
  6. ^ Champman, M; Van der Merwe, Alta (2008), Contemplating Systematic Software Reuse in a Small Project-centric Company, Saicsit 2008, South Africa.

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Reuse — is using an item more than once. This includes conventional reuse where the item is used again for the same function, and new life reuse where it is used for a new function. In contrast, recycling is the breaking down of the used item into raw… …   Wikipedia

  • Code bloat — is the production of code that is perceived as unnecessarily long, slow, or otherwise wasteful of resources. Code bloat can be caused by inadequacies in the language in which the code is written, inadequacies in the compiler used to compile the… …   Wikipedia

  • Reuse of water bottles — Reusing water bottles is the practice of refilling and reuse of plastic or glass water bottles designed for one use, with tap water for multiple uses.Reusing single use bottles is a common domestic practice. Typically the bottle is washed out… …   Wikipedia

  • Code division multiple access — This article is about a channel access method. For the mobile phone technology referred to as CDMA, see IS 95 and CDMA2000. Multiplex techniques Circuit mode (constant bandwidth) TDM · FDM  …   Wikipedia

  • Code name — A code name or cryptonym is a word or name used clandestinely to refer to another name or word. Code names are often used for military purposes, or in espionage. They may also be used in industry to protect secret projects and the like from… …   Wikipedia

  • Code refactoring — Refactor redirects here. For the use of refactor on Wikipedia, see Wikipedia:Refactoring talk pages. Code refactoring is disciplined technique for restructuring an existing body of code, altering its internal structure without changing its… …   Wikipedia

  • reuse — 1. noun a) The act of salvaging or in some manner returning a discarded item into something usable. b) code re use indicates splitting program code into modules or classes so it can be re used by other programs. data re use refers to legal rights …   Wiktionary

  • Duplicate code — is a computer programming term for a sequence of source code that occurs more than once, either within a program or across different programs owned or maintained by the same entity. Duplicate code is generally considered undesirable for a number… …   Wikipedia

  • Source lines of code — (SLOC) is a software metric used to measure the size of a software program by counting the number of lines in the text of the program s source code. SLOC is typically used to predict the amount of effort that will be required to develop a program …   Wikipedia

  • Area code 564 — 564 is a proposed area code for the state of Washington covering all of Western Washington, including Seattle. It would be an overlay plan for the 206, 253, 360, and 425 area codes. As of April, 2008, it has not yet been implemented.In 1999, the… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”