Implementation TechniquesObjectivesSlide 3Recall Pipe-and-FilterFramework #1: stdioEvaluating stdioFramework #2: java.ioEvaluating java.ioRecall the C2 StyleFramework #1: Lightweight C2 FrameworkEvaluating Lightweight C2 FrameworkFramework #2: Flexible C2 FrameworkSlide 13Evaluating Flexible C2 FrameworkSlide 15Implementing Pipe and Filter Lunar LanderSlide 17Slide 18GetBurnRate FilterSlide 20Slide 21CalcBurnRate FilterSlide 23Slide 24Slide 25Slide 26DisplayValues FilterSlide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34TakeawaysImplementing Lunar Lander in C2Implementing Lunar Lander in C2 (cont’d)Clock ComponentSlide 39Slide 40GameState ComponentSlide 42Slide 43Slide 44GameLogic ComponentSlide 46Slide 47Slide 48Slide 49GUI ComponentSlide 51Slide 52Slide 53Slide 54Main ProgramSlide 56Slide 57Copyright © Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy. All rights reserved.ImplementationTechniquesSoftware ArchitectureLecture 162Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureObjectivesConceptsImplementation as a mapping problemArchitecture implementation frameworksEvaluating frameworksRelationships between middleware, frameworks, component modelsBuilding new frameworksConcurrency and generative technologiesEnsuring architecture-to-implementation consistencyExamplesDifferent frameworks for pipe-and-filterDifferent frameworks for the C2 styleApplicationImplementing Lunar Lander in different frameworks3Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureConceptsImplementation as a mapping problemArchitecture implementation frameworksEvaluating frameworksRelationships between middleware, frameworks, component modelsBuilding new frameworksConcurrency and generative technologiesEnsuring architecture-to-implementation consistencyExamplesDifferent frameworks for pipe-and-filterDifferent frameworks for the C2 styleApplicationImplementing Lunar Lander in different frameworksObjectives4Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureRecall Pipe-and-FilterComponents (‘filters’) organized linearly, communicate through character-stream ‘pipes,’ which are the connectorsFilters may run concurrently on partial dataIn general, all input comes in through the left and all output exits from the rightSoftware Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; (C) 2008 John Wiley & Sons, Inc. Reprinted with permission.5Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureFramework #1: stdioStandard I/O framework used in C programming languageEach process is a filterReads input from standard input (aka ‘stdin’)Writes output to standard output (aka ‘stdout’)Also a third, unbuffered output stream called standard error (‘stderr’) not considered hereLow and high level operationsgetchar(…), putchar(…) move one character at a timeprintf(…) and scanf(…) move and format entire stringsDifferent implementations may vary in details (buffering strategy, etc.)6Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureEvaluating stdioPlatform supportAvailable with most, if not all, implementations of C programming languageOperates somewhat differently on OSes with no concurrency (e.g., MS-DOS)FidelityGood support for developing P&F applications, but no restriction that apps have to use this styleMatching assumptionsFilters are processes and pipes are implicit. In-process P&F applications might require modificationsEfficiencyWhether filters make maximal use of concurrency is partially up to filter implementations and partially up to the OS7Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureFramework #2: java.ioStandard I/O framework used in Java languageObject-orientedCan be used for in-process or inter-process P&F applicationsAll stream classes derive from InputStream or OutputStreamDistinguished objects (System.in and System.out) for writing to process’ standard streamsAdditional capabilities (formatting, buffering) provided by creating composite streams (e.g., a Formatting-Buffered-InputStream)8Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureEvaluating java.ioPlatform supportAvailable with all Java implementations on many platformsPlatform-specific differences abstracted awayFidelityGood support for developing P&F applications, but no restriction that apps have to use this styleMatching assumptionsEasy to construct intra- and inter-process P&F applicationsConcurrency can be an issue; many calls are blockingEfficiencyUsers have fine-grained control over, e.g., bufferingVery high efficiency mechanisms (memory mapped I/O, channels) not available (but are in java.nio)9Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureRecall the C2 StyleLayered stylewith event-basedcommunicationover two-waybroadcastbusesStrict rules on concurrency,dependencies, and so onMany frameworks developed for different languages; focus on twoalternative Java frameworks hereSoftware Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; (C) 2008 John Wiley & Sons, Inc. Reprinted with permission.10Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureFramework #1: Lightweight C2 Framework16 classes, 3000 lines of codeComponents & connectors extend abstract base classesConcurrency, queuing handled at individual comp/conn levelMessages are request or notification objectsSoftware Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; (C) 2008 John Wiley & Sons, Inc. Reprinted with permission.11Foundations, Theory, and PracticeSoftware ArchitectureSoftware ArchitectureEvaluating Lightweight C2 FrameworkPlatform supportAvailable with all Java implementations on many platformsFidelityAssists developers with many aspects of C2 but does not enforce these constraintsLeaves threading and queuing policies up to individual elementsMatching assumptionsComp/conn main classes must inherit from distinguished base classesAll messages must be in dictionary formEfficiencyLightweight framework; efficiency may depend
View Full Document