Code Rewriting
   HOME

TheInfoList



OR:

A rewrite in
computer programming Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
is the act or result of re-implementing a large portion of existing functionality without re-use of its
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
. When the rewrite uses no existing code at all, it is common to speak of a rewrite from scratch.


Motivations

A piece of software is typically rewritten when one or more of the following apply: *its source code is not available or is only available under an incompatible
license A license (American English) or licence (Commonwealth English) is an official permission or permit to do, use, or own something (as well as the document of that permission or permit). A license is granted by a party (licensor) to another part ...
*its code cannot be adapted to a new target platform *its existing code has become too difficult to handle and extend *the task of
debugging In engineering, debugging is the process of finding the Root cause analysis, root cause, workarounds, and possible fixes for bug (engineering), bugs. For software, debugging tactics can involve interactive debugging, control flow analysis, Logf ...
it seems too complicated *the programmer finds it difficult to understand its source code *developers learn new techniques or wish to do a big feature overhaul which requires much change *the
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
of the source code has to be changed


Risks

Several software engineers, such as
Joel Spolsky Avram Joel Spolsky (; born 1965) is a software engineer and writer. He is the author of ''Joel on Software'', a blog on software development, and the creator of the project management software Trello. He was a Program Manager on the Microsoft Exc ...
have warned against total rewrites, especially under schedule constraints or competitive pressures. While developers may initially welcome the chance to correct historical design mistakes, a rewrite also discards those parts of the design that work as required. A rewrite commits the development team to deliver not just new features, but all those that exist in the previous code, while potentially introducing new bugs or regressions of previously fixed bugs. A rewrite also interferes with the tracking of unfixed bugs in the old version. The incremental rewrite is an alternative approach, in which developers gradually replace the existing code with calls into a new implementation, expanding that implementation until it fully replaces the old one. This approach avoids a broad loss of functionality during the rewrite.
Cleanroom software engineering The cleanroom software engineering process is a software development process intended to produce software with a certifiable level of reliability. The central principles are software development based on formal methods, incremental implementati ...
is another approach, which requires the team to work from an exhaustive written specification of the software's functionality, without access to its code.


Examples

