Download presentation
Presentation is loading. Please wait.
1
SEA Side Software Engineering Annotations
Annotation 3: Analysis Patterns Professor Sara Stoecklin Director of Software Engineering- Panama City Ex 182 This is hopefully the first of MANY sea sides Our first annoation is on Extreme programming
2
Analysis Patterns
3
Analysis Patterns ? WHAT WHEN HOW WHY Example
4
? Analysis Patterns Patterns: Analysis: Phase of software development
Webster : Something regarded as a normative example to be copied. Analysis: Phase of software development Analysis Patterns: Normative examples to be copied in the analysis phase of software development.
5
? Analysis Patterns Analysis Patterns:
Normative examples to be copied in the analysis phase of software development. Examples which are made into clusters of classes using polymorphic behavior to implement software.
6
? Analysis Patterns Polymorphism:
capability of assuming different forms Polymorphic behavior: showing activity which can assume different forms. Ex: write an add method which can add integers, add reals, add colors
7
? Analysis Patterns Examples: 1. Party 2. Accountability
3. Observation 4. Inventory 5. Accounting 6. Trading 7. Contracts 8. Facades
8
? Analysis Patterns 1. Party Pattern
1. Party Pattern Normative example to be copied in the analysis phase of software development. During analysis of a registration system we determine that there are several types of students, types of professors, administrators, and types of departments and campus that need to be considered. Each of these have some common characteristics. They have name, street address, city state, zip, some type of identification, date of birth, etc.
9
Analysis Patterns 1. Party Pattern
1. Party Pattern How many times will I need to validate zip code when someone enters it into a textfield. How many times will I need to validate SSN, code, month, day, year. How many change name routines will I need to write I would like to have a normative example of these repetitive items that can be identified during the analysis phase (an analysis pattern) and later during development have the capability of assuming different forms for each type of software (polymorphism).
10
Analysis Patterns 1. Party Pattern
Knowledge level Party Type Therefore, I need to define a PARTY TYPE. This type defines the descriptive information (metadata) for a party and I will define classes of that type to implement the details.
11
Analysis Patterns 1. Party Pattern
Knowledge level Operational level Party Type 1 The knowledge level consists of party type. At the knowledge level the model records the general rules that govern the structure (Fowler, 1997). The operational level is the implementation details.
12
Analysis Patterns 1. Party Pattern
Knowledge level Operational level Party Type 1 0..M 1 Party 1 Person Organization Post (appointments) The operational level consists of party and the party subtypes. At the operational level the model records the day to day events of the domain.
13
Analysis Patterns 1. Party Pattern Knowledge level Operational level
Knowledge level Operational level Party Type 1 0..M 1 Party 1 Person Organization Post (appointments) John Doe FSU Dean Party Type ObjectRecord Min Max Table Student Person StudentRecord University Organization University UniversityT
14
Analysis Patterns 1. Party Pattern – WHY DO I CARE?
Knowledge level Operational level Party Type 1 0..M 1 Party 1 Person Organization Post (appointments) REUSE, REUSE, REUSE – This concept allows me to reuse this party class in VARIOUS applications. It makes component building a reality. Pre-fab systems become marketable.
15
? Analysis Patterns 2. Accountability Pattern
2. Accountability Pattern Normative example to be copied in the analysis phase of software development. During analysis of a registration system we determine that there are several types of relationships between these parties. Each of these relationships have some common characteristics.
16
? Analysis Patterns 2. Accountability Pattern
2. Accountability Pattern Normative example to be copied in the analysis phase of software development. Relationship Examples A student takes classes from a professor. A student takes classes from a department. A professor works in a department. A campus represents particular departments. These are called ACCOUNTABILITIES.
17
Analysis Patterns 2. Accountability Pattern
2. Accountability Pattern How many times will I record the creation of these accountabilities. How many times will I need to look up information regarding particular accountabilities. How many create relationship routines will I need to write I would like to have a normative example of these repetitive items that can be identified during the analysis phase (an analysis pattern) and later during development have the capability of assuming different forms for each type of software (polymorphism).
18
Analysis Patterns 2. Accountability Pattern
Knowledge level Accountability Type Therefore, I need to define a ACCOUNTABILITY TYPE. This type defines the descriptive information (metadata) for a relationship between parties and I will define classes of that type to implement the details.
19
Analysis Patterns 2. Accountability Pattern
Knowledge level Operational level Accountability Type The knowledge level consists of the accountability type. At the knowledge level the model records the general rules that govern the structure (Fowler, 1997). The operational level is the implementation details.
20
Analysis Patterns 2. Accountability Pattern Knowledge level
Knowledge level Operational level Accountability Type 1 0..M 1 Accountability 1 Person is Dean of a Campus Person works for a Department Accountability Related Types ObjectRecord Actions Time Period Manager of Person, department manages hires, fires begin end Person, campus manages hires,fires begin end Enrolls in Person, class enrollment add,drop semester Accepts in Person, campus accepts applies,… semester Person, department accepts applies,… semester
21
Analysis Patterns 2. Accountability Pattern – WHY DO I CARE?
Knowledge level Operational level Accountability Type 1 0..M 1 Accountability 1 REUSE, REUSE, REUSE – This concept allows me to reuse accountabilities (relationships) in VARIOUS applications. It makes component building a reality. Pre-fab systems become marketable.
22
? Analysis Patterns 3. Observation Pattern
3. Observation Pattern Normative example to be copied in the analysis phase of software development. During analysis of a registration system we determine that there are several types of observations we make about both the parties and the accountabilities (relationships). Each of these observations have some common characteristics. They have a value of the observation, a category, and perhaps an assessment, demension, conversion rations.
23
Analysis Patterns 3. Observation Pattern
3. Observation Pattern How many times will I need to validate an observation, to convert an observation, to record an observation. How many enter observation routines will I need to write I would like to have a normative example of these repetitive items that can be identified during the analysis phase (an analysis pattern) and later during development have the capability of assuming different forms for each type of software (polymorphism).
24
Analysis Patterns 3. Observation Pattern
Phenomenon Type Phenomenon 1 0..M 1 1 Knowledge level Therefore, I need to define an observation type called a PHENOMENON TYPE and I need a PHENOMENON. The type defines those type of observations needed and the phenomenon defines descriptive information (metadata) for an observation.
25
Analysis Patterns 3. Observation Pattern EXAMPLES
Knowledge level Operational level Phenomenon Type Phenomenon 1 0..M 1 1 EXAMPLES PHENOMENON TYPE - Date PHENOMENON – Data of Birth, Date enrolled, date of death, …. PHENOMENON TYPE - Test Score PHENOMENON – GRE, Java Course, Drug, …..
26
Analysis Patterns 3. Observation Pattern EXAMPLES
Knowledge level Operational level Phenomenon Type Phenomenon 1 0..M 1 1 0..M 1 0..M 1 Observation EXAMPLES PHENOMENON TYPE - Date PHENOMENON – Data of Birth, Date enrolled, date of death, …. PHENOMENON TYPE - Test Score PHENOMENON – GRE, Java Course, Drug, …..
27
Analysis Patterns 3. Observation Pattern Knowledge level
1 0..M Knowledge level Operational level Phenomenon Type Phenomenon 1 1 0..M 1 0..M 1 Observation Observation Type DataType Validator Min Max Table Label ErrorMessage Show size Showsize Integer Range Show Size Range is from 0 to 15 Hair color Haircolor String Discrete HairTable Hair Color Color Must be …… Name Personname String Null Name
28
Analysis Patterns 3. Observation Pattern – WHY DO I CARE?
Party Type Phenomenon Type Phenomenon Accountability Type 1 1 1 1 0..M 1 0..M 0..M 1 0..M Party 1 Accountability 1 1 Observation 1 Person Organization Post (appointments) REUSE, REUSE, REUSE – This concept allows me to reuse this party class in VARIOUS applications. It makes component building a reality. Pre-fab systems become marketable.
29
Analysis Patterns . MORE MORE MORE
Debit, Credit, Service Charge, Interest Savings, Checking, School, Inventory, GPA Transaction Type Posting Rules Party Type 1..M 0..M 0..M 0..M Account Type 0..M has 1..M Knowledge Level 1 1 1 1 Operational Level 0..M 0..M Transaction 1..M 0..M Entry 0..M 1..1 Account 0..M has Party 1 0..M 0..M 1 1 Time Period Time Point The operational level consists of accounta, party, and their interrelationships. At the operational level the model records the day to day events. The knowledge level consists of account type, party type, and their relationships. At the knowledge level the model records the general rules that govern the structure (Fowler, 1997).
30
Marriage, Insurance, Real Estate, Employment, Stock Option, Loan
Analysis Patterns . MORE MORE MORE Amount of Policy, Mortgage Balance, Mortage Interest, Employment Offer, Value of Buy Option License, Policy, Offer Mortgage Marriage, Insurance, Real Estate, Employment, Stock Option, Loan Quote Type Instrument Type has 1..M Party Type 1..M 1:.1 0..M 0..M Contract Type Knowledge Level 1 1 1 1 Operational Level 0..M 0..M Quote 1..M 1:1 Instrument 0..M 1..1 Contract 0..M has Party 1 0..M 0..M 0..M 0..M 1 1 Time Period Portfolio Time Point A quote is a value quoted about a particular instrument of a contract. A Portfolio is a collection of contracts that can be valued as a whole.
31
Analysis Patterns . MORE MORE MORE
Instrument Type Party Type Knowledge Level 1 1 Operational Level 0..M Contract Selector 0..M has 1 Party Instrument 0..M 1..1 Contract Filter Boolean Routine Hard Coded Filter 0..M 0..M Portfolio Set Operation Set Filter 0..M 0:M 1 0..M 0..M Contract Portfolio Filter 1..1 A quote is a value quoted about a particular instrument of a contract. A Portfolio is a collection of contracts that can be valued as a whole.
32
Analysis Patterns . MORE MORE MORE
Constraint(s): X: self.Accountability . x.commissioner.type x.type.commissioners and x.responsible.type x.type.responsibles 0..M commissioners 1..M Accountability Type Party Type 0..M responsibles 1..M Knowledge Level 1 1 Operational Level 0..M 0..M commissioner 0..M 1 Accountability Party 0..M responsible 1 0..M 1 Time Period The operational level consists of accountability, party, and their interrelationships. At the operational level the model records the day to day events of the domain. The knowledge level consists of accountability type, party type, and their relationships. At the knowledge level the model records the general rules that govern the structure (Fowler, 1997).
33
Analysis Patterns Validator Example Knowledge level Operational level
Knowledge level Operational level Observation Type 1 0..M Observation
34
Scenario: Analysis Patterns Validator Example
Scenario: I write many different validation routines. I specify in my data dictionary about what constitutes a valid piece of data. Can’t I use the observation pattern to implement these various validation methods without writing each of them.
35
DataDictionaryRecord DataDictionaryVector
Analysis Patterns Validator Example Knowledge level DDManager 1 Observation Type 0..M DataDictionaryRecord M..1 DataDictionaryVector 1 0..M Observation Operational level Observation Type DataType Validator Min Max Table Label ErrorMessage Show size Showsize Integer Range Show Size Range is from 0 to 15 Hair color Haircolor String Discrete HairTable Hair Color Color Must be …… Name Personname String Null Name
36
DataDictionaryRecord DataDictionaryVector
Analysis Patterns Validator Example Knowledge level DDManager 1 0..M DataDictionaryRecord M..1 DataDictionaryVector Operational level Validator …. Range Discrete Null
37
observationTextfield observationErrorLabel
Analysis Patterns Validator Example Knowledge level Operational level Observation Type 1 0..M Observation TestFrame ObservationPanel observationLabel observationTextfield observationErrorLabel
38
DataDictionaryRecord DataDictionaryVector
Analysis Patterns Validator Example DDManager DataDictionaryRecord DataDictionaryVector getMember create addElememt
39
DataDictionaryVector observationTextfield observationErrorLabel
Analysis Patterns Validator Example TestFrame ObservationPanel observationLabel DataDictionaryVector create observationTextfield create observationErrorLabel getMember(ddElementName):ddRecord add add add event getvalue : textfieldvalue We Know: ddElementName of the field value of the text field
40
DataDictionaryRecord observationTextfield observationErrorLabel
Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete observationLabel DataDictionaryRecord Observation Observation Type Class Null ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)
41
DataDictionaryRecord DataDictionaryVector
Analysis Patterns Validator Example DDManager DataDictionaryRecord DataDictionaryVector getMember create addElememt
42
DataDictionaryVector observationTextfield observationErrorLabel
Analysis Patterns Validator Example TestFrame ObservationPanel observationLabel DataDictionaryVector create observationTextfield create observationErrorLabel getMember (ddElementName): ddRecord add add add event getvalue : textfieldvalue We Know: ddElementName of the field value of the text field
43
Analysis Patterns Validator Example
ObservationPanel public class ObservationPanel extends java.awt.Panel implements java.awt.event.ActionListener { // items for the GUI interface private java.awt.Label observationLabel = null; private java.awt.Label errorLabel = null; private String errorText; private java.awt.TextField observationTextField = null; // other variables protected transient java.beans.PropertyChangeSupport propertyChange; private String fieldDataDictionaryElementName = new String();// stores lookup name private Observation dataElementObservation = null; // allows observation instance private boolean observationValid = true; // temp variable private String panelObservation; // String name of the observation private String panelObservationText; // string name in observationpanel textfield public ObservationPanel() { super(); initialize();} public ObservationPanel(java.awt.LayoutManager layout) { super(layout);}
44
Analysis Patterns Validator Example
private void initConnections() { getObservationTextField().addActionListener(this);} private void initialize() { // sets up GUI setName("ObservationPanel"); setLayout(null); setSize(375, 88); add(getObservationTextField(), getObservationTextField().getName()); add(getObservationLabel(), getObservationLabel().getName()); add(getErrorLabel(), getErrorLabel().getName()); initConnections(); // gets the meta Data about the GUI DataDictionaryRecord ddrecord = DDManager.getMember(getDataDictionaryElementName()); getObservationLabel().setText( ddrecord.getLabelName() ); setErrorText( ddrecord.getInvalidObservationLabel() ); // The label size, textfield size, and panel size should adjusted from DD setDataElementObservation( new Observation( getDataDictionaryElementName() ) ); } ObservationPanel Observation Type DataType Validator Min Max Table Label ErrorMessage Show size Showsize Integer Range Show Size Range is from 0 to 15 Hair color Haircolor String Discrete HairTable Hair Color Color Must be …… Name Personname String Null Name
45
Analysis Patterns Validator Example ObservationPanel
public static void main(java.lang.String[] args) { try { // try1 java.awt.Frame frame; try { // try2 Class aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame"); frame = (java.awt.Frame)aFrameClass.newInstance(); } // end try2 catch (java.lang.Throwable Exc) {frame = new java.awt.Frame(); } ObservationPanel aObservationPanel; aObservationPanel = new ObservationPanel(); frame.add("Center", aObservationPanel); frame.setSize(aObservationPanel.getSize()); frame.setVisible(true); } // end try1 catch (Throwable exception) { System.err.println("Exception occurred in main() of java.awt.Panel"); exception.printStackTrace(System.out); } // end catch } // end main
46
Analysis Patterns Validator Example ObservationPanel
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { getPropertyChange().addPropertyChangeListener(listener); } // end addPropertyChangeListener // The firePropertyChange method was generated to support the propertyChange field. public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { getPropertyChange().firePropertyChange(propertyName, oldValue, newValue); } // end firePropertyChange protected java.beans.PropertyChangeSupport getPropertyChange() { if (propertyChange == null) {propertyChange = new java.beans.PropertyChangeSupport(this); }; return propertyChange; } // end propertyChangefield // The removePropertyChangeListener method was generated to support the propertyChange field. public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { getPropertyChange().removePropertyChangeListener(listener); } // lend removePropertyChangeListner private void handleException(Throwable exception) { /* Uncomment the following lines to print uncaught exceptions to stdout */ // System.out.println(" UNCAUGHT EXCEPTION "); exception.printStackTrace(System.out); } // end handleException
47
Analysis Patterns Validator Example ObservationPanel
public String getDataDictionaryElementName() {return fieldDataDictionaryElementName;} public void setDataDictionaryElementName(String dataDictionaryElementName) { String oldValue = fieldDataDictionaryElementName; fieldDataDictionaryElementName = dataDictionaryElementName; firePropertyChange("dataDictionaryElementName", oldValue, dataDictionaryElementName); } // end setDataDictionaryElementName public Observation getDataElementObservation() { return dataElementObservation;} public void setDataElementObservation(Observation newValue) { this.dataElementObservation = newValue; } // end setDagtaElementObservation public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { getPropertyChange().addPropertyChangeListener(listener); } // end addPropertyChangeListener // The firePropertyChange method was generated to support the propertyChange field. public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { getPropertyChange().firePropertyChange(propertyName, oldValue, newValue); } // end firePropertyChange
48
Analysis Patterns Validator Example ObservationPanel
private java.awt.Label getObservationLabel() { if (observationLabel == null) { try { observationLabel = new java.awt.Label(); observationLabel.setName("ObservationLabel"); observationLabel.setText(" "); observationLabel.setBackground(java.awt.Color.cyan); observationLabel.setBounds(36, 29, 66, 23); } // end try catch (java.lang.Throwable Exc) { handleException(Exc); } }; // end if return observationLabel; } // end getObservationLabel //Return the TextField1 property java.awt.TextField private java.awt.TextField getObservationTextField() { if (observationTextField == null) { observationTextField = new java.awt.TextField(); observationTextField.setName("ObservationTextField"); observationTextField.setBounds(108, 29, 188, 23); return observationTextField; } // end getObservationTextfield public String getPanelObservationText() { return panelObservationText;} public void setDataElementObservation(Observation newValue) {this.dataElementObservation = newValue; } ObservationPanel
49
Analysis Patterns Validator Example ObservationPanel
private java.awt.Label getErrorLabel() { if (errorLabel == null) { try { errorLabel = new java.awt.Label(); errorLabel.setName("ErrorLabel"); errorLabel.setText(""); errorLabel.setBounds(45, 61, 269, 23); } // end try catch (java.lang.Throwable Exc) { handleException(Exc); } }; // end if return errorLabel; } // end ErrorLabel public String getErrorText() { return errorText;} ObservationPanel
50
Analysis Patterns Validator Example
public void actionPerformed(java.awt.event.ActionEvent e) { if ((e.getSource() == getObservationTextField()) ) { validateField(e); } }// end actionPerformed private void validateField(java.awt.event.ActionEvent arg1) { try { this.validateObservation(); } catch (java.lang.Throwable Exc) { handleException(Exc); } } // end validateField public boolean getObservationValid() { return observationValid;} public void setErrorText(String newValue) {this.errorText = newValue;} public void setObservationValid(boolean newValue) { this.observationValid = newValue;} public void setPanelObservationText(String newValue) { this.panelObservationText = newValue;} public void validateObservation() { /* Perform the validateObservation method. */ getErrorLabel().setText(""); setObservationValid(true); setPanelObservationText( getObservationTextField().getText() ); setObservationValid(getDataElementObservation().isValid(getPanelObservationText())); if( !getObservationValid() ) {getErrorLabel().setText(getErrorText()); } // end if else getErrorLabel().setText("Good Job"); } // end validateObservation ObservationPanel
51
DataDictionaryRecord observationTextfield observationErrorLabel
Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete observationLabel DataDictionaryRecord Observation Observation Type Class Null ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)
52
Analysis Patterns Validator Example Observation
public class Observation { private java.util.Date recordedDate; private java.util.Date observedDate; private int duration; private ObservationType type; private String observationTypeName; public Observation() { super();} public Observation(String ddElementName ) { setType ( new ObservationType( ddElementName ) ); } // end constructor public void createNewObservationType(String observationTypeName) { this.observationTypeName = observationTypeName; // here we create an instance of the primitive observation // a factory pattern would create the instances of whatever type you need setType(new PrimitiveObservationType()); } // end createNewObservationType
53
Analysis Patterns Validator Example Observation
public int getDuration() { return duration;} public String getObservationTypeName() { return observationTypeName;} public java.util.Date getObservedDate() { return observedDate;} public java.util.Date getRecordedDate() { return recordedDate;} public ObservationType getType() { return type;} public boolean isValid (String obsValue) { return getType().isValid( obsValue );} public void setDuration(int newValue) { this.duration = newValue;} public void setObservationTypeName(String newValue) { this.observationTypeName = newValue;} public void setObservedDate(java.util.Date newValue) { this.observedDate = newValue;} public void setRecordedDate(java.util.Date newValue) {this.recordedDate = newValue;} public void setType(ObservationType newValue) { this.type = newValue;} } // end class
54
DataDictionaryRecord observationTextfield observationErrorLabel
Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete observationLabel DataDictionaryRecord Observation Observation Type Class Null ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)
55
Analysis Patterns Validator Example Observation Type
public class ObservationType { private String phenomenon; private Validator dataElementValidator = null; private String phenomenonType; public ObservationType() { super();} public ObservationType(String ddElementName) { DataDictionaryRecord ddrecord = DDManager.getMember( ddElementName ); setPhenomenon( ddElementName ); setPhenomenonType( ddrecord.getDataElementType()); try { // This uses the validator name stored in the data dictionary // to build an instance of the needed validator class (either // a RangeValidator or a DiscreteValidator) using Reflection Class validatorClass = Class.forName(ddrecord.getValidatorName() ); setDataElementValidator ( (Validator) validatorClass.newInstance()); getDataElementValidator().setDDRecord( ddrecord); } // end try catch(Exception e) { e.printStackTrace(); } } // end constructor
56
DataDictionaryRecord observationTextfield observationErrorLabel
Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete observationLabel DataDictionaryRecord Observation Observation Type Class Null ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)
57
Analysis Patterns Validator Example Observation Type
public Validator getDataElementValidator() { return dataElementValidator;} public String getPhenomenon() { return phenomenon;} public String getPhenomenonType() { return phenomenonType;} public boolean isValid(String obsValue) { return getDataElementValidator().isValid(obsValue ); } // end isValid public void setDataElementValidator(Validator newValue) { this.dataElementValidator = newValue; } // end setDataElementValidator public void setPhenomenon(String newValue) { this.phenomenon = newValue;} public void setPhenomenonType(String newValue) { this.phenomenonType = newValue;} }// end class
58
DataDictionaryRecord observationTextfield observationErrorLabel
Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete observationLabel DataDictionaryRecord Observation Observation Type Class Null ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)
59
Analysis Patterns Validator Example Range
Validator Example public class RangeValidator extends Validator { public RangeValidator() { super();} public boolean isValid(String obs ) { int obsInt; if(getDDRecord().getDataElementType().equals("integer")) { // validate that the obs is an integer other value types would follow try { obsInt = Integer.parseInt( obs ); } catch(NumberFormatException e) { return false; } // validate that obs meets the rules of min and max int maxInt = Integer.parseInt(getDDRecord().getMax()); int minInt = Integer.parseInt(getDDRecord().getMin()); return (((minInt <= obsInt )&&(maxInt>=obsInt))); } // end if return false; } // end isValid }// end class
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.