Enterprise Application Design Patterns: Improved and Applied
Total Page:16
File Type:pdf, Size:1020Kb
Enterprise Application Design Patterns: Improved and Applied Stuart Thiel A Thesis in The Department of Computer Science and Software Engineering Presented in Partial Fulfillment of the Requirements for the Degree of Master of Computer Science at Concordia University Montreal, Quebec, Canada January 2010 © Stuart Thiel, 2010 i CONCORDIA UNIVERSITY School of Graduate Studies This is to certify that the thesis prepared By: Stuart Thiel Entitled: Enterprise Application Design Patterns: Improved and Applied and submitted in partial fulfillment of the requirements for the degree of Master of Computer Science complies with the regulations of the University and meets the accepted standards with respect to originality and quality. Signed by the final examining committee: ______________________________________________Chair Dr. Nematollaah Shiri ______________________________________________Examiner Dr. Greg Butler ______________________________________________Examiner Dr. Yuhong Yan ______________________________________________Supervisor Dr. Patrice Chalin Approved by __________________________________________ Chair of Department or Graduate Program Director _____________________________________ Dr. Robin Drew, Dean Faculty of Engineering and Computer Science Date ______________________________________________ i ii Abstract Enterprise Application Design Patterns: Improved and Applied Stuart Thiel Providing developers with proper tools is of ever increasing importance as software integrates itself further into all aspects of our lives. Aside from conventional hardware and software tools, architectural and design patterns have been identified over the years as a means to communicate knowledge of known problems and their solutions. In this thesis, we present several refinements and additions to these patterns, building primarily on Martin Fowler’s Patterns of Enterprise Application Architecture (2003). We present a practical implementation approach to using these patterns and discuss a framework that we have developed to aid practitioners in following this methodology. We also incorporate several of Martin Fowler’s existing patterns into an iterative design example to better demonstrate progressively improving combinations of their use in existing systems. iii Acknowledgements I have never met Martin Fowler, and many people I know believe that I dislike him. Nothing could be further from the truth. His work in Patterns of Enterprise Application Architecture has inspired me for nearly a decade. While I have continually strived to surpass his work, I am truly standing on the shoulders of a giant. I would also like to thank my supervisor and friend, Dr. Patrice Chalin. Without someone of his caliber to discuss these ideas with, I do not believe I could have achieved as much so quickly. His intelligence and precision have encouraged me to always be more. I have also greatly appreciated teaching with him, and being taught by him. Virtually every ounce of diplomacy I have, I probably owe to him. I would like to thank the DSRG over the last few years for tirelessly helping me with the various incarnations of my thesis, through our reading and writing workshops where we reviewed each others current papers, or through long discussions around scrap paper, and sometimes pints. Daniel Sinnig, Perry James, Rajiv Abraham, Stephen Barret, Asif Dogar, George Karabotsos and Kianoush Torkzadeh, you have had a great impact on my life and on this thesis. I would lastly like to thank my friends and family who have continually supported me and encouraged me to hurry up and finish. I would like to particularly thank my wife Karen Bennett for her patience with me, and my newborn daughter Kathryn who has graciously let me sleep well most nights, and who has bubbled and chirped happily next to me while I worked on this thesis. I would also like to thank Finn Upham, Jeremy Upham, Susan Upham (yes, the entire family independently), My-An Nguyen, Larry Thiel (my father) and David Reisch, who have each contributed a final review that will undoubtedly have greatly improved the overall quality of this thesis. iv Table of Contents 1 Introduction ............................................................................................................................................................1 1.1 Problem ...........................................................................................................................................................1 1.2 Contributions...................................................................................................................................................2 1.3 Scope...............................................................................................................................................................2 2 Background ............................................................................................................................................................3 2.1 Architectural Styles: Layered and Client-Server.............................................................................................3 2.2 A layered approach..........................................................................................................................................3 2.3 Client-Server ...................................................................................................................................................4 3 WEA Design Patterns in Practice: A Tutorial and Critical Assessment.................................................................5 3.1 Introduction to the BuddyAge Application .....................................................................................................5 3.2 Iteration Style ..................................................................................................................................................6 3.3 Iteration 1: Do-It-All TRANSACTION SCRIPTs..................................................................................................6 3.3.1 Pattern Description ...............................................................................................................................6 3.3.2 Pattern Usage........................................................................................................................................7 3.3.3 Concerns...............................................................................................................................................7 3.4 Iteration 2: Isolating Technical Services with ROW DATA GATEWAY (RDG).................................................7 3.4.1 Pattern Description ...............................................................................................................................8 3.4.2 Pattern Usage........................................................................................................................................8 3.4.3 Concerns...............................................................................................................................................9 3.5 Iteration 3: Isolating Presentation with TEMPLATE VIEW and VIEW HELPER ..................................................9 3.5.1 Pattern Description ...............................................................................................................................9 3.5.2 Pattern Usage......................................................................................................................................10 3.5.3 Concerns.............................................................................................................................................11 3.6 Iteration 4: Data Integrity and an Isolated Domain Logic with OPTIMISTIC OFFLINE LOCK, PAGE CONTROLLER and IDENTITY FIELDs...............................................................................................................11 3.6.1 Pattern Description .............................................................................................................................13 3.6.2 Pattern Usage......................................................................................................................................15 3.6.3 Concerns.............................................................................................................................................16 3.7 Iteration 5: Refined Access to the Data Source with DATA MAPPER, TABLE DATA GATEWAY and DOMAIN MODEL...........................................................................................................................................................17 3.7.1 Pattern Description .............................................................................................................................18 3.7.2 Pattern Usage......................................................................................................................................19 3.7.3 Concerns.............................................................................................................................................19 3.8 Iteration 6: An Organized Approach to the Application Layer Using the FRONT CONTROLLER Pattern.......20 3.8.1 Pattern Description .............................................................................................................................20 3.8.2 Pattern Usage......................................................................................................................................21