XOTcl an Object-Oriented Scripting Language. First European Tcl/Tk User Meeting, 15/16th June 2000

Similar documents
Work. Second European Tcl/Tk User Meeting, June, 2001.

Enhancing Object-Based System Composition through Per-Object Mixins

XOTcl Tutorial Gustaf Neumann and Uwe Zdun

Filters as a Language Support for Design Patterns in Object-Oriented Scripting Languages

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Towards XOTcl 2.x A Ten-Year Retrospective and Outlook

EuroPLoP 2003 Focus Group: Patterns for Component Composition and Adaptation

SDC Design patterns GoF

Message Redirector. Michael Goedicke Gustaf Neumann Uwe Zdun

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Piecemeal Migration of a Document Archive System with an Architectural Pattern Language

itcl and TclOO From the perspective of a simple user

Some Patterns of Component and Language Integration

C++ for System Developers with Design Pattern

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Message Redirector. Michael Goedicke Gustaf Neumann Uwe Zdun

Advanced C++ Programming Workshop (With C++11, C++14, C++17) & Design Patterns

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Extending Tuscany. Apache Tuscany. Slide 1

Designing runtime variation points in product line architectures: three cases

Summary of the course lectures

Design patterns generic models

Designing Runtime Variation Points in Product Line Architectures: Three. Cases

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Introduction to Software Engineering: Object Design I Reuse & Patterns

DESIGN PATTERN - INTERVIEW QUESTIONS

Using Design Patterns in Java Application Development

Overview of Patterns: Introduction

Conflict Checking of Separation of Duty Constraints in RBAC - Implementation Experiences

UP Requirements. Software Design - Dr Eitan Hadar (c) Activities of greater emphasis in this book. UP Workflows. Business Modeling.

Using Structure and Dependency Tracing Patterns for Aspect Composition

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

Software Design COSC 4353/6353 D R. R A J S I N G H

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Object Oriented Paradigm

SYLLABUS CHAPTER - 1 [SOFTWARE REUSE SUCCESS FACTORS] Reuse Driven Software Engineering is a Business

An Approach for the Semi-automated Derivation of UML Interaction Models from Scenario-based Runtime Tests

POAD Book: Chapter 4: Design Patterns as Components Chapter 5: Visual Design Models

Lecture 4: Observer Pattern, Event Library and Componentization

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

UNIT I Introduction to Design Patterns

A Reconnaissance on Design Patterns

Second European. Tcl/Tk User Meeting

The Strategy Pattern Design Principle: Design Principle: Design Principle:

CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns

Design Patterns. An introduction

A Case Study of Gang of Four (GoF) Patterns: Part 3

Applying Design Patterns to SCA Implementations

3 Product Management Anti-Patterns by Thomas Schranz

Design Pattern and Software Architecture: IV. Design Pattern

COPYRIGHTED MATERIAL. Table of Contents. Foreword... xv. About This Book... xvii. About The Authors... xxiii. Guide To The Reader...

Tuesday, October 4. Announcements

Patterns of Service-Oriented Architectures

Object-Oriented Design

A- Core Java Audience Prerequisites Approach Objectives 1. Introduction

EPC-BASED MODELLING OF BPEL PROCESSES: A PRAGMATIC TRANSFORMATION APPROACH

A Primer on Design Patterns

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

INSTITUTE OF AERONAUTICAL ENGINEERING

An Overview of the Next Scripting Toolkit

PATTERN-ORIENTED SOFTWARE ARCHITECTURE

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

FlexiNet. A flexible component oriented middleware system. Introduction. Architecting for Components. Richard Hayton, Andrew Herbert. APM Ltd.

Top Down Design vs. Modularization

Composite Pattern. IV.4 Structural Pattern

DOT NET Syllabus (6 Months)

02 - Distributed Systems

Magento Technical Guidelines

02 - Distributed Systems

Idioms for Building Software Frameworks in AspectJ

Working with Mediator Framework

Rapid Prototyping with APICES

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

New Programming Paradigms

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Overview of lecture series

Design Patterns in Python (Part 2)

Analysis of software architecture quality metrics

