上游充通大学 Forward Engineering Example SHANGHAI JIAO TONG UNIVERSITY Object design model before transformation User LeagueOwner +email:String +maxNumLeagues:1nt +notify(msg:String) Source code after transformation public class LeagueOwner extends User public class User private String email; private int maxNumLeagues; public String getEmail(){ public int getMaxNumLeagues() return email; } return maxNumLeagues; public void setEmail(String value){ email value; public void setMaxNumLeagues (int value){ public void notify(String msg){ // maxNumLeagues value; 3 /Other methods omitted 3 /Other methods omitted 3 Software Engineering
Software Engineering Forward Engineering Example public class User { private String email; public String getEmail() { return email; } public void setEmail(String value){ email = value; } public void notify(String msg) { // .... } /* Other methods omitted */ } public class LeagueOwner extends User { private int maxNumLeagues; public int getMaxNumLeagues() { return maxNumLeagues; } public void setMaxNumLeagues (int value) { maxNumLeagues = value; } /* Other methods omitted */ } User LeagueOwner +maxNumLeagues:int Object design model before transformation Source code after transformation +email:String +notify(msg:String)
上游充通大粤 SHANGHAI JIAO TONG UNIVERSITY 3.Mapping Activities Software Engineering
Software Engineering 3. Mapping Activities
上游充通大兽 SHANGHAI JIAO TONG UNIVERSITY Other Mapping Activities Optimizing the Object Design Model Mapping Associations Mapping Contracts to Exceptions © Mapping Object Models to Tables Software Engineering
Software Engineering Other Mapping Activities Optimizing the Object Design Model Mapping Associations Mapping Contracts to Exceptions Mapping Object Models to Tables
上游充通大学 SHANGHAI JIAO TONG UNIVERSITY Design Optimizations Design optimizations are an important part of the object design phase: The requirements analysis model is semantically correct but often too inefficient if directly implemented. Optimization activities during object design: 1.Add redundant associations to minimize access cost 2.Rearrange computations for greater efficiency 3.Store derived attributes to save computation time As an object designer you must strike a balance between efficiency and clarity. Optimizations will make your models more obscure Software Engineering
Software Engineering Design Optimizations Design optimizations are an important part of the object design phase: • The requirements analysis model is semantically correct but often too inefficient if directly implemented. Optimization activities during object design: 1. Add redundant associations to minimize access cost 2. Rearrange computations for greater efficiency 3. Store derived attributes to save computation time As an object designer you must strike a balance between efficiency and clarity. • Optimizations will make your models more obscure
上x大学Design Optimization Activities SHANGHAI JIAO TONG UNIVERSITY 1.Add redundant associations: What are the most frequent operations?(Sensor data lookup?) How often is the operation called?(30 times a month,every 50 milliseconds) 2.Rearrange execution order Eliminate dead paths as early as possible (Use knowledge of distributions,frequency of path traversals) Narrow search as soon as possible Check if execution order of loop should be reversed 3.Turn classes into attributes Software Engineering
Software Engineering Design Optimization Activities 1. Add redundant associations: • What are the most frequent operations? ( Sensor data lookup?) • How often is the operation called? (30 times a month, every 50 milliseconds) 2. Rearrange execution order • Eliminate dead paths as early as possible (Use knowledge of distributions, frequency of path traversals) • Narrow search as soon as possible • Check if execution order of loop should be reversed 3. Turn classes into attributes