You aren't gonna need it

Last updated

"You aren't gonna need it" [1] [2] (YAGNI) [3] is a principle which arose from extreme programming (XP) that states a programmer should not add functionality until deemed necessary. [4] Other forms of the phrase include "You aren't going to need it" (YAGTNI) [5] [6] and "You ain't gonna need it". [7]

Contents

Ron Jeffries, a co-founder of XP, explained the philosophy: "Always implement things when you actually need them, never when you just foresee that you [will] need them." [8] John Carmack wrote "It is hard for less experienced developers to appreciate how rarely architecting for future requirements / applications turns out net-positive." [9]

Context

YAGNI is a principle behind the XP practice of "do the simplest thing that could possibly work" (DTSTTCPW). [2] [3] It is meant to be used in combination with several other practices, such as continuous refactoring, continuous automated unit testing, and continuous integration. Used without continuous refactoring, it could lead to disorganized code and massive rework, known as technical debt.[ citation needed ] YAGNI's dependency on supporting practices is part of the original definition of XP.

Criticism

While the principle can help to avoid over-engineering and unnecessary complexity, there are several potential pitfalls to consider:

  1. Careless or unprofessional coding: YAGNI can sometimes encourage developers to write code without considering future needs, which can lead to unprofessional or careless coding practices. [10]
  2. Conflict with refactoring: YAGNI can seem to conflict with the practice of refactoring, as it discourages the addition of features or code structures that might be useful for future refactoring.
  3. Over-simplification: While YAGNI discourages unnecessary complexity, it can sometimes lead to oversimplification. For example, developers might avoid creating abstractions even when they could improve code organization and readability.
  4. Technical debt: If YAGNI is used without continuous refactoring, it could lead to disorganized code and massive rework, known as technical debt.
  5. Short-termism and self-fulfilling prophecies: YAGNI can sometimes lead to short-term thinking, where developers focus too much on the immediate needs and ignore potential future requirements. This can result in self-fulfilling prophecies, where the lack of planning for future needs leads to more significant problems down the line.
  6. Misunderstandings and misuse: Like any principle, YAGNI can be misunderstood or misused. For example, some developers might interpret YAGNI as an excuse to avoid planning or forethought, which is not its intended purpose.

In conclusion, while YAGNI can be a useful principle to avoid over-engineering and unnecessary complexity, it should be used judiciously and in conjunction with other practices like continuous refactoring and thoughtful planning to avoid its potential pitfalls. [11]

See also

Related Research Articles

<span class="mw-page-title-main">KISS principle</span> Design principle preferring simplicity

KISS, an acronym for "Keep it simple, stupid!", is a design principle first noted by the U.S. Navy in 1960. First seen partly in American English by at least 1938, the KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided. The phrase has been associated with aircraft engineer Kelly Johnson. The term "KISS principle" was in popular use by 1970. Variations on the phrase include "keep it super simple", "keep it simple, silly", "keep it short and simple", "keep it short and sweet", "keep it simple and straightforward", "keep it small and simple", "keep it simple, soldier", "keep it simple, sailor", "keep it simple, sweetie", "keep it stupidly simple", or "keep it sweet and simple".

<span class="mw-page-title-main">Martin Fowler (software engineer)</span> American software developer, author and public speaker

Martin Fowler is a British software developer, author and international public speaker on software development, specialising in object-oriented analysis and design, UML, patterns, and agile software development methodologies, including extreme programming.

In computer programming, unit testing is a software testing method by which individual units of source code—sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures—are tested to determine whether they are fit for use. It is a standard step in development and implementation approaches such as Agile.

Test-driven development (TDD) is a software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases. This is as opposed to software being developed first and test cases created later.

In software development, agile practices include requirements, discovery and solutions improvement through the collaborative effort of self-organizing and cross-functional teams with their customer(s)/end user(s). Popularized in the 2001 Manifesto for Agile Software Development, these values and principles were derived from, and underpin, a broad range of software development frameworks, including Scrum and Kanban.

