Class Diseases
Class Diseases are an esoteric programming concept intended to make programming in OO even more of a pain in the ass then it already is.
Concept
Class Diseases are generally malicious, unavoidable mandatory mixins that certain classes are infected with at declaration. When other classes interact with these classes, or in some cases with things which these classes have interacted with (e.g. variables), the disease is transmitted to the new class. Class diseases affect the class that they have infected in unfavorable and annoying ways (unless hijacked to do otherwise) and are generally not fun.
Class Disease Behavior
Infection
Class diseases can infect either classes or instances. Classes that are infected pass the disease on to all instances of them.
Some instance diseases are limited to objects with a specific trait: A certain member, implementing a certain interface, or even just being a member of a certain class.
Contamination
A class or instance contracts a class disease either by being randomly given it at declaration during execution time, by being declared with it, or by coming in contact with a contaminated object. Infection can be passed in the following ways:
- For hereditary diseases, any subclass of an infected class has a good chance of catching it
- Classes or instances in the same data structure can pass diseases between each other.
- Ordered data structures increase the chance as distance between an infected body and an uninfected body decreases
- When instances are operated on, the output of that operation is likely to catch the disease (e.g. an infected instance
complex(1, 5)
when added to 3, will produce a similarly infectedcomplex(4, 5)
. - Airborne diseases can leave contamination on scalar variables, e.g. if x is added to a contaminated instance of something y, then x can start to carry it and infect other interacting instance variables.
Examples of Diseases
None yet! (Feel free to add some)