PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2009 by Andrea Saltarello and Dino Esposito All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Control Number: 2008935425 Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 QWT 3 2 1 0 9 8 Distributed in Canada by H.B. Fenn and Company Ltd. A CIP catalogue record for this book is available from the British Library. Microsoft Press books are available through booksellers and distributors worldwide. For further infor mation about international editions, contact your local Microsoft Corporation office or contact Microsoft Press International directly at fax (425) 936-7329. Visit our Web site at www.microsoft.com/mspress. Send comments to [email protected]. Microsoft, Microsoft Press, Access, ActiveX, IntelliSense, MS, MSDN, MS-DOS, PowerPoint, Silverlight, SQL Server, Visio, Visual Basic, Visual C#, Visual Studio, Windows, and Windows Vista are either registered trademarks or trademarks of the Microsoft group of companies. Other product and company names mentioned herein may be the trademarks of their respective owners. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions Editor: Ben Ryan Project Editor: Lynn Finnel Editorial Production: S4Carlisle Publishing Services Technical Reviewer: Kenn Scribner ; Technical Review services provided by Content Master, a member of CM Group, Ltd. Cover: Tom Draper Design Body Part No. X15-12272 To Silvia, Francesco, and Michela who wait for me and keep me busy. But I’m happy only when I’m busy. —Dino To Mum and Depeche Mode. —Andrea “Any suffi ciently advanced technology is indistinguishable from magic.” —Arthur C. Clarke Contents at a Glance Part I Principles 1 Architects and Architecture Today. 3 2 UML Essentials. 31 3 Design Principles and Patterns . 63 Part II Design of the System 4 The Business Layer . 129 5 The Service Layer . 193 6 The Data Access Layer . 251 7 The Presentation Layer. 343 Final Thoughts. 401 Appendix: The Northwind Starter Kit . 405 Index . 413 v Table of Contents Acknowledgments . .xiii Introduction . xvii Part I Principles 1 Architects and Architecture Today. 3 What’s a Software Architecture, Anyway? . 4 Applying Architectural Principles to Software . 4 What’s Architecture and What’s Not . 8 Architecture Is About Decisions . 10 Requirements and Quality of Software . .12 Who’s the Architect, Anyway? . .17 An Architect’s Responsibilities . 17 How Many Types of Architects Do You Know? . .20 Common Misconceptions About Architects . 21 Overview of the Software Development Process . 24 The Software Life Cycle. 24 Models for Software Development. 26 Summary . 30 Murphy’s Laws of the Chapter . .30 2 UML Essentials. 31 UML at a Glance . 32 Motivation for and History of Modeling Languages . 33 UML Modes and Usage. 36 UML Diagrams . 41 Use-Case Diagrams . 43 Class Diagrams . 47 Sequence Diagrams. 53 What do you think of this book? We want to hear from you! Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you. To participate in a brief online survey, please visit: www.microsoft.com/learning/booksurvey/ vii viii Table of Contents Summary . 61 Murphy’s Laws of the Chapter . 61 3 Design Principles and Patterns . 63 Basic Design Principles . 63 For What the Alarm Bell Should Ring. 65 Structured Design . 66 Separation of Concerns. 70 Object-Oriented Design . 73 Basic OOD Principles . 73 Advanced Principles . 80 From Principles to Patterns. 85 What’s a Pattern, Anyway?. 86 Patterns vs. Idioms. 92 Dependency Injection. 95 Applying Requirements by Design . 97 Testability . 97 Security . .108 From Objects to Aspects. 116 Aspect-Oriented Programming. 116 AOP in Action . 120 Summary . 124 Murphy’s Laws of the Chapter . 125 Part II Design of the System 4 The Business Layer . 129 What’s the Business Logic Layer, Anyway?. 130 Dissecting the Business Layer . .130 Where Would You Fit the BLL? . 134 Business and Other Layers . 138 Patterns for Creating the Business Layer . 141 The Transaction Script Pattern. 145 Generalities of the TS Pattern . .145 The Pattern in Action . 149 The Table Module Pattern . .154 Generalities of the TM Pattern. 155 The TM Pattern in Action . 159 Table of Contents ix The Active Record Pattern . .165 Generalities of the AR Pattern . 166 The AR Pattern in Action . .168 The Domain Model Pattern . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages144 Page
-
File Size-