Runtime Specialization - Java has never been so dynamic before
Much of software development is about creating variants of things that have been done in similar ways before. Typical means to create such variants include inheritance / subtyping, extension points and dependency injection. Unfortunately, all of these approaches require that the original author anticipated the desired variation points in his/her module, to enable you to create whatever variant comes to your mind. This means, modules intended for reuse tend to be bloated with indirections - just in case someone needs to modify something sometime, and still many interesting adaptations are simply not possible due to lack of pre-planning.
Object Teams reverses this situation. Creating unanticipated variants is at the core of this approach. The language OT/J adds three layers of dynamism to Java:
- Your POJOs are empowered to assume different Roles during their lifetime. Dynamically attaching a Role object to a base object morphs the object into a variant of itself.
- Roles are grouped into meaningful units, called Teams. Teams provide modular ways for controlling which Roles are active at which point in time. This enables your program to react differently in different situations.
- In the Neon release, it will be possible to add Role and Team classes even at runtime. No need to re-start, simply add those classes to the running applications and immediately your application morphs into a variant of itself.
With power comes responsibility. Object Teams emphasizes the importance of modularity, transparency and control. Variants are created as modules, variants are clearly visible in the application architecture, and simply deactivating any active Teams puts the application back into its pristine state.