Method Combinators. e ELS 2018 E. Didier Verna. EPITA / LRDE. Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion

Size: px
Start display at page:

Download "Method Combinators. e ELS 2018 E. Didier Verna. EPITA / LRDE. Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion"

Transcription

1 Method Combinators e ELS 2018 E Didier Verna EPITA / LRDE didier@lrde.epita.fr didier.verna google+ in/didierverna

2 Introduction CLOS improvements over mainstream object systems Multiple dispatch Increased SOC: polymorphism / inheritance MOP Homogeneous behavioral reflection Method combinations Increased SOC: methods / dispatch Standardization drawbacks Method combinations underspecified Considered not mature enough MOP only a later addition Unclear or contradictory protocols Method Combinators / ELS 2018 Didier Verna 2/27

3 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 3/27

4 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 4/27

5 Orthogonality Short combination example (defgeneric details (human) (:method-combination append :most-specific-last) (:method append ((human human))...) (:method append ((employee employee))...)) Problems Method qualification required Combination change impractical Except for the option Inconsistent No :before or :after methods No good reason Workaround: long method combinations Method Combinators / ELS 2018 Didier Verna 5/27

6 Structure System classes method-combination Abstract <unspecified> Portable specialization impossible At least one implementation-specific (sub)class Unclear nature (classes vs. instances) Mix of define / call-time parametrization Method Combinators / ELS 2018 Didier Verna 6/27

7 Protocols Lookup (MOP) find-method-combination gf name options called to determine the combination object used by a generic function What are name and options for? Error behavior? There already is generic-function-method-combination Method Combinators / ELS 2018 Didier Verna 7/27

8 Protocols (cont.) Generic function invocation protocol (MOP) compute-effective-method gf combination methods What is combination for? Caching policy unspecified Contrary to applicable methods Method Combinators / ELS 2018 Didier Verna 8/27

9 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 9/27

10 Classes Method combination classes hierarchy standard-method-combination type-name options short-method-combination operator identity-with-one-argument long-method-combination function args-lambda-list options: use-time (:method-combination options) Below: define-time Method Combinators / ELS 2018 Didier Verna 10/27

11 Short Method Combinations Creation (define-method-combination name option*) (find-method-combination /// gf (eql name) options) short combination object No global namespace One method combination object per generic function Redefinitions don t affect existing generic functions find-method-combination the expected or the specified Method Combinators / ELS 2018 Didier Verna 11/27

12 Long Method Combinations Long method combination functions *long-method-combination-functions* long-method-combination function args-lambda-list Similar behavior, one additional oddity Local method combination objects Global method combination functions Method Combinators / ELS 2018 Didier Verna 12/27

13 Code Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion Long Method Combinations (cont.) (define-method-combination my-progn () ((primary () :order :most-specific-first :required t)) (lambda (method) `(call-method,method)) primary))) (defgeneric test (i) (:method-combination my-progn) (:method ((i number)) (print 'number)) (:method ((i fixnum)) (print 'fixnum))) REPL CL-USER> (test 1) FIXNUM NUMBER Method Combinators / ELS 2018 Didier Verna 13/27

14 Code Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion Long Method Combinations (cont.) (define-method-combination my-progn () ((primary () :order :most-specific-last :required t)) (lambda (method) `(call-method,method)) primary))). REPL CL-USER> (test 1) FIXNUM NUMBER Method Combinators / ELS 2018 Didier Verna 13/27

