Share to: share facebook share twitter share wa share telegram print page

Code reuse

In software development (and computer programming in general), code reuse, also called software reuse, is the use of existing software, or software knowledge, to build new software,[1][2]: 7  following the reusability principles.

Code reuse may be achieved by different ways depending on a complexity of a programming language chosen and range from a lower-level approaches like code copy-pasting (e.g. via snippets),[3] simple functions (procedures or subroutines) or a bunch of objects or functions organized into modules (e.g. libraries)[4][2]: 7  or custom namespaces, and packages, frameworks or software suites in higher-levels.

Code reuse implies dependencies which can make code maintainability harder.[citation needed] At least one study found that code reuse at the class level reduces technical debt.[5]

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 aims to save time and resources and reduce redundancy by taking advantage of assets that have already been created in some form within the software product development process.[6] The key idea in reuse is that parts of a computer program written at one time can be or should be used in the construction of other programs written at a later time.

Code reuse may imply the creation of a separately maintained version of the reusable assets. While code is the most common resource selected for reuse, other assets generated during the development cycle may offer opportunities for reuse: software components, test suites, designs, documentation, and so on.[7]

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, also known as 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.

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.[8] 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:[9]

  • 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.[9]

Systematic

Systematic software reuse is a strategy for increasing productivity and improving the quality of 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 need to be addressed related to systematic software reuse are:[10]

  • a clear and well-defined product vision is an essential foundation to a software product line (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.

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.[11]

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[citation needed].

Higher-order function

In functional programming higher-order functions can be used in many cases where design patterns or frameworks were formerly used.

Retrocomputing

Retrocomputing encompasses reuse of code, simply because retro programs are being run on older computers, or emulators for them.

Computer security

In computer security code-reuse is employed as a software exploit method.[12] When an attacker is not able to directly input code to modify the control flow of a program, for example in presence of code injection defenses such as W^X, he or she can redirect the control flow to code sequences existing in memory.

Examples of code-reuse attacks are return-to-libc attack, return-oriented programming, and jump-oriented programming.[12][13]

Components

A component, in an object-oriented extent, represents a set of collaborative classes (or only one class) and its interfaces. The interfaces are responsible for enabling the replacement of components. Reusable components can also be isolated and synchronized between SCM repositories using component source code management technologies (CSCM).[citation needed]

Outside computers

The whole concept of "code reuse" can also encompass engineering applications outside software. For instance, parametric modeling in computer-aided design allows for creating reusable designs. Standardization results in creation of interoperable parts that can be then reused in many contexts.[citation needed]

Criticism

Code reuse results in dependency on the component being reused. Rob Pike opined that "A little copying is better than a little dependency". When he joined Google, the company was putting heavy emphasis on code reuse. He believes that Google's codebase still suffers from results of that former policy in terms of compilation speed and maintainability.[14]

Reusable code requires usually more effort to write and design. Fred Brooks discusses the significantly higher cost associated with that effort in his essays "The Tar Pit" and "No Silver Bullet" The fallacy is that effort is often spent without careful understanding of the mechanisms through which that cost will be redeemed. The justification often comes from incorrectly drawing parallels to reusable parts in a physical manufacturing process. Incorrect because writing code is analogous to design of a single product rather than production of multiple units.

See also

References

  1. ^ Frakes, W.B.; Kyo Kang (July 2005). "Software Reuse Research: Status and Future". IEEE Transactions on Software Engineering. 31 (7): 529–536. CiteSeerX 10.1.1.75.635. doi:10.1109/TSE.2005.85. S2CID 14561810.
  2. ^ a b Reddy, Martin (2011). API design for C++. Boston: Morgan Kaufmann. ISBN 978-0-12-385004-1. OCLC 704559821.
  3. ^ Selaolo, Karabo; Hlomani, Hlomani (2016). "Towards An Algorithms Ontology Cluster: for Modular Code Reuse and Polyglot Programming". Advances in Computer Science. 5: 63 – via Researchgate.
  4. ^ "4. Code Reuse: Functions and Modules - Head First Python, 2nd Edition [Book]". www.oreilly.com. Retrieved 2022-01-26.
  5. ^ Feitosa, Daniel; Ampatzoglou, Apostolos; Gkortzis, Antonios; Bibi, Stamatia; Chatzigeorgiou, Alexander (September 2020). "CODE reuse in practice: Benefiting or harming technical debt" (PDF). Journal of Systems and Software. 167: 110618. doi:10.1016/j.jss.2020.110618. S2CID 219502749.
  6. ^ Lombard Hill Group. "What Is Software Reuse?". lombardhill.com. Lombard Hill Group. Archived from the original on 23 January 2019. Retrieved 22 October 2014.
  7. ^ Lombard Hill Group. "What Is Software Reuse?". Archived from the original on 23 January 2019. Retrieved 22 October 2014.
  8. ^ McConnell, Steve (1996). Rapid Development: Taming Wild Software Schedules. Pearson Education. ISBN 978-1-55615-900-8.
  9. ^ a b Colombo, F. (2011). "It's not just reuse". SharedNow.blogspot.
  10. ^ Champman, M.; Van der Merwe, Alta (2008). "Contemplating Systematic Software Reuse in a Small Project-centric Company". Proceeding SAICSIT '08 Proceedings of the 2008 annual research conference of the South African Institute of Computer Scientists and Information Technologists on IT research in developing countries: riding the wave of technology. doi:10.1145/1456659.1456662. ISBN 978-1-60558-286-3.
  11. ^ "Code reuse". DocForge. Archived from the original on 2011-07-10. Retrieved 22 November 2024.
  12. ^ a b Bletsch, Tyler (2011). Code-reuse Attacks: New Frontiers and Defenses. North Carolina State University. ISBN 978-1-124-75297-6.
  13. ^ Bletsch, Tyler; Jiang, Xuxian; Freeh, Vince W; Liang, Zhenkai (2011). "Jump-oriented programming: a new class of code-reuse attack" (PDF). Proceedings of the 6th ACM Symposium on Information, Computer and Communications Security. ACM. pp. 30–40. doi:10.1145/1966913.1966919. ISBN 978-1-4503-0564-8. Archived from the original (PDF) on 2017-08-07. Retrieved 2017-08-07.
  14. ^ The Go Programming Language (2015-12-01), Go Proverbs – Rob Pike – Gopherfest – November 18, 2015, archived from the original on 2021-12-22, retrieved 26 February 2016

Read other articles:

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada Desember 2022. Teori sistem ketergantungan media (bahasa Inggris: media system dependency theory) dikembangkan oleh Sandra Ball Rokeach dan Melvin Defleur pada tahun 1976.[1] Teori ini berlandaskan pada sebuah dasar literatur sosiologi klasik dimana medi...

 

Nicole Trunfio Información personalNacimiento 16 de marzo de 1986 (37 años)Merredin (Australia) Nacionalidad Australiana e italianaCaracterísticas físicasAltura 1,78 m Ojos Avellana Cabello Castaño FamiliaCónyuge Gary Clark Jr. (matr. 2016)Hijos 3EducaciónEducada en Australind Senior High School Información profesionalOcupación Modelo y actriz Sitio web www.nicoletrunfio.net [editar datos en Wikidata]Nicole Trunfio (16 de marzo de 1986) es una modelo, y actriz...

 

Ministry of State in India Channi ministryMinistry of PunjabDate formed20 September 2021Date dissolved11 March 2022People and organisationsHead of stateGovernor Banwarilal PurohitHead of governmentCharanjit Singh ChanniDeputy head of government Om Parkash Soni Sukhjinder Singh Randhawa No. of ministers18Ministers removed1Total no. of members17Member partiesINCStatus in legislature2/3rd MajorityOpposition leaderHarpal Singh Cheema, Aam Aadmi PartyHistoryElection(s)2017Outgoing election2017Legi...

Đối với các định nghĩa khác, xem Hương Sơn (định hướng). Hương Sơn Thị trấn Thị trấn Hương Sơn Trung tâm thị trấn Hương SơnHành chínhQuốc gia Việt NamVùngĐông Bắc BộTỉnhThái NguyênHuyệnPhú BìnhThành lập13/6/2003[1]Địa lýTọa độ: 21°27′41″B 105°58′44″Đ / 21,4614°B 105,9789°Đ / 21.4614; 105.9789 Hương Sơn Vị trí thị trấn Hương Sơn trên bản đồ Việt Nam Di�...

 

2018 Little Rock mayoral election ← 2014 November 6, 2018 (first round)[1]December 4, 2018 (second round)[2] 2022 →   Candidate Frank Scott Jr. Baker Kurrus Warwick Sabin Party Nonpartisan Nonpartisan Nonpartisan First-round vote 25,146 19,668 19,157 First-round percentage 37.10% 29.02% 28.26% Second-round vote 22,668 16,333 Second-round percentage 58.12% 41.88% Mayor before election Mark Stodola Democratic Elected Mayor Frank Scott Jr. Democratic El...

 

أمير مصرThe Prince of Egyptمعلومات عامةالتصنيف فيلم رسوم متحركة الصنف الفني ملحمي، موسيقي، تاريخ، دراماالمواضيع عبودية — تيه تاريخ الصدور 1998مدة العرض 98 دقيقةاللغة الأصلية الإنجليزية والعبريةمأخوذ عن سفر الخروج البلد الولايات المتحدةموقع الويب dreamworks.com… (الإنجليزية) الطاقمالم�...

Head of government of Slovenia President of the Government of the Republic of SloveniaPredsednik Vlade Republike SlovenijeFlag of SloveniaIncumbentRobert Golobsince 1 June 2022[1]Government of SloveniaOffice of the Prime MinisterStyleMr Prime Minister (formal)President of the Government(Slovene: Gospod predsednik vlade)Mr President (informal)(Slovene: Gospod predsednik)His Excellency (diplomatic)(Slovene: Njegova ekscelenca)TypeHead of governmentMember ofGovernment of SloveniaEur...

 

Species of mammal Ratel redirects here. For other uses, see Honey Badger (disambiguation) and Ratel (disambiguation). Honey badgerTemporal range: middle Pliocene – Recent In Kruger National Park, South Africa Conservation status Least Concern (IUCN 3.1)[1] Scientific classification Domain: Eukaryota Kingdom: Animalia Phylum: Chordata Class: Mammalia Order: Carnivora Family: Mustelidae Subfamily: Mellivorinae Genus: Mellivora Species: M. capensis Binomial name Mellivora cap...

 

1997 Indian filmDevuduTheatrical release posterDirected byRavi Raja PinisettyWritten byG. Satyamurthy (dialogues)Screenplay byRavi Raja PinisettyStory byJanardhan MaharshiProduced byA. GopinathM. VenkatraoC. Krishna RaoStarringNandamuri BalakrishnaRamya KrishnaRuchitha PrasadCinematographyV. S. R. SwamyEdited bySivaKrishna MurthyMusic bySirpyProductioncompanySri Chitra CreationsRelease date 23 October 1997 (1997-10-23) Running time157 minutesCountryIndiaLanguageTelugu Devudu (t...

Zoo in Coloane, Macau, China Macao Giant Panda Pavilion澳門大熊貓館Pavilhão do Panda Gigante de Macau22°7′35.9″N 113°33′32.3″E / 22.126639°N 113.558972°E / 22.126639; 113.558972LocationColoane, Macau, ChinaLand area3,000 m2WebsiteOfficial website Macao Giant Panda PavilionChinese nameTraditional Chinese澳門大熊貓館Simplified Chinese澳门大熊猫馆TranscriptionsStandard MandarinHanyu PinyinÀomén DàxióngmāoguǎnYue: CantoneseJyutping...

 

List of countries ranked by ethnic and cultural diversity level. List based on Fearon's analysis This article contains lists of countries ranked by ethnic and cultural diversity level. Methodology The lists are commonly used in economics literature to compare the levels of ethnic, cultural, linguistic and religious fractionalization in different countries.[1][2] Fractionalization is the probability that two individuals drawn randomly from the country's groups are not from the ...

 

King of Aragon from 1213 to 1276 James IJaime in 1265, giving orders to a guard in the royal palaceKing of AragonCount of BarcelonaReign12 September 1213 – 27 July 1276PredecessorPeter IISuccessorPeter IIIBorn2 February 1208MontpellierDied27 July 1276 (aged 68)Alzira, ValenciaBurialPoblet MonasterySpouses Eleanor of Castile Violant of Hungary Teresa Gil de Vidaure Issueamong others... Violant, Queen of Castile Constance, Lady of Villena Peter III, King of Aragon James II, King of Majorca Is...

2018 film by Sriram Raghavan AndhadhunTheatrical release posterDirected bySriram RaghavanWritten bySriram RaghavanHemanth M. RaoPooja Ladha SurtiArijit BiswasYogesh ChandekarProduced bySudhanshu VatsAjit AndhareGaurav NandaAshok VasodiaKewal GargSanjay RoutrayStarringTabuAyushmann KhurranaRadhika ApteAnil DhawanCinematographyK. U. MohananEdited byPooja Ladha SurtiMusic byScore:Daniel B. GeorgeSongs:Amit TrivediGuest Composers:RaftaarGirish NakodProductioncompaniesViacom 18 Motion PicturesMatc...

 

Japanese volleyball player In this Japanese name, the surname is Araki. Erika ArakiPersonal informationNicknameEricaBorn (1984-08-03) 3 August 1984 (age 39)Kurashiki, Okayama, JapanHeight1.86 m (6 ft 1 in)Weight78 kg (172 lb)Spike318 cm (125 in)Block312 cm (123 in)Volleyball informationPositionMiddle blockerNumber11 (2008-2010, 2016-2020)5 (2012)Career YearsTeams 2003–20082008–20092009–20132014–20162016–2021 Toray Arrows Foppapedrett...

 

Church in Paisley, Scotland Church in Renfrewshire, ScotlandPaisley AbbeyPaisley Abbey and groundsLocationAbbey ClosePaisley, RenfrewshireCountryScotlandDenominationChurch of ScotlandPrevious denominationRoman CatholicWebsitewww.paisleyabbey.org.ukHistoryStatusParish kirkArchitectureFunctional statusActiveHeritage designationCategory ADesignated1971[1]Architectural typeChurchYears built7th century1163AdministrationPresbyteryClydeClergyMinister(s)Reverend Jim GibsonLaityDirector of mus...

1932 book of poetry by Muhammad Iqbal The Javid Nama (Persian: جاوید نامہ), or Book of Eternity, is a Persian book of poetry written by Muhammad Iqbal and published in 1932. It is considered to be one of the masterpieces of Iqbal. It is inspired by Dante Alighieri's Divine Comedy, and just as Dante's guide was Virgil, Iqbal is guided by Maulana Rumi. Both of them visit different spheres in the heavens coming across different people. Iqbal uses the pseudonym Zinda Rud for himself in t...

 

Indonesian singer This biography of a living person needs additional citations for verification. Please help by adding reliable sources. Contentious material about living persons that is unsourced or poorly sourced must be removed immediately from the article and its talk page, especially if potentially libelous.Find sources: Nikita Willy – news · newspapers · books · scholar · JSTOR (December 2021) (Learn how and when to remove this template message) ...

 

Als Männerrechtsbewegung (englisch men’s rights movement, MRM) wird eine in den 1970er Jahren in Nordamerika aus einem Flügel der so genannten Men’s Liberation Männerbewegung entstandene Strömung bezeichnet. Während die Men’s Liberation-Bewegung profeministisch eingestellt ist, vertritt die Männerrechtsbewegung antifeministische bis frauenfeindliche Positionen. Sie wird größtenteils als Gegenreaktion zum Feminismus aufgefasst.[1][2][3][4] Der Pers...

New Zealand politician Ian Ewen-StreetMember of the New Zealand Parliamentfor Green Party listIn office27 November 1999 – 2005 Personal detailsBorn1949 (age 73–74)Political partyGreen Party (until 2006) National Party (2006-) Ian Ewen-Street (born 1949) is a New Zealand politician. He was a member of the Green Party and a Member of the New Zealand Parliament for the Greens from 1999 to 2005. He has been prominent in advocacy for organic farming, organic gardening and bio...

 

PacketTrap Networks, Inc.TypePrivateIndustryComputer softwareFounded2006Defunct2013HeadquartersSan Francisco, California, USProductsPacketTrap MSP, PacketTrap PSA, Quest Free Network Tools (formerly pt360) PacketTrap Networks, Inc., later known as just PacketTrap, was a provider of network management and traffic analysis software for midsize companies. History PacketTrap was founded in 2006 and headquartered in San Francisco, California. It received $5 million in Series A venture capital from...

 
Kembali kehalaman sebelumnya