<span class="mw-page-title-main">Dynamic systems development method</span>

Dynamic systems development method (DSDM) is an agile project delivery framework, initially used as a software development method. First released in 1994, DSDM originally sought to provide some discipline to the rapid application development (RAD) method. In later versions the DSDM Agile Project Framework was revised and became a generic approach to project management and solution delivery rather than being focused specifically on software development and code creation and could be used for non-IT projects. The DSDM Agile Project Framework covers a wide range of activities across the whole project lifecycle and includes strong foundations and governance, which set it apart from some other Agile methods. The DSDM Agile Project Framework is an iterative and incremental approach that embraces principles of Agile development, including continuous user/customer involvement.

Lean software development is a translation of lean manufacturing principles and practices to the software development domain. Adapted from the Toyota Production System, it is emerging with the support of a pro-lean subculture within the agile community. Lean offers a solid conceptual framework, values and principles, as well as good practices, derived from experience, that support agile organizations.

The Chrysler Comprehensive Compensation System was a project in the Chrysler Corporation to replace several payroll applications with a single system. The new system was built using Smalltalk and GemStone. The software development techniques invented and employed on this project are of interest in the history of software engineering. C3 has been referenced in several books on the extreme programming (XP) methodology. The software went live in 1997, paying around ten thousand people. The project continued, intending to take on a larger proportion of the payroll, but new development was stopped in 1999.

Big design up front (BDUF) is a software development approach in which the program's design is to be completed and perfected before that program's implementation is started. It is often associated with the waterfall model of software development.

"Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place.

Extreme programming (XP) is an agile software development methodology used to implement software systems. This article details the practices used in this methodology. Extreme programming has 12 practices, grouped into four areas, derived from the best practices of software engineering.

Coding conventions are a set of guidelines for a specific programming language that recommend programming style, practices, and methods for each aspect of a program written in that language. These conventions usually cover file organization, indentation, comments, declarations, statements, white space, naming conventions, programming practices, programming principles, programming rules of thumb, architectural best practices, etc. These are guidelines for software structural quality. Software programmers are highly recommended to follow these guidelines to help improve the readability of their source code and make software maintenance easier. Coding conventions are only applicable to the human maintainers and peer reviewers of a software project. Conventions may be formalized in a documented set of rules that an entire team or company follows, or may be as informal as the habitual coding practices of an individual. Coding conventions are not enforced by compilers.

<span class="mw-page-title-main">Ron Jeffries</span> American computer scientist

Ron Jeffries is one of the three founders of the Extreme Programming (XP) software development methodology circa 1996, along with Kent Beck and Ward Cunningham. He was from 1996, an XP coach on the Chrysler Comprehensive Compensation System project, which was where XP was invented. He is an author of Extreme Programming Installed, the second book published about XP. He has also written Extreme Programming Adventures in C#. He is one of the 17 original signatories of the Agile Manifesto.

Rule of three is a code refactoring rule of thumb to decide when similar pieces of code should be refactored to avoid duplication. It states that two instances of similar code do not require refactoring, but when similar code is used three times, it should be extracted into a new procedure. The rule was popularised by Martin Fowler in Refactoring and attributed to Don Roberts.

Matt Stephens is an author and software process expert based in London, UK. In January 2010 he founded independent book publisher Fingerpress UK Ltd, and in November 2014 he founded the Virtual Reality book discovery site Inkflash.

DevOps is a methodology in the software development and IT industry. Used as a set of practices and tools, DevOps integrates and automates the work of software development (Dev) and IT operations (Ops) as a means for improving and shortening the systems development life cycle.

<span class="mw-page-title-main">Extreme programming</span> Software development methodology

