Objects and Aspects: What we’ve seen so far

Slides:



Advertisements
Similar presentations
Transposing F to C Transposing F to C Andrew Kennedy & Don Syme Microsoft Research Cambridge, U.K.
Advertisements

Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Type Systems and Object- Oriented Programming (III) John C. Mitchell Stanford University.
Object-Oriented Programming
Object-Oriented Programming Python. OO Paradigm - Review Three Characteristics of OO Languages –Inheritance It isn’t necessary to build every class from.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Pedigree Types Yu David Liu, Johns Hopkins University / SUNY Binghamton Scott F. Smith, Johns Hopkins University July 7, IWACO’08.
Module 8 “Polymorphism and Inheritance”. Outline Understanding Inheritance Inheritance Diagrams Constructors in Derived Classes Type Compatibility Polymorphism.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Architectural Reasoning in ArchJava Jonathan Aldrich Craig Chambers David Notkin University of Washington ECOOP ‘02, 13 June 2002.
Object-Oriented Databases
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Java Layers Language Support for Stepwise Refinement Rich Cardone, IBM Research & UT at Austin Calvin Lin, University of Texas at Austin.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Self: The Power of Simplicity David Ungar and Randall B. Smith Presenter: Jonathan Aldrich
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Ruby: Multiple Inheritance, Interfaces, Mixins 1.
Programming Languages and Paradigms Object-Oriented Programming.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
CSC 142 O 1 CSC 142 Java More About Inheritance & Interfaces [Reading: chapter 13]
CS 403 – Programming Languages Class 25 November 28, 2000.
CSE 425: Data Types II Survey of Common Types I Records –E.g., structs in C++ –If elements are named, a record is projected into its fields (e.g., via.
Using Data Groups to Specify and Check Side Effects K. Rustan M. Leino, Arnd Poetzsch- Heffter, and Yunhong Zhou Presented by Jonathan Aldrich.
1 Object Oriented Programming OOP: Many things to many people Some common elements –Objects = state + behavior –Interfaces –Classes –Subtyping, polymorphism.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Chapter 12 Support for Object oriented Programming.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
OO as a language for acm l OO phrase l Mental model of key concepts.
Object Oriented Software Development
Lecture 12 March 16, The Scope of a Variable What if there are two variables with the same name? –A local or block-local variable can have the same.
Object-Oriented Programming Chapter Chapter
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
ISBN Object-Oriented Programming Chapter Chapter
Object vs Class composition By Marine Ruhamanya. Disciplined Inheritance  Problems with implementation inheritance: Encapsulation Fragile Base Class.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Interfaces, Mixins, & Multiple Inheritance CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341, Sp08.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
CSE 341 Section 10 Subtyping, Review, and The Future.
CSCE 240 – Intro to Software Engineering Lecture 3.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
CSE 413 Programming Languages & Implementation Hal Perkins Autumn 2012 Multiple Inheritance, Interfaces, Mixins 1.
Polymorphism in Methods
OOP - Object Oriented Programming
Object Oriented Programming
OOP: Encapsulation &Abstraction
Object-Oriented Modeling
Multi-Methods in Cecil
Behavioral Design Patterns
Types of Programming Languages
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Winter 2013.
Lec 3: Object-Oriented Data Modeling
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2016.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Autumn 2018.
Advanced Java Topics Chapter 9
More Object-Oriented Programming
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Autumn 2017.
Verified Subtyping with Traits and Mixins
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Zach Tatlock Winter 2018.
Fundaments of Game Design
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2017.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2013.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2019.
Presentation transcript:

Objects and Aspects: What we’ve seen so far 15-819 Jonathan Aldrich

In-place vs. Functional Extension In-place extension Add new methods, fields, superclasses to existing ADTs Cecil, EML, Aspects Strengths Can evolve system without planning ahead Direct, first-order composition My opinion: Can’t ignore need for in-place extension in real world due to unplanned evolution/reuse

In-place vs. Functional Extension Produce new classes that enhance old ones Inheritance, Mixins, Scala Strengths Can have different versions of classes side-by-side Simpler semantics and typechecking My opinion: (1) Can get better reuse this way, and (2) Many systems need side-by-side versions

What’s Unique About… (Disclaimer: the systems where we first saw a features are not necessarily the first systems with that features in the research literature) Self Dynamic inheritance Singleton objects (copied by Cecil, Scala) Shared state (copied by Cecil) Overridable fields (copied by Cecil, C#) Cecil (much is actually also in CLOS) Multi-methods In-place extensibility: methods, fields, inheritance Flexible type system: F-bounded poly + structural (partially copied by Scala) Conditional subtyping EML Clean unification of ML-like FP & OOP Combination of pattern matching and multi-methods Modular typechecking of in-place method extension

What’s Unique About… Units/Mixins Scala Side-by-side base classes and extensions Extensions of related groups of classes More flexible reuse through mixins Dynamic, recursive module linking Scala Clean integration of fns and objects But more object-like vs. EML’s design Nice implementation choices XML support, control structure syntax, local type inference Clean version of mixins/multiple inheritance Traits: no state, flexible use Mixins: richer but less flexible Rich parameteric types Variance for type parameters, F-bounded poly., Family Polymorphism, ADTs Views: partial unplanned extensibility Vs. Cecil: views are a new object, not an extended version of the old one

What’s Unique About… F-bounded polymorphism Family polymorphism Binary methods like comparable Hierarchies of families of related types Graph & Node Family polymorphism Keeps different Graphs of same type separate Nested Inheritance Way to refer to surrounding Graph type from Nodes, Edges Typestate for Objects Enforcing client-level protocols in OO setting Correlating typestate to internal invariants Ownership Enforcing encapsulation properties in presence of aliasing, state, and inheritance

Open Problems Typechecking Dynamic inheritance Allow more info. hiding in EML Advanced in-place extensibility (e.g., subclassing) Full flexibility of Units/Mixins Combining family poly. & nested inheritance Combining in-place and functional extensibility Typestate, ownership, etc. Still wide open: increasing expressiveness & checking

Expressiveness Challenges ***Grouped extension Scala, Nested Inheritance Late-bound inheritance ***Parameterized modules with mixins (Units) *Dynamic inheritance (Self) Other idioms ***Multiple dispatch/pattern match (Cecil, EML) **Singleton objects (Self, Cecil, Scala) *Shared state (Self, Cecil) My opinion: *** = necessary, ** = nice, * = interesting

My opinion: *** = necessary, ** = nice, * = interesting Checking Challenges In-place extension **Modular typechecking for open classes (EML) Do they have the rules right yet? Typechecking extensibility features ***Hierarchies of related classes (F-bounded poly) Grouped by object instance (Family poly) With ways of talking about group from within (Nested Inheritance) *Merging structural & nominal (Cecil) Can this be simulated by in-place inheritance extension? ***Checking properties in presence of inheritance Typestate: correct use & impl. of library objects Ownership: encapsulation w/ state, aliasing, inheritance Later: effects and object invariants My opinion: *** = necessary, ** = nice, * = interesting

The Best of Both Worlds? In-place extensibility Add methods, fields, subclasses to ADTs Multi-methods & pattern matching Other AOP features Functional extensibility Parameterized modules & singleton objects Combine family poly. & nested inheritance Dynamic inheritance Combining these is probably non-trivial! What does it mean to extend a parametric module in place?

The Road Ahead AOP Modular reasoning Advanced in-place extensibility techniques Cleaner separation of concerns Empirical validation Modular reasoning In presence of inheritance and AOP