Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
OO Testing Problems Adequate Testing and OOP Perry/Kaiser.
Framework is l Reusable Code, often domain specific (GUI, Net, Web, etc) l expressed as l a set of classes and l the way objects in those classes collaborate.
INTERPRETER Main Topics What is an Interpreter. Why should we learn about them.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Software Testing and Quality Assurance
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Ch3: Software Engineering Principles 1 What is a principle?  Definition:  Goals of accounting principles:  Goals of software engineering principles?
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
HAS. Patterns The use of patterns is essentially the reuse of well established good ideas. A pattern is a named well understood good solution to a common.
From Module Breakdown to Interface Specifications Completing the architectural design of Map Schematizer.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
The Unified Modeling Language (UML) Class Diagrams.
Object Oriented Software Development
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Systems Analysis and Design in a Changing World, Fifth Edition
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Integrating Independent Components with On-Demand Remodularization based on OOPSLA 2002 paper by Mira Mezini Klaus Ostermann Prepared by Karl Lieberherr.
Class Relationships Lecture Oo10 Dependencies. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 5 p.69, Chapt 9 130, Chapt 10.
Expression evaluation E : S | C. S = int. C = Op E E. Op : A | M. A = “+”. M = “*”.
AP/DJ AP: a generic technology DJ: a low-learning-curve implementation of AP.
Slides for Gregor Kiczales Two versions –short version: Crosscutting capabilities for Java and AspectJ through DJ (4 viewgraphs only) –long version: Controlling.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Systems Analysis and Design in a Changing World, 3rd Edition
Law of Demeter. What is it: Style Rule for building systems. Proposed by my research group: The Demeter Research Group in 1987, published in Covered.
Not only mark-up languages! There are other many other grammar formalisms and tools than XML. Some of them standardized (ASN). Even XML does not always.
Chapter 16 Applying UML and Patterns Craig Larman
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
AOP Foundations Doug Orleans Karl Lieberherr. What we did earlier AOP languages have the following main elements: –a join point model (JPM) wrt base PL.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
A modular metadata-driven statistical production system The case of price index production system at Statistics Finland Pekka Mäkelä, Mika Sirviö.
Translating Traversals to AspectJ. Outline Motivation Demeter Process for Traversals AspectJ Translation Process.
Software Engineering Issues Software Engineering Concepts System Specifications Procedural Design Object-Oriented Design System Testing.
DJ: traversal-visitor-style programming in Java Josh Marshall/ Doug Orleans Want to add more on traversal through collections and Aspectual Components.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease.
Rigorous Testing by Merging Structural and Behavioral UML Representations Presented by Chin-Yi Tsai.
Modern Systems Analysis and Design Third Edition Chapter 2 Succeeding as a Systems Analyst 2.1.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
Class Design. Class Design The analysis phase determines what the implementation must do, and the system design.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
AP/DJ AP: a generic technology
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Crosscutting Capabilities for Java and AspectJ through DJ
The Movement To Objects
Design Patterns Lecture part 2.
Good for DJ over Java Extending traversals for collections (b..*)
Behavioral Design Patterns
Chapter 3: Using Methods, Classes, and Objects
Discussion with Gregor Kiczales at UBC
Demeter Aspects Who We Are Aspectual Collaborations
Programming Models for Distributed Application
Lecture 6 Project review
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Subprograms and Programmer Defined Data Type
Third lecture Review Visitor pattern DemeterJ 12/25/2018 SD.
AP/DJ AP: a generic technology
Third lecture Review Visitor pattern DemeterJ 2/17/2019 SD.
APPCs revisited 2/25/2019 APPCs revisited.
Adaptive Programming in JAsCo
Dependency Injection Mechanism
Presentation transcript:

Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004

General Many interpretations for “talk” and “friends”. LOD = Only talk to your friends LoDC = Only talk to your friends that share the same concerns LoDC implies LoD LoD: a module should not know about too many other modules. LoD = Principle of Minimal Information

LoD: OO Send messages only to preferred supplier objects. Preferred suppliers:

LODC Crossing boundaries. Specify separately what is foreign ClassGraph, Strategy, Visitor LoD: organize inside a set of concerns LoDC: separate outside concerns; concern- based growth phases; modularize each growth phase

Summing: LoDC Find all Salary-objects: Traversal concern = WhereToGo concern: only deals with traversal Visitor separately expresses: WhenAndWhatToDo. Describes where traversal is extended –Start: c = 0 –Salary: c+=value

Weaving cg.traverse(o, whereToGo, whatAndWhereToDo); Weaves four concerns: –Structure concern (cg) –Instantiation concern (o) –Traversal concern (whereToGo) –Collaboration concern (whatAndWhereToDo)

How do we find all Salary objects Follow LoD, not good enough Follow DRY Abstract from class graph From Company to Salary And not: Company.divisions.departments. workGroups.employees.getSalary() (not legal in Java, but legal in UML (OCL))

Relational Formulation From object o of class x1, to get to x2, follow edges in the set POSS(x1,x2)={e | x1.( )*.<= x2 } Can easily compute these sets for every x1, x2 via transitive-closure algorithms. POSS = abbreviation for: following these edges it is still possible to reach a x2-object for some x1- object rooted at o. from x1 to x2 (from Company to Salary)

Adaptation Dilemma When a parameterized abstraction P(Q) is given with a broad definition of the domain of the allowed actual parameters, we need to retest and possibly change the abstraction P when we modify the actual parameter, i.e., we move from P(Q1) to P(Q2).

Consequence of Adaptation Dilemma When class graph changes, need to test all strategies

Producing Traversal code For some class graph and strategy combinations we might produce a large number of traversal methods if we are not careful (exponential in worst case). D*J (DemeterJ, DJ, DAJ) avoid this problem. Have built-in efficient code generation.

PaperBoy Example // customer.wallet.totalMoney; // customer.apartment.kitchen. kitchenCabinet.totalMoney; // customer.apartment.bedroom. mattress.totalMoney; we widen the interface of the Customer class and add a method int customer.getPayment(..)

Implications of LoD A general problem of following the LoD is that it leads to wide class interfaces because there are so many ways of traversing through a complex object structure for different purposes. Use abstraction to organize the wide interfaces using the strategy language

Other LoDC Applications Growth plans for class graphs Constructing data structures

Other Applications of LoD Object creation Constructor call: call on a class object Minimize number of such calls follows the LoD (Principle of Minimal Knowledge) A.parse(“object description”)