Famous quote by Ken Thompson

"If you want to go somewhere, goto is the best way to get there"

About this Quote

Ken Thompson’s assertion, “If you want to go somewhere, goto is the best way to get there,” draws a line between practical programming needs and the purist ideals of code structure. The statement arrives from the early days of computer science, when programming languages like C provided a blunt yet powerful tool: the goto statement. This feature allows for an immediate jump from one point in a program’s flow to another, bypassing the standard structured paths dictated by sequences, loops, and function calls.

Thompson, one of the original creators of Unix, addresses the ongoing debate about whether programming should embrace such direct methods or prioritize structure and readability. The goto statement became notorious after Edsger Dijkstra’s famous essay, “Go To Statement Considered Harmful,” which argued that its use leads to tangled, hard-to-follow “spaghetti code.” Advocates of structured programming countered that disciplined use of loops and conditionals led to simpler, more maintainable code.

Yet Thompson’s perspective reflects the pragmatism necessary when engineering under constraints. Early programmers faced memory, language, and hardware limitations. The goto offered a straightforward escape route from cumbersome control flows, especially for tasks like error handling or escaping nested loops. For someone just “wanting to go somewhere” in the logic, it is the fastest available route.

There’s an underlying humor and subtle critique in the statement, implicitly acknowledging both the power and the peril of goto. It’s direct and unapologetic, resonating with anyone who has fought a fortress of abstractions only to be blocked by complexity. Sometimes, reaching the destination is more important than the beauty of the journey. Thompson’s words also highlight that dogma, while useful for discipline, should not override practical needs. Ultimately, good engineering balances rules with results: efficiency and clarity, structure and expediency, understanding when “goto” serves the best interest of the code and the coder.

More details

TagsBest

About the Author

USA Flag This quote is written / told by Ken Thompson somewhere between February 4, 1943 and today. He/she was a famous Scientist from USA. The author also have 29 other quotes.
Go to author profile

Similar Quotes