Beautiful architectureEdited by diomidis spinellis and georgios gousios○ REILLYBeijing· Cambridge· Farnham·Kdn· Sebastopol· apel· TokyoBeautiful architectureEdited by Diomidis Spinellis and Georgios GousiosCopyright o 2009 O'Reilly Media. All rights reservedPrinted in the united states of americaPublished by o'reilly media, Inc. 1005 Gravenstein Highway North, Sebastopol, CA95472O'Reilly books may be purchased for educational, business, or sales promotional use Online editions are alsoavailableformosttitles(http://safari.oreilly.com).Formoreinformationcontactourcorporate/institutionalsalesdepartment:800-998-9938orcorporate@oreilly.comEditor: Mary TreselerIndexer: Fred BrownProduction Editor: Sarah SchneiderCover Designer: Karen MontgomeryCopyeditor: Genevieve d'EntremontInterior Designer: David FutatoProofreader: Nancy ReinhardtIllustrator: Robert romanoPrinting History:January 2009First editionO'Reilly and the o reilly logo are registered trademarks of O'reilly Media, Inc. Beautiful Architecture andrelated trade dress are trademarks of o'Reilly Media, Inc.Many of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and o'reilly media, Inc was aware of a trademarkclaim, the designations have been printed in caps or initial capsWhile every precaution has been taken in the preparation of this book, the publisher and authors assume noresponsibility for errors or omissions, or for damages resulting from the use of the information containedhereinISBN:978-0-596-51798-41231531335All royalties from this book will be donatedto Doctors without bordersCONTENTSFOREWORDby Stephen丿. MellorPREFACEPart One ON ARCHITECTUREWHAT IS ARCHITECTUREby John Klein and David WeissintroductⅰonCreating a Software Architecture10Architectural structures14Good ArchitecturesBeautiful architecturesAcknowledgments232 A TALE OF TWO SYSTEMS: A MODERN-DAY SOFTWARE FABLE25by pete goodliffeThe Messy Metropolis26Design Town33So What?Your turnReferences42Part Two ENTERPRISE APPLICATION ARCHITECTUREARCHITECTING FOR SCALEby Jim WaldoIntroductionContext47The architecture51Thoughts on the Architecture57MAKING MEMORIESby Michael NygardCapabilities and ConstraintsWorkflowArchitecture facetsUser ResponseConclusionReferences885RESOURCE-ORIENTED ARCHITECTURES: BEING IN THE WEBby Brian SlettenIntroductionConventional web services90The WebResource-Oriented ArchitecturesData-Driven Applications102Applied Resource-Oriented Architecture103Conclusion1096DATA GROWS UP. THE ARCHITECTURE OF THE FACEBOOK PLATFORM111by dave FettermanIntroductionCreating a Social Web Service117Creating a Social Data Query Service124Creating a Social Web Portal: FBML133Supporting Functionality for the System146Summation151Part Three SYSTEMS ARCHITECTURE7 XEN AND THE BEAUTY OF VIRTUALIZATION155by Derek Murray and Keir FraserIntroductionXenoservers156The Challenges of virtualization159ParavirtualizationThe Changing Shape of Xen163Changing Hardware, Changing Xen169Lessons learned172Further Reading1738 GUARDIAN A FAULT-TOLERANT OPERATING SYSTEM ENVIRONMENTTandem/16: Some Day All Computers Will Be built Like This176ardware176Mechanical Layout178Processor architecture179The Interprocessor BusInput/output184Process structure185Message System18File SystemFolklore195The downside195vi CONTENTSPosterity197Further Reading198JPC: AN X86 PC EMULATOR IN PURE JAVA199by Rhys Newman and Christopher DennisIntroduction200Proof of Concept202The PC architecture205Java performance tips206Four in Four: It Just Wont go207The perils of protected mode210Fighting A Losing Battle214Hijacking the丿VI217Ultimate Flexibility229Ultimate Securit231It Feels Better the Second Time around23210 THE STRENGTH OF METACIRCULAR VIRTUAL MACHINES: JIKES RVM235by lan rogers and dave groveBackground236Myths Surrounding runtime Environments237A Brief History of Jikes RVM240Bootstrapping a self-Hosting runtime241Runtime Components246Lessons learned259References259Part Four END-USER APPLICATION ARCHITECTURES11 GNU EMACS: CREEPING FEATURISM ISA STRENGTH263by Jim BlandyEmacs in use264Emacs’ s Architecture266Creeping Featurism272Two Other architectures27512 WHEN THE BAZAAR SETS OUT TO BUILD CATHEDRALS279by till Adam and mirko boehmIntroduction279History and Structure of the KDE Project282Akonadi287ThreadWeaver303Part five LANGUAGES AND ARCHITECTURE13 SOFTWARE ARCHITECTURE: OBJECT-ORIENTED VERSUS FUNCTIONAL315by Bertrand MeyerOverview315CONTENTSThe Functional Examples318Assessing the modularity of Functional Solutions321An Obiect-Oriented View330Assessing and Improving oo Modularity336Agents: Wrapping Operations into ObjectsAcknowledgments345References34614 REREADING THE CLASSICS349by Panagiotis LouridasEverything Is an object353Types Are Defined Implicitly361ProblemsBrick and mortar architectureReferencesAFTERWORDby william/. mitchellCONTRIBUTORS387INDEX393viii CONTENTS