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 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 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 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 (1)
*
Majordomo (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 (1)
*
OpenRPG (1)
*
PHP (1–2)
*
Project Xanadu (0–1)
*
Sun Secure Global Desktop (1)
*
vBulletin (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
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
*
Technical debt
*
Development hell
*
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 Wikiby
Joel Spolsky
Computer programming