ArchJava: Java extension architectural features components, - - PowerPoint PPT Presentation

archjava java extension architectural features
SMART_READER_LITE
LIVE PREVIEW

ArchJava: Java extension architectural features components, - - PowerPoint PPT Presentation

ArchJava: Java extension architectural features components, ports and connections Benefits Better program understanding Reliable architectural reasoning about code Keeping architecture and code consistent as they


slide-1
SLIDE 1

18 Novembre, 2003 1

  • ArchJava: Java extension – architectural

features

– components, ports and connections

  • Benefits

– Better program understanding – Reliable architectural reasoning about code – Keeping architecture and code consistent as they evolve

slide-2
SLIDE 2

18 Novembre, 2003 2

  • Approach: add architecture to language

– Control-flow communication integrity

  • Enforced by type system

– Architecture updated as code evolves – Flexible

  • Dynamically changing architectures
  • Common implementation techniques
slide-3
SLIDE 3

18 Novembre, 2003 3

public component class Parser {

Component class

  • Defines architectural object
  • Must obey architectural constraints

Parser

slide-4
SLIDE 4

18 Novembre, 2003 4

public component class Parser { public port in { requires Token nextToken(); } public port out { provides AST parse(); }

Components communicate through Ports

  • A two-way interface
  • Define provided and required methods

Parser

  • ut

in

slide-5
SLIDE 5

18 Novembre, 2003 5

public component class Parser { public port in { requires Token nextToken(); } public port out { provides AST parse(); }

Ordinary (non-component) objects

  • Passed between components
  • Sharing is permitted
  • Can use just as in Java

Parser

  • ut

in

slide-6
SLIDE 6

18 Novembre, 2003 6

public component class Parser { public port in { requires Token nextToken(); } public port out { provides AST parse(); } AST parse() { Token tok=in.nextToken(); return parseExpr(tok); } AST parseExpr(Token tok) { ... } ... }

Can fill in architecture with ordinary Java code

Parser

  • ut

in

slide-7
SLIDE 7

18 Novembre, 2003 7

public component class Compiler { private final Scanner scanner = new Scanner(); private final Parser parser = new Parser(); private final CodeGen codegen = new CodeGen();

Subcomponents

– Component instances inside another component – Communicate through connected ports

parser codegen scanner

Compiler

  • ut in
  • ut in
slide-8
SLIDE 8

18 Novembre, 2003 8

public component class Compiler { private final Scanner scanner = new Scanner(); private final Parser parser = new Parser(); private final CodeGen codegen = new CodeGen(); connect scanner.out, parser.in; connect parser.out, codegen.in;

Connections

– Bind required methods to provided methods

parser codegen scanner

Compiler

  • ut in
  • ut in
slide-9
SLIDE 9

18 Novembre, 2003 9

  • Does code conform to architecture?
  • Communication Integrity

– Consistency Property

A component may only communicate with the components it is connected to in the architecture

slide-10
SLIDE 10

18 Novembre, 2003 10

  • Architecture allows

– Calls between connected components

parser codegen scanner

Compiler

slide-11
SLIDE 11

18 Novembre, 2003 11

parser codegen scanner

Compiler

  • Architecture allows

– Calls between connected components – Calls from a parent to its immediate subcomponents

slide-12
SLIDE 12

18 Novembre, 2003 12

parser codegen scanner

Compiler

symbol

  • Architecture allows

– Calls between connected components – Calls from a parent to its immediate subcomponents – Calls to shared objects

slide-13
SLIDE 13

18 Novembre, 2003 13

parser codegen scanner

Compiler

  • Architecture allows

– Calls between connected components – Calls from a parent to its immediate subcomponents – Calls to shared objects

  • Architecture forbids

– External calls to subcomponents

slide-14
SLIDE 14

18 Novembre, 2003 14

parser codegen scanner

Compiler

  • Architecture allows

– Calls between connected components – Calls from a parent to its immediate subcomponents – Calls to shared objects

  • Architecture forbids

– External calls to subcomponents – Calls between unconnected subcomponents

slide-15
SLIDE 15

18 Novembre, 2003 15

  • Architecture allows

– Calls between connected components – Calls from a parent to its immediate subcomponents – Calls to shared objects

  • Architecture forbids

– External calls to subcomponents – Calls between unconnected subcomponents – Calls through shared objects

parser codegen scanner

Compiler

symbol

slide-16
SLIDE 16

18 Novembre, 2003 16

  • ArchJava integrates architecture with Java

code

  • Control communication integrity

– Keeps architecture and code synchronized

  • Formalization of language & properties

– ArchFJ (Arch Featherweight Java)