CPSC 3720 - DAY 19 MARCH 6, 2017 ================================================================================ DELEGATION ---------- A way to avoid implementation inheritance A class implements an operation by sending a message to another class A class contains an attribute that is typed as another class LISKOV SUBSTITUTION PRINCIPLE ----------------------------- If an object of type S can be substituted in all the places where an object of type T is expected, then S is a subtype of T Meaning A method written in terms of super class T must be able to use any instance of an subclass S without knowing whether or not it is an instance of a subclass Consequently, new subclasses can be added to the system without modifying any methods of T or any areas of code that use T. ADVANTAGES OF REUSE ------------------- Lower development effort Lower risk Widespread use of standard terms Increased reliability SYSTEM DESIGN VS. OBJECT DESIGN ------------------------------- In system design, break system into smaller pieces prevent changes in one subsystem affecting others stable architecture In object design software should be modifiable software should be extensible minimize cost of future change by grouping objects with inheritance flexibility These can conflict Handle conflict by anticipating and designing for change ANTICIPATING CHANGE ------------------- New vendor or technology boundry objects, bridges, adapters Ex. change in ATM card reader tech. seperate card reader into one subsystem New implementation integrating will cause new issues optimize after integrations New views Usibility issues Seperate from user interfaces New complexity of application domain Changes in the real world They can do more, thanks to the new system Inheritance and abstraction helps Errors Users will find them TRANSFORMATIONS --------------- Model Transformations Refactoring Forward Engineering Reverse Engineering MODEL TRANSFORMATIONS --------------------- These are changes to your model Will affect the code, but the functionality of the software Adding a new class to combine attributes Adding inheritance to link objects together REFACTORING ----------- Transforms the source code Does not change the functionality Done to increase Readability Modifiability Implementation of the model transformation FORWARED VS REVERSE ENGINEERING ------------------------------- Forward engineering start with the model create the system based off of the model Reverse engineering start with the source code create the model based off of the source code may lose some information from the original model associations domain information TRANSFORMATION PRINCIPLES ------------------------- Each transformation must address a single criteria Only one design goal at a time Each transformation must be local Transformations that affect multiple classes and subsystems are architectural changes, not an object model transformation Each transformation must be applied in isolation to other changes Do not start a transformation while implementing some function Each transformation must be followed by validation Update sequence diagrams, check use cases