ScalaPluginLoader icon indicating copy to clipboard operation
ScalaPluginLoader copied to clipboard

Suggestion - Facade methods

Open Jannyboy11 opened this issue 3 years ago • 0 comments

Since we are doing bytecode transformations already anyway, we might as well take advantage of them to implement 'Facade methods'. A 'Facade method' is a method that does nothing by itself. A bytecode transformer may take advantage of these methods and redirect calls to methods with a concrete implementation. These implementation methods may optimized for a certain version of minecraft, or specialized for certain server software. It would be an error at class-load time if an appropriate implementation method could not be found.

The advantage of this system is that it saves the programmer from implementing glue code boilerplate (e.g. feature detection using reflection, or strategy/factory pattern boilerplate).

A disadvantage of this system would be that the call-hierarchy at compile time is no longer representative of the call hierarchy at runtime, making it a bit harder to navigate through the code.

Jannyboy11 avatar May 18 '21 13:05 Jannyboy11