Netscape Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California, and then Dulles, Virginia. Its Netscape web browser was o ...
's project to improve HTML layout in
Navigator A navigator is the person on board a ship or aircraft responsible for its navigation.Grierson, MikeAviation History—Demise of the Flight Navigator FrancoFlyers.org website, October 14, 2008. Retrieved August 31, 2014. The navigator's prim ...
4 has been cited as an example of a failed rewrite. The new layout engine (
Gecko Geckos are small, mostly carnivorous lizards that have a wide distribution, found on every continent except Antarctica. Belonging to the infraorder Gekkota, geckos are found in warm climates. They range from . Geckos are unique among lizards ...
) had developed independently of Navigator and did not integrate readily with Navigator's code; hence, Navigator itself was rewritten around the new engine, breaking many existing features and delaying release by several months. Meanwhile,
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
focused on incremental improvements to
Internet Explorer Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated as IE or MSIE) is a deprecation, retired series of graphical user interface, graphical web browsers developed by Microsoft that were u ...
and did not face the same obstacles. Ironically, Navigator itself was a successful cleanroom rewrite of
NCSA Mosaic NCSA Mosaic is a discontinued web browser. It was instrumental in popularizing the World Wide Web and the general Internet during the 1990s by integrating multimedia such as text and graphics. Although not the first web browser (preceded by Wor ...
overseen by that program's developers. See
Browser wars A browser war is a competition for dominance in the usage share of web browsers. The "first browser war" (1995–2001) occurred between proponents of Internet Explorer and Netscape Navigator, and the "second browser war" (2004–2017) between tho ...
. Some projects mentioning major rewrites in their history: *
Apache HTTP Server The Apache HTTP Server ( ) is a free and open-source software, free and open-source cross-platform web server, released under the terms of Apache License, Apache License 2.0. It is developed and maintained by a community of developers under the ...
(1) *
AOL Instant Messenger AOL Instant Messenger (AIM, sometimes stylized as aim) was an instant messaging and presence information computer program created by AOL. It used the proprietary OSCAR protocol, OSCAR instant messaging protocol and the TOC protocol to allow us ...
(1) *
BIND BIND () is a suite of software for interacting with the Domain Name System (DNS). Its most prominent component, named (pronounced ''name-dee'': , short for ''name Daemon (computing), daemon''), performs both of the main DNS server roles, acting ...
(1) *
Freenet Hyphanet (until mid-2023: Freenet) is a peer-to-peer platform for censorship-resistant, Anonymity application, anonymous communication. It uses a decentralized distributed data store to keep and deliver information, and has a suite of free soft ...
(1) *
GRUB GNU GRUB (short for GNU GRand Unified Bootloader, commonly referred to as GRUB) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a use ...
(1) *
Majordomo A majordomo () is a person who speaks, makes arrangements, or takes charge for another. Typically, this is the highest (''major'') person of a household (''domūs'' or ''domicile'') staff, a head servant who acts on behalf of the owner of a larg ...
(1) *
MediaWiki MediaWiki is free and open-source wiki software originally developed by Magnus Manske for use on Wikipedia on January 25, 2002, and further improved by Lee Daniel Crocker,mailarchive:wikipedia-l/2001-August/000382.html, Magnus Manske's announc ...
(1) * Mozilla/Netscape (1) *
Icecast Icecast is a streaming media project released as free software maintained by the Xiph.Org Foundation. It also refers specifically to the Server (computing), server program which is part of the project. Icecast was created in December 1998/Janua ...
(0–1) *
netcat netcat (often abbreviated to nc) is a computer networking utility for reading from and writing to network connections using Transmission Control Protocol, TCP or User Datagram Protocol, UDP. The command (computing), command is designed to be a ...
(1) * OpenRPG (1) *
PHP PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
(1–2) *
Project Xanadu Project Xanadu ( ) was the first hypertext project, founded in 1960 by Ted Nelson. Administrators of Project Xanadu have declared it superior to the World Wide Web, with the mission statement: "Today's popular software simulates paper. The World ...
(0–1) *
Sun Secure Global Desktop Oracle Secure Global Desktop (SGD) software provides secure access to both published applications and published desktops running on Microsoft Windows, Unix, mainframe and IBM i systems via a variety of clients ranging from fat PCs to thin clients s ...
(1) *
vBulletin vBulletin is a proprietary Internet forum software package sold by MH Sub I, LLC doing business as vBulletin (formerly Jelsoft Enterprises and vBulletin Solutions). It is written in PHP and uses a MariaDB or MySQL database server. Similar pro ...
(2) *
WebObjects WebObjects is a discontinued Java web application server and a server-based web application framework originally developed by NeXT Software, Inc. WebObject's hallmark features are its object-orientation, database connectivity, and prototy ...
(1) *
Zope Zope is a family of free and open-source software, free and open-source World Wide Web, web application servers written in Python (programming language), Python, and their associated online community. Zope stands for "Z Object Publishing Environm ...
(1)


Techniques

*
Strangler fig pattern In programming, the strangler fig pattern or strangler pattern is an architectural pattern that involves wrapping old code, with the intent of redirecting it to newer code or to log uses of the old code. Coined by Martin Fowler, its name derives f ...


See also

*
Code refactoring In computer programming and software design, code refactoring is the process of restructuring existing source code—changing the '' factoring''—without changing its external behavior. Refactoring is intended to improve the design, structure, ...
*
Open source software development Open-source software development (OSSD) is the process by which open-source software, or similar software whose source code is publicly available, is developed by an open-source software project. These are software products available with its sourc ...
*
Technical debt In software development and other information technology fields, technical debt (also known as design debt or code debt) refers to the implied cost of additional work in the future resulting from choosing an expedient solution over a more robust o ...
*
Development hell Development hell, also known as development purgatory or development limbo, is media and software industry jargon for a project, concept, or idea that remains in a stage of early development for a long time because of legal, technical, or artistic ...
*
Porting In software engineering, porting is the process of adapting software for the purpose of achieving some form of execution in a computing environment that is different from the one that a given program (meant for such execution) was originally desig ...
*
Game engine recreation Game engine recreation is a type of video game engine remastering process whereby a new game engine is Code rewriting, rewritten from scratch as a Clone (computing), clone of the original with the ability to load the original game's data files suc ...
*
Reverse engineering Reverse engineering (also known as backwards engineering or back engineering) is a process or method through which one attempts to understand through deductive reasoning how a previously made device, process, system, or piece of software accompl ...


References


External links

* {{Cite journal , last=Sneed , first=Harry , last2=Verhoef , first2=Chris , date=2019-09-01 , title=Re-implementing a legacy system , url=https://www.sciencedirect.com/science/article/pii/S0164121219301050 , journal=Journal of Systems and Software , volume=155 , pages=162–184 , doi=10.1016/j.jss.2019.05.012 , issn=0164-1212
RewriteCodeFromScratch at C2 Wiki


by
Joel Spolsky Avram Joel Spolsky (; born 1965) is a software engineer and writer. He is the author of ''Joel on Software'', a blog on software development, and the creator of the project management software Trello. He was a Program Manager on the Microsoft Exc ...
Computer programming