15 Code Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion Long Method Combinations (cont.) (defmethod test ((i float)) (print 'float)). REPL CL-USER> (test 1.5) CL-USER> (test 1) NUMBER FIXNUM FLOAT NUMBER Method Combinators / ELS 2018 Didier Verna 13/27

16 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 14/27

17 Overview Classes short-method-combination long-method-combination method-combinator-mixin clients short-method-combinator long-method-combinator Stored in a global hash table [setf] find-method-combinator Method Combinators / ELS 2018 Didier Verna 15/27

18 Protocols In 3 layers define-[short long]-method-combinator ensure-[short long]-method-combinator ensure-[short long]-method-combinator-using-class Method Combinators / ELS 2018 Didier Verna 16/27

19 In 4 steps Introduction Issues SBCL Combinators CGFs Alt. MCs Perfs Conclusion Implementation (layer 3) define a regular combination (find-method-combination) retrieve it (change-class) make it combinator (setf find-method-combinator) store it Note: regular combination injection Method Combinators / ELS 2018 Didier Verna 17/27

20 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 18/27

21 Overview Classes standard-generic-function funcallable-standard-class «instanceof» combined-generic-function functions Wrappers (defcombined cgf (args...) (:method-combinator mc)...) Method Combinators / ELS 2018 Didier Verna 19/27

22 Method Combinator Management Initialization (defmethod find-method-combination (cgf-class-prototype...) (find-method-combinator...)) Sanitation (defmethod find-method-combination (cgf...) (method-combinator cfg) # or mismatch error #) Updating (change-method-combinator cgf method-combinator) Method Combinators / ELS 2018 Didier Verna 20/27

23 Client Maintenance method-combinator-mixin clients cgf cgf cgf Client registration: ([re]initialize-instance cgf...) Client updating: (reinitialize-instance mc...) (u-i-f-d-c mc...) New protocol make-clients-obsolete update-combined-generic-function-for-redefined-method-combinator Method Combinators / ELS 2018 Didier Verna 21/27

24 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 22/27

25 Overview Idea: generic functions / combinators complete decoupling Use: logical method combinations, selected methods etc. Note: already possible, but extremely costly 2 calls to reinitialize-instance Protocols (call-with-combinator (find-method-combinator 'combinator) #'func arg1 arg2...) (call/cb combinator func arg1 arg2...) #!combinator(func arg1 arg2...) Method Combinators / ELS 2018 Didier Verna 23/27

26 Optimization combined-generic-function functions df df df Discriminating functions caches Client maintenance aware of them Cost First alternative call: as before Next: 1 or 2 hashtable lookups Warning: discriminating functions must close over all caches! Method Combinators / ELS 2018 Didier Verna 24/27

27 Plan Method Combinations Issues The Case of SBCL Method Combinators Combined Generic Functions Alternative Combinators Performance Method Combinators / ELS 2018 Didier Verna 25/27

28 Performance 6 5 alt. :+ alt. :progn progn:progn 4 (seconds) 3 + :+ 2 1 std :std std :std 0 Numeric (10e8 iterations) I/O (10e7 iterations) Method Combinators / ELS 2018 Didier Verna 26/27

29 Conclusion / Perspectives Conclusion Method combinations are powerful yet underspecified Method combinators improve their consistency Code available on GitHub Perspectives Refine / properly package implementation Port to other compilers Experiment with floating floating methods Method Combinators / ELS 2018 Didier Verna 27/27

Custom Specializers in Object-Oriented Lisp

Custom Specializers in Object-Oriented Lisp Custom Cadence Design Systems Goldsmiths, University of London 23rd May 2008 Common : Skill: Unification of various dialects; Not dead yet. Common Skill Internal dialect from Cadence Design Systems; Extension

More information

Common Lisp Object System Specification. 1. Programmer Interface Concepts

Common Lisp Object System Specification. 1. Programmer Interface Concepts Common Lisp Object System Specification 1. Programmer Interface Concepts Authors: Daniel G. Bobrow, Linda G. DeMichiel, Richard P. Gabriel, Sonya E. Keene, Gregor Kiczales, and David A. Moon. Draft Dated:

More information

Binary Methods Programming: the Clos Perspective

Binary Methods Programming: the Clos Perspective Journal of Universal Computer Science, vol. 14, no. 20 (2008), 3389-3411 submitted: 23/6/08, accepted: 24/8/08, appeared: 28/11/08 J.UCS Binary Methods Programming: the Clos Perspective Didier Verna (Epita

More information

Performance and Genericity

Performance and Genericity 1/77 General Part I: Performance Part II: Genericity Performance and Genericity the forgotten power of didier@lrde.epita.fr http://www.lrde.epita.fr/ didier April 05 ACCU 2008 2/77 Some Background Which

More information

Multi-Methods in Racket

Multi-Methods in Racket Multi-Methods in Racket António Menezes Leitão April, 18, 2013 1 Introduction Multi-methods are an advanced concept that extends the single dispatch approach that is used in the majority of object-oriented

More information

Revisiting the Visitor: the Just Do It Pattern

Revisiting the Visitor: the Just Do It Pattern Journal of Universal Computer Science, vol. 16, no. 2 (2010), 246-270 submitted: 19/10/09, accepted: 10/12/09, appeared: 28/1/10 J.UCS Revisiting the Visitor: the Just Do It Pattern Didier Verna (Epita

More information

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89

Symbolic Programming. Dr. Zoran Duric () Symbolic Programming 1/ 89 August 28, / 89 Symbolic Programming Symbols: +, -, 1, 2 etc. Symbolic expressions: (+ 1 2), (+ (* 3 4) 2) Symbolic programs are programs that manipulate symbolic expressions. Symbolic manipulation: you do it all the

More information

NST: A Unit Test Framework for Common Lisp

NST: A Unit Test Framework for Common Lisp Smart Information Flow Technologies (SIFT, LLC) TC-lispers, June 9, 2009 Outline 1 Unit testing 2 3 The basic idea Early implementations, and other lessons How it maybe should work 4 What is unit testing?

More information

Object Oriented Programming (OOP)

Object Oriented Programming (OOP) Object Oriented Programming (OOP) o New programming paradigm o Actions Objects o Objects Actions o Object-oriented = Objects + Classes + Inheritance Imperative programming o OOP (Object-Oriented Programming)

More information

A little bit of Lisp

A little bit of Lisp B.Y. Choueiry 1 Instructor s notes #3 A little bit of Lisp Introduction to Artificial Intelligence CSCE 476-876, Fall 2017 www.cse.unl.edu/~choueiry/f17-476-876 Read LWH: Chapters 1, 2, 3, and 4. Every

More information

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object

More information

A Genetic Algorithm Implementation

A Genetic Algorithm Implementation A Genetic Algorithm Implementation Roy M. Turner (rturner@maine.edu) Spring 2017 Contents 1 Introduction 3 2 Header information 3 3 Class definitions 3 3.1 Individual..........................................

More information

Principles of Programming Languages, 2

Principles of Programming Languages, 2 Principles of Programming Languages, 2 Matteo Pradella February 2015 Matteo Pradella Principles of Programming Languages, 2 February 2015 1 / 23 1 Object Oriented Programming (OO) Matteo Pradella Principles

More information

Symbolic Computation and Common Lisp

Symbolic Computation and Common Lisp Symbolic Computation and Common Lisp Dr. Neil T. Dantam CSCI-56, Colorado School of Mines Fall 28 Dantam (Mines CSCI-56) Lisp Fall 28 / 92 Why? Symbolic Computing: Much of this course deals with processing

More information

Jatha. Common Lisp in Java. Ola Bini JRuby Core Developer ThoughtWorks Studios.

Jatha. Common Lisp in Java. Ola Bini JRuby Core Developer ThoughtWorks Studios. Jatha Common Lisp in Java Ola Bini JRuby Core Developer ThoughtWorks Studios ola.bini@gmail.com http://olabini.com/blog Common Lisp? Common Lisp? ANSI standard Common Lisp? ANSI standard Powerful Common

More information

Records. ADTs. Objects as Records. Objects as ADTs. Objects CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 15: Objects 25 Feb 05

Records. ADTs. Objects as Records. Objects as ADTs. Objects CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 15: Objects 25 Feb 05 Records CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 15: Objects 25 Feb 05 Objects combine features of records and abstract data types Records = aggregate data structures Combine several

More information

Object oriented programming

Object oriented programming Object oriented programming The main ideas behind object-oriented programming: the same type of action may be carried out differently on different types of objects cutting a cake is different from cutting

More information

Data Abstraction. Hwansoo Han

Data Abstraction. Hwansoo Han Data Abstraction Hwansoo Han Data Abstraction Data abstraction s roots can be found in Simula67 An abstract data type (ADT) is defined In terms of the operations that it supports (i.e., that can be performed

More information

Custom Specializers in Object-Oriented Lisp

Custom Specializers in Object-Oriented Lisp Journal of Universal Computer Science, vol. 14, no. 20 (2008), 3370-3388 submitted: 23/6/08, accepted: 24/8/08, appeared: 28/11/08 J.UCS Custom Specializers in Object-Oriented Lisp Jim Newton (Cadence

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

More information

Custom Specializers in Object-Oriented Lisp

Custom Specializers in Object-Oriented Lisp Custom Specializers in Object-Oriented Lisp Jim Newton Cadence Design Systems Mozartstrasse 2 D-85622 Feldkirchen Germany jimka@cadence.com Christophe Rhodes Department of Computing Goldsmiths, University

More information

TDDB84: Lecture 09. SOLID, Language design, Summary. fredag 11 oktober 13

TDDB84: Lecture 09. SOLID, Language design, Summary. fredag 11 oktober 13 TDDB84: Lecture 09 SOLID, Language design, Summary SOLID Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation principle Depency inversion principle

More information

A Brief Introduction to Common Lisp

A Brief Introduction to Common Lisp A Brief Introduction to Common Lisp David Gu Schloer Consulting Group david_guru@gty.org.in A Brief History Originally specified in 1958, Lisp is the second-oldest highlevel programming language in widespread

More information

9/17/2018 Programming Data Structures. Encapsulation and Inheritance

9/17/2018 Programming Data Structures. Encapsulation and Inheritance 9/17/2018 Programming Data Structures Encapsulation and Inheritance 1 Encapsulation private instance variables Exercise: 1. Create a new project in your IDE 2. Download: Employee.java, HourlyEmployee.java

More information

Java Overview An introduction to the Java Programming Language

Java Overview An introduction to the Java Programming Language Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

Common Lisp. Blake McBride

Common Lisp. Blake McBride Contents Common Lisp Blake McBride (blake@mcbride.name) 1 Data Types 2 2 Numeric Hierarchy 3 3 Comments 3 4 List Operations 4 5 Evaluation and Quotes 5 6 String Operations 5 7 Predicates 6 8 Math Predicates

More information

CS 480. Lisp J. Kosecka George Mason University. Lisp Slides

CS 480. Lisp J. Kosecka George Mason University. Lisp Slides CS 480 Lisp J. Kosecka George Mason University Lisp Slides Symbolic Programming Symbols: +, -, 1, 2 etc. Symbolic expressions: (+ 1 2), (+ (* 3 4) 2) Symbolic programs are programs that manipulate symbolic

More information

Cool Abstract Syntax Trees

Cool Abstract Syntax Trees constructors phyla classes lists Cool Abstract Syntax Trees Cool ASTs [Bono] 1 Cool AST overview review: abstract syntax tree is a concrete data structure we build while parsing one C++ class per Cool

More information

Java: introduction to object-oriented features

Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

AllegroCache: an Introduction

AllegroCache: an Introduction AllegroCache: an Introduction David Margolies (dm@franz.com) Questions and comments to support@franz.com Topics What is AllegroCache? Getting started Persistent classes and objects Transactions, committing

More information

OBJECT ORIENTED PROGRAMMING USING C++

OBJECT ORIENTED PROGRAMMING USING C++ OBJECT ORIENTED PROGRAMMING USING C++ 1 Overloading, Overriding POLYMORPHISM poly morphos many forms Overloading single method name having several alternative implementations. Overriding child class provides

More information

CS 251 Intermediate Programming Inheritance

CS 251 Intermediate Programming Inheritance CS 251 Intermediate Programming Inheritance Brooke Chenoweth University of New Mexico Spring 2018 Inheritance We don t inherit the earth from our parents, We only borrow it from our children. What is inheritance?

More information

Allegro CL Certification Program

Allegro CL Certification Program Allegro CL Certification Program Lisp Programming Series Level I Review David Margolies 1 Summary 1 A lisp session contains a large number of objects which is typically increased by user-created lisp objects

More information

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

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns EPL 603 TOPICS IN SOFTWARE ENGINEERING Lab 6: Design Patterns Links to Design Pattern Material 1 http://www.oodesign.com/ http://www.vincehuston.org/dp/patterns_quiz.html Types of Design Patterns 2 Creational

More information

Dynamic Dispatch and Duck Typing. L25: Modern Compiler Design

Dynamic Dispatch and Duck Typing. L25: Modern Compiler Design Dynamic Dispatch and Duck Typing L25: Modern Compiler Design Late Binding Static dispatch (e.g. C function calls) are jumps to specific addresses Object-oriented languages decouple method name from method

More information

CS 842 Ben Cassell University of Waterloo

CS 842 Ben Cassell University of Waterloo CS 842 Ben Cassell University of Waterloo Recursive Descent Re-Cap Top-down parser. Works down parse tree using the formal grammar. Built from mutually recursive procedures. Typically these procedures

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

What is Software Architecture

What is Software Architecture What is Software Architecture Is this diagram an architecture? (ATM Software) Control Card Interface Cash Dispenser Keyboard Interface What are ambiguities in the previous diagram? Nature of the elements

More information

Implementing Symmetric Multiprocessing in LispWorks

Implementing Symmetric Multiprocessing in LispWorks Implementing Symmetric Multiprocessing in LispWorks Making a multithreaded application more multithreaded Martin Simmons, LispWorks Ltd Copyright 2009 LispWorks Ltd Outline Introduction Changes in LispWorks

More information

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. More Common Lisp

INF4820: Algorithms for Artificial Intelligence and Natural Language Processing. More Common Lisp INF4820: Algorithms for Artificial Intelligence and Natural Language Processing More Common Lisp Stephan Oepen & Murhaf Fares Language Technology Group (LTG) September 6, 2017 Agenda 2 Previously Common

More information

Comp-304 : Object-Oriented Design What does it mean to be Object Oriented?

Comp-304 : Object-Oriented Design What does it mean to be Object Oriented? Comp-304 : Object-Oriented Design What does it mean to be Object Oriented? What does it mean to be OO? What are the characteristics of Object Oriented programs (later: OO design)? What does Object Oriented

More information

Contents in Detail. Who This Book Is For... xx Using Ruby to Test Itself... xx Which Implementation of Ruby?... xxi Overview...

Contents in Detail. Who This Book Is For... xx Using Ruby to Test Itself... xx Which Implementation of Ruby?... xxi Overview... Contents in Detail Foreword by Aaron Patterson xv Acknowledgments xvii Introduction Who This Book Is For................................................ xx Using Ruby to Test Itself.... xx Which Implementation

More information

INF4820. Common Lisp: Closures and Macros

INF4820. Common Lisp: Closures and Macros INF4820 Common Lisp: Closures and Macros Erik Velldal University of Oslo Oct. 19, 2010 Erik Velldal INF4820 1 / 22 Topics for Today More Common Lisp A quick reminder: Scope, binding and shadowing Closures

More information

Using a waiting protocol to separate concerns in the mutual exclusion problem

Using a waiting protocol to separate concerns in the mutual exclusion problem Using a waiting protocol to separate concerns in the mutual exclusion problem Frode V. Fjeld frodef@cs.uit.no Department of Computer Science, University of Tromsø Technical Report 2003-46 November 21,

More information

Smalltalk: developed at Xerox Palo Alto Research Center by the Learning Research Group in the 1970 s (Smalltalk-72, Smalltalk-76, Smalltalk-80)

Smalltalk: developed at Xerox Palo Alto Research Center by the Learning Research Group in the 1970 s (Smalltalk-72, Smalltalk-76, Smalltalk-80) A Bit of History Some notable examples of early object-oriented languages and systems: Sketchpad (Ivan Sutherland s 1963 PhD dissertation) was the first system to use classes and instances (although Sketchpad

More information

Method Resolution Approaches. Dynamic Dispatch

Method Resolution Approaches. Dynamic Dispatch Method Resolution Approaches Static - procedural languages (w/o fcn ptrs) Dynamically determined by data values C with function pointers Compile-time analysis can estimate possible callees Dynamically

More information

CS2141 Software Development using C/C++ C++ Basics

CS2141 Software Development using C/C++ C++ Basics CS2141 Software Development using C/C++ C++ Basics Integers Basic Types Can be short, long, or just plain int C++ does not define the size of them other than short

More information

Lecture 16: Object Programming Languages

Lecture 16: Object Programming Languages Lecture 16: Object Programming Languages Introduction Corresponds to EOPL 5.1 and 5.2 Goal: to introduce Object Oriented Programming Language (OOPL) concepts using the EOPL extensible language framework

More information

Aspect-Oriented Programming On Lisp

Aspect-Oriented Programming On Lisp 6 th International Conference on Applied Informatics Eger, Hungary, January 27 31, 2004. Aspect-Oriented Programming On Lisp Miklós Espák Department of Information Technology, University of Debrecen e-mail:

More information

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM)

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Course Name: Intro to Ruby Course Number: WITP 312 Credits: Classroom Hours: 1.2 CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Flex Training - Classroom and On-Line

More information

Object Model. Object Oriented Programming Spring 2015

Object Model. Object Oriented Programming Spring 2015 Object Model Object Oriented Programming 236703 Spring 2015 Class Representation In Memory A class is an abstract entity, so why should it be represented in the runtime environment? Answer #1: Dynamic

More information

SCOOP: a static C++ object-oriented paradigm

SCOOP: a static C++ object-oriented paradigm SCOOP: a static C++ object-oriented paradigm Thomas Moulard LRDE EPITA Research and Development Laboratory January 9, 2008 Thomas Moulard SCOOP: a static C++ object-oriented paradigm 1 / 27 Outline 1 Introduction

More information

2. Reasons for implementing clos-unit

2. Reasons for implementing clos-unit A CLOS Implementation of the JUnit Testing Framework Architecture: A Case Study Sandro Pedrazzini Canoo Engineering AG sandro.pedrazzini@canoo.com Abstract There are different reasons why you would like

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

Robot Programming with Lisp

Robot Programming with Lisp 4. Functional Programming: Higher-order Functions, Map/Reduce, Lexical Scope Institute for Artificial University of Bremen 9 of November, 2017 Functional Programming Pure functional programming concepts

More information

Project 6 Due 11:59:59pm Thu, Dec 10, 2015

Project 6 Due 11:59:59pm Thu, Dec 10, 2015 Project 6 Due 11:59:59pm Thu, Dec 10, 2015 Updates None yet. Introduction In this project, you will add a static type checking system to the Rube programming language. Recall the formal syntax for Rube

More information

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

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently. Gang of Four Software Design Patterns with examples STRUCTURAL 1) Adapter Convert the interface of a class into another interface clients expect. It lets the classes work together that couldn't otherwise

More information

Artificial Intelligence Programming

Artificial Intelligence Programming Artificial Intelligence Programming Rob St. Amant Department of Computer Science North Carolina State University Lisp basics NC State University 2 / 99 Why Lisp? Some recent Lisp success stories include

More information

What is Inheritance?

What is Inheritance? Inheritance 1 Agenda What is and Why Inheritance? How to derive a sub-class? Object class Constructor calling chain super keyword Overriding methods (most important) Hiding methods Hiding fields Type casting

More information

CSCI337 Organisation of Programming Languages LISP

CSCI337 Organisation of Programming Languages LISP Organisation of Programming Languages LISP Getting Started Starting Common Lisp $ clisp i i i i i i i ooooo o ooooooo ooooo ooooo I I I I I I I 8 8 8 8 8 o 8 8 I \ `+' / I 8 8 8 8 8 8 \ `-+-' / 8 8 8 ooooo

More information

Dynamic ADTs: a don t ask, don t tell policy for data abstraction

Dynamic ADTs: a don t ask, don t tell policy for data abstraction Dynamic ADTs: a don t ask, don t tell policy for data abstraction Geoff Wozniak Dept. of Computer Science University of Western Ontario London, Ontario, Canada wozniak@csd.uwo.ca Mark Daley Depts. of Computer

More information

Object Orientated Analysis and Design. Benjamin Kenwright

Object Orientated Analysis and Design. Benjamin Kenwright Notation Part 2 Object Orientated Analysis and Design Benjamin Kenwright Outline Review What do we mean by Notation and UML? Types of UML View Continue UML Diagram Types Conclusion and Discussion Summary

More information

Common LISP-Introduction

Common LISP-Introduction Common LISP-Introduction 1. The primary data structure in LISP is called the s-expression (symbolic expression). There are two basic types of s-expressions: atoms and lists. 2. The LISP language is normally

More information

Python Basics. Lecture and Lab 5 Day Course. Python Basics

Python Basics. Lecture and Lab 5 Day Course. Python Basics Python Basics Lecture and Lab 5 Day Course Course Overview Python, is an interpreted, object-oriented, high-level language that can get work done in a hurry. A tool that can improve all professionals ability

More information

A Survey of Current CLOS MOP Implementations

A Survey of Current CLOS MOP Implementations A Survey of Current CLOS MOP Implementations Raymond de Lacaze Artificial Intelligence Center SRI International 333 Ravenswood Ave. Menlo Park, CA 9402 delacaze@ai.sri.com Tim Bradshaw Cley Limited 6 East

More information

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes.

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes. a and Interfaces Class Shape Hierarchy Consider the following class hierarchy Shape Circle Square Problem AND Requirements Suppose that in order to exploit polymorphism, we specify that 2-D objects must

More information

Inheritance -- Introduction

Inheritance -- Introduction Inheritance -- Introduction Another fundamental object-oriented technique is called inheritance, which, when used correctly, supports reuse and enhances software designs Chapter 8 focuses on: the concept

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Robot Programming with Lisp

Robot Programming with Lisp 2. Imperative Programming Institute for Artificial University of Bremen Lisp the Language LISP LISt Processing language 2 Lisp the Language LISP LISt Processing language (LISP Lots of Irritating Superfluous

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Object Model. Object Oriented Programming Winter

Object Model. Object Oriented Programming Winter Object Model Object Oriented Programming 236703 Winter 2014-5 Class Representation In Memory A class is an abstract entity, so why should it be represented in the runtime environment? Answer #1: Dynamic

More information

NOTICE WARNING CONCERNING COPYRIGHT RESTRICTIONS: The copyright law of the United States (title 17, U.S. Code) governs the making of photocopies or

NOTICE WARNING CONCERNING COPYRIGHT RESTRICTIONS: The copyright law of the United States (title 17, U.S. Code) governs the making of photocopies or NOTICE WARNING CONCERNING COPYRIGHT RESTRICTIONS: The copyright law of the United States (title 17, U.S. Code) governs the making of photocopies or other reproductions of copyrighted material. Any copying

More information

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries 1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

Fast Introduction to Object Oriented Programming and C++

Fast Introduction to Object Oriented Programming and C++ Fast Introduction to Object Oriented Programming and C++ Daniel G. Aliaga Note: a compilation of slides from Jacques de Wet, Ohio State University, Chad Willwerth, and Daniel Aliaga. Outline Programming

More information

Debugging in LISP. trace causes a trace to be printed for a function when it is called

Debugging in LISP. trace causes a trace to be printed for a function when it is called trace causes a trace to be printed for a function when it is called ;;; a function that works like reverse (defun rev (list) (cons (first (last list)) (rev (butlast list)))) USER: (trace rev) ; note trace

More information

JOVE. An Optimizing Compiler for Java. Allen Wirfs-Brock Instantiations Inc.

JOVE. An Optimizing Compiler for Java. Allen Wirfs-Brock Instantiations Inc. An Optimizing Compiler for Java Allen Wirfs-Brock Instantiations Inc. Object-Orient Languages Provide a Breakthrough in Programmer Productivity Reusable software components Higher level abstractions Yield

More information

Practical Session 11: The Visitor Pattern

Practical Session 11: The Visitor Pattern Practical Session 11: The Visitor Pattern Reminder: Polymorphic Variables Reminder: Polymorphic Variables Animal animal; animal = new Dog; + say() * Animal * animal.say(); \\ Woof animal = new Cat; animal.say();

More information

Inheritance & Polymorphism

Inheritance & Polymorphism E H U N I V E R S I T Y T O H F R G E D I N B U Murray Cole Classifying Things 1 Hierarchies help us to classify things and understand their similarities and differences Some aspects are common to everything

More information

Common LISP Tutorial 1 (Basic)

Common LISP Tutorial 1 (Basic) Common LISP Tutorial 1 (Basic) CLISP Download https://sourceforge.net/projects/clisp/ IPPL Course Materials (UST sir only) Download https://silp.iiita.ac.in/wordpress/?page_id=494 Introduction Lisp (1958)

More information

Object Oriented Programming. Java-Lecture 11 Polymorphism

Object Oriented Programming. Java-Lecture 11 Polymorphism Object Oriented Programming Java-Lecture 11 Polymorphism Abstract Classes and Methods There will be a situation where you want to develop a design of a class which is common to many classes. Abstract class

More information

Strategies for typecase optimization

Strategies for typecase optimization Strategies for typecase optimization Jim E. Newton jnewton@lrde.epita.fr EPITA/LRDE 14-16 rue Voltaire F-94270 Le Kremlin-Bicêtre France Didier Verna didier@lrde.epita.fr ABSTRACT We contrast two approaches

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

Distributed Real-Time Control Systems. Lecture 14 Intro to C++ Part III

Distributed Real-Time Control Systems. Lecture 14 Intro to C++ Part III Distributed Real-Time Control Systems Lecture 14 Intro to C++ Part III 1 Class Hierarchies The human brain is very efficient in finding common properties to different entities and classify them according

More information

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments

Administrivia. Java Review. Objects and Variables. Demo. Example. Example: Assignments CMSC433, Spring 2004 Programming Language Technology and Paradigms Java Review Jeff Foster Feburary 3, 2004 Administrivia Reading: Liskov, ch 4, optional Eckel, ch 8, 9 Project 1 posted Part 2 was revised

More information

Introduction to Reflective Java

Introduction to Reflective Java Introduction to Reflective Java Zhixue Wu & Scarlet Schwiderski APM Ltd. 12 Nov. 1997 1 1997 ANSA Consortium Requirements Observations The one size fits all design strategy becomes obsolete mobile computing,

More information

Chapter 11 Object and Object- Relational Databases

Chapter 11 Object and Object- Relational Databases Chapter 11 Object and Object- Relational Databases Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Outline Overview of Object Database Concepts Object-Relational

More information

FUNKCIONÁLNÍ A LOGICKÉ PROGRAMOVÁNÍ 4. LISP: PROMĚNNÉ, DALŠÍ VLASTNOSTI FUNKCÍ, BLOKY, MAPOVACÍ FUNKCIONÁLY, ITERAČNÍ CYKLY,

FUNKCIONÁLNÍ A LOGICKÉ PROGRAMOVÁNÍ 4. LISP: PROMĚNNÉ, DALŠÍ VLASTNOSTI FUNKCÍ, BLOKY, MAPOVACÍ FUNKCIONÁLY, ITERAČNÍ CYKLY, FUNKCIONÁLNÍ A LOGICKÉ PROGRAMOVÁNÍ 4. LISP: PROMĚNNÉ, DALŠÍ VLASTNOSTI FUNKCÍ, BLOKY, MAPOVACÍ FUNKCIONÁLY, ITERAČNÍ CYKLY, 2011 Jan Janoušek MI-FLP Evropský sociální fond Praha & EU: Investujeme do vaší

More information

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Object-Oriented Programming (OOP) Fundamental Principles of OOP Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is

More information

Design Patterns: State, Bridge, Visitor

Design Patterns: State, Bridge, Visitor Design Patterns: State, Bridge, Visitor State We ve been talking about bad uses of case statements in programs. What is one example? Another way in which case statements are sometimes used is to implement

More information

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

Work. Second European Tcl/Tk User Meeting, June, 2001. XOTcl @ Work 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

More information

JavaScript: the Big Picture

JavaScript: the Big Picture JavaScript had to look like Java only less so be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JavaScript would have happened.! JavaScript:

More information

Announcement. Agenda 7/31/2008. Polymorphism, Dynamic Binding and Interface. The class will continue on Tuesday, 12 th August

Announcement. Agenda 7/31/2008. Polymorphism, Dynamic Binding and Interface. The class will continue on Tuesday, 12 th August Polymorphism, Dynamic Binding and Interface 2 4 pm Thursday 7/31/2008 @JD2211 1 Announcement Next week is off The class will continue on Tuesday, 12 th August 2 Agenda Review Inheritance Abstract Array

More information

Polymorphism. Arizona State University 1

Polymorphism. Arizona State University 1 Polymorphism CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 15 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University

More information

Design issues for objectoriented. languages. Objects-only "pure" language vs mixed. Are subclasses subtypes of the superclass?

Design issues for objectoriented. languages. Objects-only pure language vs mixed. Are subclasses subtypes of the superclass? Encapsulation Encapsulation grouping of subprograms and the data they manipulate Information hiding abstract data types type definition is hidden from the user variables of the type can be declared variables

More information

Clarifying Roles. Jonathan Worthington German Perl Workshop 2007

Clarifying Roles. Jonathan Worthington German Perl Workshop 2007 Clarifying Roles Jonathan Worthington German Perl Workshop 2007 The Perl 6 Object Model The Perl 6 object model attempts to improve on the Perl 5 one Nicer, more declarative syntax One way to do things,

More information

MIT Semantic Analysis. Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology

MIT Semantic Analysis. Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology MIT 6.035 Semantic Analysis Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Error Issue Have assumed no problems in building IR But are many static checks that need

More information

Topics in Object-Oriented Design Patterns

Topics in Object-Oriented Design Patterns Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;

More information

Context-oriented Programming. Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany)

Context-oriented Programming. Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany) Context-oriented Programming Pascal Costanza (Vrije Universiteit Brussel, Belgium) Robert Hirschfeld (Hasso-Plattner-Institut, Potsdam, Germany) Programs are too static! Mobile devices Software agents

More information

Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3. Course Code: GK1965. Overview

Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3. Course Code: GK1965. Overview Fast Track to Core Java 8 Programming for OO Developers (TT2101-J8) Day(s): 3 Course Code: GK1965 Overview Java 8 Essentials for OO Developers is a three-day, fast-paced, quick start to Java 8 training

More information