1 / 59

SEA Side Software Engineering Annotations

SEA Side Software Engineering Annotations. Annotation 3: Analysis Patterns Professor Sara Stoecklin Director of Software Engineering- Panama City sstoecklin@mail.pc.fsu.edu stoeckli@cs.fsu.edu 850-522-2091 850-522-2023 Ex 182. Analysis Patterns. Analysis Patterns. ?. WHAT WHEN HOW

blithe
Télécharger la présentation

SEA Side Software Engineering Annotations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SEA Side Software Engineering Annotations Annotation 3: Analysis Patterns Professor Sara Stoecklin Director of Software Engineering- Panama City sstoecklin@mail.pc.fsu.edu stoeckli@cs.fsu.edu 850-522-2091 850-522-2023 Ex 182

  2. Analysis Patterns

  3. Analysis Patterns ? • WHAT • WHEN • HOW • WHY • Example

  4. ? Analysis Patterns Patterns: 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 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 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 Party Type Knowledge level 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 Party Type Knowledge level Operational level 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 Party Type Knowledge level Operational level 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 Party Type Knowledge level Operational level 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? Party Type Knowledge level Operational level 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 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 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 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 Accountability Type Knowledge level 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 Accountability Type Knowledge level Operational level 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 Accountability Type Knowledge level Operational level 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? Accountability Type Knowledge level Operational level 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 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 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 Phenomenon Type Phenomenon Knowledge level Operational level 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 Phenomenon Type Phenomenon Knowledge level Operational level 1 0..M 1 1 0..M 0..M 1 Observation 1 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 1 0..M Phenomenon Type Phenomenon Knowledge level Operational level 1 1 0..M 0..M 1 Observation 1 Observation Type DataType Validator Min Max Table Label ErrorMessage Show size Showsize Integer Range 4 20 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 Party 1 0..M 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 Account Type 1..M 0..M 0..M 0..M has 0..M 1..M 1 1 1 1 Knowledge Level 0..M 0..M Operational Level Party Transaction Entry has Account 1..M 0..M 0..M 1..1 0..M 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. 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 has Quote Type Instrument Type Party Type 1..M Contract Type 1..M 1:.1 0..M 0..M 1 1 1 1 Knowledge Level 0..M 0..M Operational Level Party Quote Instrument has Contract 1..M 1:1 0..M 1..1 0..M 1 0..M 0..M 0..M 0..M 1 1 Portfolio  Time Period 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 1 1 Knowledge Level 0..M Operational Level Party has Contract Selector  0..M 1 Instrument 0..M 1..1 Contract Filter Boolean Routine Hard Coded Filter 0..M Portfolio  0..M Set Operation Set Filter 0..M 0:M 1 0..M 0..M Contract 1..1 Portfolio Filter 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 commissioners 0..M 1..M Party Type Accountability Type responsibles 0..M 1..M 1 1 Knowledge Level 0..M 0..M Operational Level commissioner 0..M 1 Party Accountability responsible 0..M 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 Observation Type Knowledge level Operational level 1 0..M Observation

  34. 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. Analysis Patterns Validator Example Knowledge level DDManager 1 0..M Observation Type DataDictionaryRecord DataDictionaryVector M..1 1 0..M Operational level Observation Observation Type DataType Validator Min Max Table Label ErrorMessage Show size Showsize Integer Range 4 20 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. Analysis Patterns Validator Example Knowledge level DDManager 1 0..M DataDictionaryRecord DataDictionaryVector M..1 Operational level Validator …. Discrete Null  Range

  37. Analysis Patterns Validator Example Observation Type Knowledge level Operational level 1 0..M Observation TestFrame  ObservationPanel observationLabel observationTextfield observationErrorLabel

  38. Analysis Patterns Validator Example DDManager DataDictionaryRecord DataDictionaryVector getMember create addElememt

  39. Analysis Patterns Validator Example observationLabel DataDictionaryVector TestFrame  ObservationPanel 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. Analysis Patterns We Know: ddElementName of the field value of the text field Range Validator Example Discrete Null  DataDictionaryRecord Observation Observation Type Class observationLabel ObservationPanel observationTextfield observationErrorLabel create create(ddElementName) isValid(obsvalue) create getValidatorName forName create isValid(obsvalue) isValid(obsvalue) setText(message)

  41. Analysis Patterns Validator Example DDManager DataDictionaryRecord DataDictionaryVector getMember create addElememt

  42. Analysis Patterns Validator Example observationLabel DataDictionaryVector TestFrame  ObservationPanel 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 4 20 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 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener listener) { getPropertyChange().addPropertyChangeListener(listener); } // end addPropertyChangeListener 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 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 value. @return java.awt.TextField private java.awt.TextField getObservationTextField() { if (observationTextField == null) { try { observationTextField = new java.awt.TextField(); observationTextField.setName("ObservationTextField"); observationTextField.setBounds(108, 29, 188, 23); } // end try catch (java.lang.Throwable Exc) { handleException(Exc); } }; // end if return observationTextField; } // end getObservationTextfield public String getPanelObservationText() { return panelObservationText;} public void setDataElementObservation(Observation newValue) {this.dataElementObservation = newValue; } ObservationPanel

  49. Analysis Patterns Validator Example 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

More Related