Application Refactoring With Design Patterns


Published on

This presentation will describe the object-oriented substructure
developed to manage, validate, and process survey data.
Experience with classes or objects or design patterns is not
necessary for this presentation, but it will help to know how to
code a class and instantiate an object with SCL (SAS Component Language).

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Application Refactoring With Design Patterns

  1. 1. Application Refactoring with D i P tt ith Design Patterns Mark Tabladillo, Ph.D. March 31, 2003
  2. 2. Introduction The YTSS (Youth Tobacco Surveillance System) started in 1998 y ) YTS = Youth Tobacco Survey GYTS = Global Youth Tobacco Survey Since 1998, over 1,000,000 surveys have b h been processed f 35 states and d for t t d 100 international sites
  3. 3. Design Patterns Inherency “Design Pattern” = Routine solution to a reoccurring p g problem Observer Pattern = Model/View Mediator Pattern = SAS/AF Frame Singleton Pattern = Frames and SCL standalone code Point: Patterns are inherently inside SAS and operating systems
  4. 4. How to Start with Design Patterns Shalloway and Trott (2002), Design p Patterns Explained Patterns do not stand alone, but interact Pattern relationships improve with refactoring (defined as the intentional restructuring of classes)
  5. 5. When to Create Design Patterns A previous project has reusable code Current code is large Good for long-term or complex applications (especially to allow for modifications)
  6. 6. Specific Development Strategy Customized nonvisual classes First version 6 12 was used 6.12 Datasets generate code (see other paper) Conversion to version 8 and consolidation lid ti
  7. 7. Output Class Changing printer orientation (landscape vs. portrait) p ) Changing printer font and font size In Windows 2000 margin specification 2000, needs to drive linesize and pagesize
  8. 8. Win32 Class Put all Windows functionality in one p place Accesses a table with Windows 32 errors Calls Win32 API with SASCBTBL Interfaces a windows Visual Basic I t f i d Vi lB i control
  9. 9. Region Class “Region” is the base level of y customization for surveys Drives the assignment of LIBNAMEs Defines output filenames
  10. 10. SurveyAnalyzer Strategy Design Pattern – have five p g programs to run, and the class , determines which one to use Consolidation: Later refactored along with the region class
  11. 11. Dataset Attribute Classes ATTRC/ATTRN information Open and Close Datasets Children have: Al Always VARNUM Sometimes VARLEN Sometimes VARTYPE S ti Sometimes values
  12. 12. Final Classes Expansion: enumerated structure Hierarchy SurveyYear State Region AnnualCode (periodically updated) SentenceParser (functional)
  13. 13. New Changes Expansion: enumerated structure SurveyYearAnalyzer StateAnalyzer RegionAnalyzer Analyzer classes form abstract base for processes, processes now in their own classes Total Classes Currently: 44
  14. 14. Applying Refactoring How organized is organized?? Refactoring is choreographed Sometimes expansion Sometimes consolidation Coding frameworks are increasingly important, important even for web work
  15. 15. Four Lessons Recognize that all intentionally structured languages have inherent design pattern structure. Consider adding design patterns even if it means more code.d Expect to continuously apply refactoring to large or complex applications. l l li ti Continuously learn and apply design patterns.