Scripting languages work methodology. Tomasz Bold D11 pok. 107

Object-Oriented Remoting - Basic Infrastructure Patterns

A Mechanism for Runtime Evolution of Objects

Design patterns using Spring and Guice

Design Patterns: Structural and Behavioural

Advanced WCF 4.0 .NET. Web Services. Contents for.net Professionals. Learn new and stay updated. Design Patterns, OOPS Principles, WCF, WPF, MVC &LINQ

R07. IV B.Tech. II Semester Supplementary Examinations, July, 2011

Tcl/Tk lecture. What is the Wish Interpreter? CIS 410/510 User Interface Programming

Topics in Object-Oriented Design Patterns

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship

Page 1

The GoF Design Patterns Reference

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

Transcription:

XOTcl an Object-Oriented Scripting Language Gustaf Neumann Department of Information Systems Vienna University of Economics Vienna, Austria gustaf.neumann@wu-wien.ac.at Uwe Zdun Specification of Software Systems Essen, Germany uwe.zdun@uni-essen.de First European Tcl/Tk User Meeting, 15/16th June 2000

Overview XOTcl = Extended Object Tcl XOTcl is freely available from: http://nestroy.wi-inf.uni-essen.de/xotcl Outline: Scripting and object-orientation, XOTcl high-level language constructs, Example: design pattern-based design of an XML interpreter, xocomm HTTP implementation: performance comparison with Apache. Slide 1

Important Ideas in Tcl: Tcl-Strengths Fast & high-quality development through component-based approach 2 levels: System Language and Glue Language Flexibility through... dynamic extensibility, read/write introspection, automatic type conversion. Component-Interface through Tcl-Commands Scripting language for glueing Slide 2

Motivation for XOTcl Extend the Tcl-Ideas to the OO-level. Just glueing is not enough! Goals are... Architectural support Support for design patterns (e.g. adaptations, observers, facades,... ) Support for composition (and decomposition) Provide flexibility rather than protection: Introspection for all OO concepts All object-class and class-class relationships are dynamically changeable Structural (de)-composition through Dynamic Aggregation Language support for high-level constructs through powerful interceptors (Filters and Per-Object Mixins) Slide 3

Filters A filter is a special instance method registered for a class C. Every time an object of class C receives a message, the filter is invoked automatically. Three parts, each optional: pre-part, call to next, invokes: filter-chain, actual called method. post-part. o pre-part call Class A a1 Filter_3 Filter_2 Filter_1 } filter-chain Class A post-part result Filter-inheritance. Slide 4

Example: Simple Filter Class A A a1 A instproc Filter-1 args { puts "pre-part of Filter-1" next puts "post-part of Filter-1" } A filter Filter-1 a1 set x 1 ;# Class Definition ;# Instance a1 of A ;# Filter instance method ;# Filter registration ;# Method invocation Applications: Trace facility, Composite Pattern, Proxy Pattern, Observers... Slide 5

Per-Object Mixins A per-object mixin is a class which is mixed into the precedence order of an object in front of the precedence order implied by the class hierarchy. Motivation: Model behavior of individual objects (decorator). Object Handle orthogonal aspects not only through multiple inheritance. Intrinsic vs. extrinsic behavior, similar to roles. proc1 Mix1 next... next proc1 proc2 A next Applications: timing, statistics, persistence, life-cycle, chain of responsibility, adapter method invocation per-object mixin anobject instance-of Slide 6

Example Code for Per-Object Mixins Class A A instproc proc1 {} { puts [self class]; next } A instproc proc2 {} { puts [self class]; next } Class Mix1 Mix1 instproc proc1 {} { puts [self class]; next } A anobject anobject mixin Mix1 anobject proc1 anobject proc2 ;# Class definition ;# Method definition ;# Method definition ;# Class definition ;# Method definition ;# Instantiation of class A ;# Mixin registration ;# -> results in output "::Mix1 ::A" ;# -> results in output "::A" Slide 7

