You get a bonus - 1 coin for daily activity. Now you have 1 coin

What Is a Crutch (Palliative Workaround) in Programming?

Practice



«Crutch-driven development» is a concept that emerged in the era of the growth and popularization of high-level languages such as C++, PHP, Java and so on.

Palliative (from French palliatif and Latin pallium, «pallium, cover, Greek cloak, outer garment») is a non-exhaustive, temporary solution, a half-measure that covers up the problem itself like a «cloak».

A workaround, workaround, palliative — in technical jargon a «crutch» — is a relatively quick and simple solution to a problem, applied to urgently eliminate its consequences without affecting the causes behind it. A workaround is usually a temporary or incomplete solution that does not meet the requirements for further development of the system and will later need to be replaced with a final, more complete one. Very often workarounds call for a creative approach and out-of-the-box thinking. Workarounds are used in various fields of human activity when, for some reason, a radical solution cannot be applied at all or would take too long to implement.

The main problem with workarounds is that using them reduces the motivation to solve the problem radically, and the inherently temporary «crutch» remains in place as a permanent solution, itself becoming a source of additional problems. In engineering, implementing a workaround may cause the system to fail in the future. For example, in computer programming workarounds are often used to get around a specific bug in a library. When the library is finally fixed, a workaround designed around the library's buggy behavior may cause the program to break.

During the development and debugging of a program, all sorts of errors arise. To eliminate them, so-called «crutches» are used, which make it possible to fix the bug that has appeared — temporarily or permanently — by any means currently available, despite the problems that may arise, and in most cases they do indeed arise. That in turn entails the use of yet another crutch, then a second one, and so on.
There is a saying, «A crutch props up a crutch with a crutch», and it fully describes the process of «crutch-driven development».
Code quality is unquestionably important, but if a developer is required to make corrections or add new functionality right this minute, a «crutch» may be used temporarily.
If the code accumulates a critical «crutch» mass, it is worth making sure time is set aside for refactoring.

What Is a Crutch (Palliative Workaround) in Programming?

"Crutch-driven development" in programming is a term used to describe the practice of adding temporary or inefficient solutions to program code in order to bypass or resolve problems that have arisen during development. These "crutches" are usually not clean or optimal solutions, but they can be applied to quickly eliminate errors, keep the program working, or achieve the desired functionality without rewriting the entire structure of the program.

For example, "crutch-driven development" may include the following practices:

  1. Using global variables to exchange data between different parts of the program instead of passing arguments to functions.

  2. Adding a large number of conditional statements (if-else) to handle different scenarios inside a single function, which makes the code less readable and harder to maintain.

  3. Using "magic numbers" in the code instead of constants and enumerations to denote particular values.

  4. Using crutches to bypass errors or exceptions instead of handling errors and exceptions carefully.

  5. Duplicating code instead of creating functions or classes for reusable tasks.

Although crutches can be useful in situations that call for a quick fix, they can also lead to technical debt and degrade the overall quality and readability of the code. That is why it is important to come back to such sections of code later and consider opportunities for improvement and optimization, in order to avoid unnecessary "crutches" in the long run.

What Is a Crutch (Palliative Workaround) in Programming?What Is a Crutch (Palliative Workaround) in Programming?

Reasons for using workarounds

  • The high cost and/or labor intensity of genuine solutions.
  • A lack of the resources and/or qualifications required to implement a genuine solution.
  • It is not yet clear how to implement a genuine solution, or what it would even look like.
  • Introducing a genuine solution would break compatibility with a large number of existing systems. Retrofitting all those systems is an expensive and lengthy undertaking.
  • The genuine solution is protected by a patent or copyright.

Examples of widely known workarounds

In programming

  • The __doPostBack function in ASP.NET. It exists because browsers initially had no way to trigger a page submission to the server from a client-side script (factor — compatibility).
  • The XHTML 1.0 Transitional specification. It exists for compatibility with browsers that support older HTML specifications (factor — compatibility).
See also:

In engineering

  • A «bug wire» in place of a fuse in an electrical panel. It allows power to be restored immediately when no fuses are at hand, but it can cause a fire in the event of an overload or short circuit (factor — resources, sometimes — time).
  • Color encoding systems in analog television: NTSC, PAL, SECAM. All of them were designed with compatibility in mind for the large number of black-and-white television sets that existed at the time of their development and for the existing television signal format. As a result, all of these systems have their drawbacks, the most significant being lower color resolution compared with the luminance component (factor — compatibility).

In medicine

  • The use of antipyretics for a viral infection. They have no effect on the cause of the illness, but they eliminate or relieve the fever, protecting the internal organs for the time the immune system needs to fight off the virus (factor — time).
  • A temporary filling in a tooth, used in the treatment of deep caries (first visit), in the biological treatment of pulpitis, and after filling a root canal. (factor — time and the cost of a temporary filling compared with a full one).
  • Crutches — until the fracture knits and the patient is able to walk without support (factor — time).

See also

  • refactoring
  • antipatterns
  • spaghetti code
  • Hacking

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Software and information systems development"

Terms: Software and information systems development