Extreme programming (XP) is a software development methodology intended to improve software quality and responsiveness to changing customer requirements. As a type of agile software development, it advocates frequent releases in short development cycles, intended to improve productivity and introduce checkpoints at which new customer requirements can be adopted.

<span class="mw-page-title-main">Robert C. Martin</span> American software consultant

Robert Cecil Martin, colloquially called "Uncle Bob", is an American software engineer, instructor, and author. He is most recognized for promoting many software design principles and for being an author and signatory of the influential Agile Manifesto.

Evolutionary database design involves incremental improvements to the database schema so that it can be continuously updated with changes, reflecting the customer's requirements. People across the globe work on the same piece of software at the same time hence, there is a need for techniques that allow a smooth evolution of database as the design develops. Such methods utilize automated refactoring and continuous integration so that it supports agile methodologies for software development. These development techniques are applied on systems that are in pre-production stage as well on systems that have already been released. These techniques not only cover relevant changes in the database schema according to customer's changing needs, but also migration of modified data into the database and also customizing the database access code accordingly without changing the data semantics.

References

  1. Extreme Programming Installed, Jeffries, Ronald E.; Ann Anderson, Chet Hendrickson (2001). 265 pages, p. 190, webpage: Books-Google-dIsC, quote: "YAGNI: 'You Aren't Gonna Need It.' This slogan, one of XP's most famous..., reminds us always to work on the story we have, not something we think we're going to need."
  2. 1 2 Extreme Programming examined, Succi, Giancarlo; Michele Marchesi, 2001, 569 pages, webpage: Books-Google-VSCh, quote: "XP says 'do the simplest thing that could possibly work ' because 'you aren't gonna need it'."
  3. 1 2 Object-oriented & classical software engineering, Schach, Stephen R. (2007). 618 pages, p., webpage: Book-Google-hWwh, quote: "Two acronyms now associated with extreme programming are YAGNI (you aren't gonna need it) and DTSTTCPW (do the simplest thing that could possibly work)."
  4. Lindstrom, Lowell; Carmen Zannier; Erdogmus, Hakan, eds. (2004). Extreme Programming and Agile Methods – XP/Agile Universe 2004: 4th Conference on Extreme Programming and Agile Methods. Lecture Notes in Computer Science. Berlin: Springer. p. 121. ISBN   3-540-22839-X.
  5. Fowler, Martin; Kent Beck (8 July 1999). Refactoring: Improving the Design of Existing Code. Addison-Wesley Professional, 431 pages, p. 68, webpage: BGoogle-1M. ISBN   978-0201485677. Quote: "you aren't going to need it".
  6. Poppendieck, Mary; Tom Poppendieck (2003). Lean Software Development: An Agile Toolkit, p.59, webpage: BGoogle-hQ. Quote: "Kent Beck, Extreme Programming Explained, Chapter 17, uses the acronym YAGNI (You Aren't Going to Need It) for this practice and explains its rationale."
  7. Olsen, Russ (2007). Design Patterns in Ruby, p.13, webpage: . ISBN   9780321490452. Quote: "This design principle comes out of the Extreme Programming world and is elegantly summed up by the phrase You Ain't Gonna Need It (YAGNI for short)."
  8. Jeffries, Ron (April 4, 1998). "You're NOT gonna need it!" . Retrieved 2007-11-07.
  9. Carmack, John [@ID_AA_Carmack] (18 June 2021). "It is hard for less experienced developers to appreciate how rarely architecting for future requirements / applications turns out net-positive. t.co/lusGdzkfd3" (Tweet). Archived from the original on 16 August 2022. Retrieved 2 December 2022 via Twitter.
  10. Kristinaitis, Giedrius (2022-11-04). "Stop Using YAGNI as a Lazy Excuse to Write Bad Code". Medium. Retrieved 2023-12-30.
  11. ByteHide (2023-06-28). "C# YAGNI Principle (You Aren't Gonna Need It!) (2023)". ByteHide Blog. Retrieved 2023-12-30.