Dynamic Object Aggregations and Nested Classes Nesting though namespaces: Classes and objects in XOTcl can contain other classes/objects. Dynamic Object Aggregation resembles Part-of relationship in a dynamic and introspective fashion. Nested Classes reduce interference of independently developed program structures. Class nesting and aggregation semantics are handled through XOTcl object system (including built-in methods for deep copy and deep move). Slide 8

Example Code: Nested Classes/Dynamic Object Aggregation Class Agent Class Agent::Head Class Agent::Body Agent instproc init args { ::Agent::Head [self]::head ::Agent::Body [self]::body } Agent myagent puts "Children: [myagent info children]" myagent::head destroy puts "Children: [myagent info children]" ;# Class definition ;# Nested classes ;# Constructor aggregates two ;# objects dynamically ;# Object creation ;# Output: head body ;# Agent looses his head ;# Output: body Slide 9

Further Functionalities provided in XOTcl Assertions reduce interface and reliability problems caused by dynamic typing: Design by contract: invariants and pre-/post-conditions for methods, per-class and object-specific assertions. Meta-Data enhances self-documentation of objects and classes. Automatic Name Creation with autoname. Abstract Classes, Parameters. Slide 10

Example: XML Parser/Interpreter Constructs a composite object structure from XML documents OO-implementation using design patterns, based on TclXML, around 120 lines (including example visitors and reusable pattern) Changeability and Adaptability through: dynamics, introspection, patterns in hot spots, interceptors per-object and filter, Patterns: Wrapper Facade, Builder, Composite, Interpreter, Visitor, Observer,... Extensibility through new visitors, observers Slide 11

Partial Design of the XML Parser/Interpreter Client Interpreter/Composite Visitor TreeVisitor XMLParser NodeBuilder AbstractNode Builder... XMLNode XMLVisitor TclXMLParser XMLBuilder Functions may be used as per-object mixin VisitObserver TclXML Wrapper Facade Per-Object Observer PrintObserver Slide 12

Assessments size 73 lines (including two more visitors), + 22 lines for the Wrapper Facade and 25 lines for the Composite, Reuseable Composite implementation and reuseable TclXML wrapper, Changeability and Adaptability through: dynamics, introspection, patterns in hot spots, interceptors per-object and filter, Extensibility through new visitors. Slide 13

Seconds Speed Comparison: XOTcl based HTTP Server vs. Apache Single Processor 466MHz Celeron 10MBit Clients 100 80 60 40 20 Seconds 100 80 60 40 20 Dual 200 MHz PPro Server 10MBit Clients Seconds Single Processor 466MHz Celeron Local Clients 100 80 60 40 20 XOTcl Server Apache 1.3.6 Ratio (Percent) 0 0 0 20 0 10 20 Clients 20 0 10 20 Clients 20 0 10 20 Clients Basic functionality of HTTP/1.1 in around 250-400 lines of XOTcl code 1-20 simultanoues client sessions issuing each 76 HTTP requests. Modern CPUs are fast enough to execute even complex applications in object-oriented scripting language with sufficient speed. Slide 14

Summary and Conclusions XOTcl provides high-level language constructs for software composition, tailored for the use with scripting applications: dynamics, (read/write) introspection, flexible glueing of (preexisting) components. Combination of: scripting, object-orientation, and high-level language constructs Flexible composition of software systems. Coping with changes at runtime/design time. Slide 15

More XOTcl Material : Filters as a Language Support for Design Patterns in Object-Oriented Scripting Languages, Proceedings of the 5th Conference on Object-Oriented Technologies and Systems (COOTS 99), San Diego, May 3-9, 1999. : Enhancing Object-Based System Composition through Per- Object Mixins, Proceedings of Asia-Pacific Software Engineering Conference (APSEC 99), Takamatsu, Japan, December 6-10, 1999. : Towards the Usage of Dynamic Object Aggregations as a Form of Composition, Proceedings of Symposium of Applied Computing (SAC 00), Como, Italy, March 19-21, 2000. : High-Level Design and Architecture of an HTTP-Based Infrastructure for Web Applications, Word Wide Web Journal, Baltzer, early 2000. More on http://www.xotcl.org, http://nestroy.wi-inf.uni-essen.de/xotcl Slide 16