Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "OTJ"

(New page: {{note|The programming language OT/J implements the programming model Object Teams for the host language Java.}} 500px = OT/J Language Definition (OTJLD) = This i...)
 
(Compiler)
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{note|The programming language OT/J implements the programming model Object Teams for the host language Java.}}
+
{{note|The programming language OT/J implements the programming model [http://www.eclipse.org/objectteams Object Teams] for the host language Java.}}
[[Image:Otj.png|right|500px]]
+
[[Image:Otj.png|right|420px]]
  
 +
= Why Object Teams? =
 +
===Team spirit for your objects===
 +
Building complex systems from isolated objects often yields poor structure which readily decays during system evolution. Objects should '''team-up''' in order to co-operate and jointly deliver complex behaviors. Objects play specific '''roles''' within a given Team.
 +
===Context based dispatch===
 +
'''Role instances''' are attached as '''specializers''' to existing objects. Object behavior is controlled by the currently '''active context''' that determines which roles are active at a given point in time. Contexts are reified into '''team instances''', which may further be used to mediate between roles and maintain state of the collaboration.
 +
===Modules larger than classes===
 +
On the road to re-use of modules larger than classes two approaches compete: '''frameworks''' and '''components'''. For many applications white box frameworks are too fragile and black box components too rigid. Object Teams provide a middle road which balances '''encapsulation''' and '''adaptability'''.
  
 
= OT/J Language Definition (OTJLD) =
 
= OT/J Language Definition (OTJLD) =
This is the definitive point of reference for OT/J
+
*This is the definitive point of reference for OT/J
* Current version online: http://www.objectteams.org/def/1.3
+
** Current version online: http://www.objectteams.org/def/1.3.1
* Frozen release 1.2 as printable document:
+
** Frozen release 1.3 as printable document: http://www.objectteams.org/def/OTJLDv1.3-final.pdf
:http://www.objectteams.org/publications/OTJLDv1.2.pdf
+
  
 
= First Reading =
 
= First Reading =
* OT/J Primer -- ''to be written''
+
* '''[[OTJ_Primer|OT/J Primer]]''' -- ''work in progress''
 
* Either of the following [http://www.objectteams.org/publications/ publications] can be read as an introduction to OT/J:
 
* Either of the following [http://www.objectteams.org/publications/ publications] can be read as an introduction to OT/J:
 
** [http://www.objectteams.org/publications/#NODe02 Object Teams: Improving Modularity for Crosscutting Collaborations]  -- (Net.ObjectDays, 2002)
 
** [http://www.objectteams.org/publications/#NODe02 Object Teams: Improving Modularity for Crosscutting Collaborations]  -- (Net.ObjectDays, 2002)
 
** [http://www.objectteams.org/publications/#AOSD03 Model-View-Controller and Object Teams: A Perfect Match of Paradigms.] -- (AOSD 2003)
 
** [http://www.objectteams.org/publications/#AOSD03 Model-View-Controller and Object Teams: A Perfect Match of Paradigms.] -- (AOSD 2003)
 
** [http://www.objectteams.org/publications/#JAO07 A Precise Model for Contextual Roles: The Programming Language ObjectTeams/Java] -- (Journal Applied Ontology 2007)
 
** [http://www.objectteams.org/publications/#JAO07 A Precise Model for Contextual Roles: The Programming Language ObjectTeams/Java] -- (Journal Applied Ontology 2007)
** The [[:Category:Object Teams Examples|Examples]] category shows a few examples ranging from introductory to slightly advanced.
+
* The '''[[:Category:Object Teams Examples|Examples]]''' category shows a few examples ranging from introductory to slightly advanced.
** [[:Category:Object Teams Patterns|Object Teams Patterns]] show OT/J in action regarding recurring problems and their solutions.
+
* '''[[:Category:Object Teams Patterns|Object Teams Patterns]]''' show OT/J in action regarding recurring problems and their solutions.
 +
* '''[http://www.eclipse.org/objectteams Static Homepage]''' which has all the resources like downloads etc.
  
 
= Implementation =
 
= Implementation =
Line 24: Line 31:
 
:'''Compatibility'''
 
:'''Compatibility'''
 
:OT/J is compiled by a modified version of the Eclipse compiler for Java. This means that the OT/J compiler can also compile any Java program. While OT/J introduces some new keywords most of these words are still treated as normal identifiers ''until'' the keyword '''<code>team</code>''' has been parsed ({{otjld|A|.0.1}} -- ''"scoped keywords"''). This provides the greatest possible compatibility at the syntax level.
 
:OT/J is compiled by a modified version of the Eclipse compiler for Java. This means that the OT/J compiler can also compile any Java program. While OT/J introduces some new keywords most of these words are still treated as normal identifiers ''until'' the keyword '''<code>team</code>''' has been parsed ({{otjld|A|.0.1}} -- ''"scoped keywords"''). This provides the greatest possible compatibility at the syntax level.
 +
 
:'''Compiler invocation'''
 
:'''Compiler invocation'''
:The compiler can be invoked either from the ObjectTeamsDevelopmentTooling (OTDT) or as a [http://www.objectteams.org/distrib#commandlinecompiler command line compiler]. For compiling OT/J source outside Eclipse please see [[OT/Compiling With Ant|Compiling With Ant]].
+
:The compiler can be invoked either from the ObjectTeamsDevelopmentTooling (OTDT) or as a [http://www.eclipse.org/objectteams/download.php#DL25 command line compiler (ecotj)].  
 +
For compiling OT/J source outside Eclipse please see either of:
 +
:* [http://help.eclipse.org/topic/org.eclipse.jdt.doc.user/tasks/task-using_batch_compiler.htm JDT help] (''yes, ecotj can be used exactly like ecj from [[JDT_Core]]'').
 +
:* [[OTHowtos/Compiling With Ant]].
 +
:* [http://objectteams.wordpress.com/2011/06/between-the-times/ Compiling OT/J with Maven] -- Maven sites: [http://download.eclipse.org/objectteams/maven/3/sites/objectteams-otdre-parent-pom/usage.html parent-pom] ([http://download.eclipse.org/objectteams/maven/3/sites/objectteams-parent-pom/usage.html for traditional OTRE]) -  [http://download.eclipse.org/objectteams/maven/3/sites/objectteams-compile-test/usage.html example project]
 +
 
 
:'''Compiler output'''
 
:'''Compiler output'''
 
:The compiler produces '''regular Java <code>.class</code> files''', which are enriched with OT/J specific meta data using Java bytecode attributes. These meta data are interpreted by the OTRE (see below) in order to weave <code>playedBy</code> and <code>callin</code> bindings into base classes. This implies that OT/J programs need to be launched with the OTRE enabled. Other than that any recent JVM (&ge;1.5) can be used.
 
:The compiler produces '''regular Java <code>.class</code> files''', which are enriched with OT/J specific meta data using Java bytecode attributes. These meta data are interpreted by the OTRE (see below) in order to weave <code>playedBy</code> and <code>callin</code> bindings into base classes. This implies that OT/J programs need to be launched with the OTRE enabled. Other than that any recent JVM (&ge;1.5) can be used.
Line 34: Line 47:
 
*'''JPLIS''':
 
*'''JPLIS''':
 
:This technology is part of the Java standard since version 1.5. Launching an application in JPLIS mode only requires a few items added to the classpath and an <code>-javaagent:...</code> argument, which means a non-invasive way of launching OT/J programs like plain Java programs.
 
:This technology is part of the Java standard since version 1.5. Launching an application in JPLIS mode only requires a few items added to the classpath and an <code>-javaagent:...</code> argument, which means a non-invasive way of launching OT/J programs like plain Java programs.
*'''[[OTEquinox|OT/Equinox]]''':
+
*'''[[:Category:OTEquinox|OT/Equinox]]''':
 
:By integration of OT/J with the [[:Category:Equinox|Equinox]] component framework, also Eclipse plug-ins (RCP, OSGi bundles) can leverage OT/J. In this case running OT/J code only requires to have the OT/Equinox feature installed on top of Equinox.
 
:By integration of OT/J with the [[:Category:Equinox|Equinox]] component framework, also Eclipse plug-ins (RCP, OSGi bundles) can leverage OT/J. In this case running OT/J code only requires to have the OT/Equinox feature installed on top of Equinox.
  
Within the OTDT the OTRE is enabled by a new checkbox adjacent to the JRE configuration ([http://www.objectteams.org/distrib/new_in_1.3.html#launch]).
+
Within the OTDT the OTRE is enabled by a new checkbox adjacent to the JRE configuration (see the [http://help.eclipse.org/topic/org.eclipse.objectteams.otdt.doc/guide/running.html user guide]).
 +
 
 +
===Weaving into system classes===
 +
:In contrast to an earlier architecture in JPLIS mode the OTRE can weave into more classes, i.e., even system classes from Java's <code>rt.jar</code> can potentially be bound as base classes ''(note, that any classes loaded ''before'' the OTRE starts operation can still not be woven).''
  
==='''Weaving into system classes===
+
===Launching from the command line===
:In contrast to an earlier architecture in JPLIS mode the OTRE can weave into more classes, i.e., even system classes from Java's <code>rt.jar</code> can potentially be bound as base classes ''(note, that any classes loaded ''before'' the OTRE starts operation can
+
:For running OT/J applications outside Eclipse please see [[OTHowtos/Running From Commandline]].
still not be woven).''
+
  
==='''Launching from the command line'''===
+
===Build-time weaving===
:For running OT/J applications outside Eclipse please see [[OT/Running OTJ Standalone|Running OT/J Standalone]].
+
:While load-time weaving has the advantage of easier deployment - no tweaking of the classpath is required to ensure that the right version of a class is loaded - it may be difficult to integrate in some application containers. As a fallback mechanism, the OT weaver can be used to process all affected classes already at build-time. The resulting woven classes can then be executed on any JVM (&ge;1.5) without using the load-time weaver.
 +
:* [[OTHowtos/BuildTime Weaver]]
  
  
 
[[Category:Object Teams]]
 
[[Category:Object Teams]]

Latest revision as of 17:24, 21 June 2016

Note.png
The programming language OT/J implements the programming model Object Teams for the host language Java.
Otj.png

Why Object Teams?

Team spirit for your objects

Building complex systems from isolated objects often yields poor structure which readily decays during system evolution. Objects should team-up in order to co-operate and jointly deliver complex behaviors. Objects play specific roles within a given Team.

Context based dispatch

Role instances are attached as specializers to existing objects. Object behavior is controlled by the currently active context that determines which roles are active at a given point in time. Contexts are reified into team instances, which may further be used to mediate between roles and maintain state of the collaboration.

Modules larger than classes

On the road to re-use of modules larger than classes two approaches compete: frameworks and components. For many applications white box frameworks are too fragile and black box components too rigid. Object Teams provide a middle road which balances encapsulation and adaptability.

OT/J Language Definition (OTJLD)

First Reading

Implementation

Compiler

Compatibility
OT/J is compiled by a modified version of the Eclipse compiler for Java. This means that the OT/J compiler can also compile any Java program. While OT/J introduces some new keywords most of these words are still treated as normal identifiers until the keyword team has been parsed (OTJLD §A.0.1 -- "scoped keywords"). This provides the greatest possible compatibility at the syntax level.
Compiler invocation
The compiler can be invoked either from the ObjectTeamsDevelopmentTooling (OTDT) or as a command line compiler (ecotj).

For compiling OT/J source outside Eclipse please see either of:

Compiler output
The compiler produces regular Java .class files, which are enriched with OT/J specific meta data using Java bytecode attributes. These meta data are interpreted by the OTRE (see below) in order to weave playedBy and callin bindings into base classes. This implies that OT/J programs need to be launched with the OTRE enabled. Other than that any recent JVM (≥1.5) can be used.

Object Teams Runtime Environment (OTRE)

As mentioned, running an OT/J application requires the OTRE. Currently two alternative modes are supported how the OTRE can be linked into an OT/J application:

  • JPLIS:
This technology is part of the Java standard since version 1.5. Launching an application in JPLIS mode only requires a few items added to the classpath and an -javaagent:... argument, which means a non-invasive way of launching OT/J programs like plain Java programs.
By integration of OT/J with the Equinox component framework, also Eclipse plug-ins (RCP, OSGi bundles) can leverage OT/J. In this case running OT/J code only requires to have the OT/Equinox feature installed on top of Equinox.

Within the OTDT the OTRE is enabled by a new checkbox adjacent to the JRE configuration (see the user guide).

Weaving into system classes

In contrast to an earlier architecture in JPLIS mode the OTRE can weave into more classes, i.e., even system classes from Java's rt.jar can potentially be bound as base classes (note, that any classes loaded before the OTRE starts operation can still not be woven).

Launching from the command line

For running OT/J applications outside Eclipse please see OTHowtos/Running From Commandline.

Build-time weaving

While load-time weaving has the advantage of easier deployment - no tweaking of the classpath is required to ensure that the right version of a class is loaded - it may be difficult to integrate in some application containers. As a fallback mechanism, the OT weaver can be used to process all affected classes already at build-time. The resulting woven classes can then be executed on any JVM (≥1.5) without using the load-time weaver.

Back to the top