Home

 

Getting Started with Elisa

Using EDS

Demo's

Tutorials

 

Language Description

1. Lexical Elements
2. Basic Data Types and Expressions
3. Definitions
4. Streams
5. Backtracking
6. Statements and Special Expressions
7. Arrays
8. Lists
9. Descriptors
10. Components
11. Collections
12. Generic Components
13. Terms
14. Categories
15. Types 

16. Built-in Definitions
17. Higher-order Definitions

18. External Interfaces

Index

Data Structures

1. Sequences
2. Examples involving Lists
3. Trees
4. Graphs
5. Searching State Spaces
6. Language Processing
7. Knowledge Representations          

 

Metaprogramming

1. Introduction
2. What are Domain Definitions?

3.  Sorts of Domain Definitions

4.  Manipulations of Domain Definitions

5.  Translating Domain Definitions

6.  Dialogue Sessions

7.  Example of Concentric Circles

8.  Example of Domain Substitution applied to Concentric Circles

9.  Example of an Order Processing Application

10.Example of an Airport Information System

11.Example of a Rental Boat Business

12.Benefits of Domain Definitions

   

Back Home Up Next


FACADE

1 Purpose

2 Problem Description

3 Domain Definitions

4 Elisa Components

1  Purpose

 

Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.

 

 

2  Problem Description

 

Structuring a system into subsystems helps reduce complexity. A common design goal is to minimize the communication and dependencies between subsystems. One way to achieve this goal is to introduce a facade object that provides a single, simplified interface to the more general facilities of a subsystem.

Consider for example a programming environment that gives applications access to its compiler subsystem. This subsystem contains classes such as Scanner, Parser, ProgramNode, BytecodeStream, and ProgramNodeBuilder that implement the compiler. Some specialized applications might need to access these classes directly. But most clients of a compiler generally don't care about details like parsing and code generation; they merely want to compile some code. For them, the powerful but low-level interfaces in the compiler subsystem only complicate their task.

To provide a higher-level interface that can shield clients from these classes, the compiler subsystem also includes a Compiler class. This class defines a unified interface to the compiler's functionality. The Compiler class acts as a facade: It offers clients a single, simple interface to the compiler subsystem. It glues together the classes that implement compiler functionality without hiding them completely. The compiler facade makes life easier for most programmers without hiding the lower-level functionality from the few that need it.

3  Domain Definitions

We will transform the top-level relations into a set of corresponding domain definitions:

Compiler = Scanner + Parser + ProgramNodeBuilder + CodeGenerator

The next step is to translate the domain definitions into a number of Elisa components. In addition, we will use skeletons of definitions as shown in the preceding class relationships.

4  Elisa components 

Based on the domain definitions a set of related components are derived. The first component implements  a skeleton of the

component Compilers;
type Compiler;

     CreateCompiler(Source = text) -> Compiler;
     Compile(Compiler)             -> ByteCodeStream;
        . . .
begin

            <<implementations of >>


     CreateCompiler(source) = Compiler:[source];
     

     Compile(compiler) = 

       [ Scanner = CreateScanner(compiler.input);

         programNodeBuilder = CreateProgramNodeBuilder( );

         Parser = CreateParser(programNodeBuilder); 

         CodeGenerator = CreateCodeGenerator("RISCCodeGenerator");

 

         ParseTree = [token = scan(Scanner); Parse(Parser, token)];

         GenerateCode(CodeGenerator,ParseTree);

        ];


        . . .

end component Compilers;

The following component is a skeleton example of a Scanner component:

 

component Scanners;
type Scanner;

type Token  =  text;

     CreateScanner(Source = text) -> Scanner;
     Scan(Scanner)                -> multi(Token);

      . . .
begin
            <<implementations of >>
     CreateScanner(source)= Scanner:[source; ...];
     Scan(scanner)   = ...;

      . . .
end component Scanners;
    

The following component is a skeleton of a  Parser component:

 

component Parsers;
type Parser;

     CreateParser(ProgramNodeBuilder) -> Parser;

     Parse(Parser, Token) -> optional(ParseTree);

        . . .
begin

     CreateParser(programNodeBuilder) = Parser:[programNodeBuilder];

     Parse(Parser, Token) = . . .

            .  .  .

end component Parsers;

The following component is a skeleton implementation of a ProgramNodeBuilder:

component ProgramNodeBuilders;
type ProgramNodeBuilder;
     CreateProgramNodeBuilder( ) -> ProgramNodeBuilder;
     Build(ProgramNodeBuilder)   -> Status;

                .  .  .  
begin
            <<implementations of >>
     CreateProgramNodeBuilder() = ProgramNodeBuilder:[...];
     Build(ProgramNodeBuilder) = . . .; 

      . . .
end component ProgramNodeBuilders;

The following component is a skeleton implementation of a CodeGenerator:

component CodeGenerators;
type CodeGenerator;
     CreateCodeGenerator(TargetMachine)     -> CodeGenerator;
     GenerateCode(CodeGenerator, ParseTree) -> ByteCodeStream;

        .  .  .  
begin
            <<implementations of >>
     CreateCodeGenerator(targetmachine) = CodeGenerator:[ targetmachine ...];
     GenerateCode(codegenerator, parsetree) = [ . . .];

       . . .
end component CodeGenerators;

 

Back Home Up Next

  Part 5: Design Patterns   Facade

            
Introduction

Home | Highlights of Elisa | Integrating Different Paradigms | Getting Started with Elisa | Demo's  | What is Domain Orientation | Bibliography | Copyright | News | Contact | Contents

Language Description:

Lexical Elements | Basic Data Types and Expressions | Definitions | Streams | Backtracking | Statements and Special Expressions | Arrays | Lists | Descriptors | Components | Collections | Generic Components | Terms | Categories | Types | Built-in Definitions | Higher-order Definitions | External Interfaces | Index 

Data Structures: Sequences | Examples involving Lists | Trees | Graphs | Searching State Spaces | Language Processing | Knowledge Representations
Domain Modeling:

Domain Modeling | Concepts | Domain Definitions | Domain Operations | Domain Implementations | Systems | Case study: an Order processing system | Case study: an Airport Support system | Domain Orientation versus Object Orientation

Design Patterns:

Introduction | Abstract Factory | Builder | Factory Method | Prototype | Singleton | Adapter | Bridge | Composite | Decorator | Facade | Flyweight | Proxy | Chain of Responsibility | Command | Interpreter | Iterator | Mediator | Memento | Observer | State | Strategy | Template Method | Visitor 

 

click tracking

This page was last modified on 27-11-2012 16:59:14   

free hit counter