Unformatted text preview:

FrameworksSlide 2Framework isSlide 411Inversion of ControlParts of Framework ApplicationHistory of MVCSlide 8MVCSlide 10Slide 11Model/View/ControllerSlide 13White-box vs. black-box frameworksperform:Command patternMVC InterfacesMVC interfacesTemplate MethodsMorphic and MVCConduitsNetwork Protocol HandlersSending Messages with ConduitsAdapter PatternSlide 25Features of ConduitsMultiplexorHandling ProtocolsState PatternDelegation in DetailSlide 438Slide 439Making Conduits More ReusableCommandCommand in ConduitsVisitorVisitor TradeoffsVisitor in ConduitsImplementing VisitorSlide 447Some PrinciplesSlide 449Adding Connections to a MultiplexorSummary of Patterns in Conduits+Using Patterns in DocumentationSummary01/14/19 FrameworksModel/View/ControllerCommand - State01/14/19 FrameworksInterface design and functional factoring constitute the key intellectual content of software and are far more difficult to create or re-create than code. Peter Deutsch01/14/19 Framework isthe design of an application or subsystem expressed as a set of abstract classes andthe way objects in those classes collaborate.Usually comes with a library of reusable classes.01/14/19 Use framework to build application by:• Creating new subclasses• Configuring objects together• Modifying working examples(editing scripts)01/14/19 Inversion of ControlSubroutine libraryUser's program calls reused code.User designs structure of program.FrameworkReused code calls user's programStructure of program determined primarily by reused code.01/14/19 Parts of Framework ApplicationReuse FrameworkReuse component libraryNew classes for componentsScript that specifies classes of components by  creating components connecting components parameterizing components01/14/19 History of MVCFirst version: 1980 -- subclass for each pane to adapt to modelPluggable views: 1983 -- specify messages to send to model with symbols01/14/19 History of MVCObjectWorks 4.0: 1989 -- compose model from value holders, compose view from Wrappers, CompositesVisualWorks: 1992 -- UI builderVisualWorks: 1998 -- event driven Controllers01/14/19 MVCModelView Controller*dependentsmodel01/14/19 MVCModeladdDependentchanged:Viewupdate:defaultControllerControllerhandleEvent:*dependentsmodelFactory MethodObserverStrategy01/14/19 MVCCompositeViewViewupdate:displayOn:ControllerdependentsmodelDecorator CompositeModelWrapper**01/14/19 Model/View/ControllerModelapplication objectno user interfaceViewmaintains image of modelowns region of screennested01/14/19 Model/View/ControllerControllerconverts user actions into messageschanges state of model01/14/19 White-box vs. black-box frameworksWhite-boxMust understand internalsReuse mostly by inheritanceBlack-boxMust understand interfacesReuse mostly by polymorphism and composition of library classesWhite-box is easier to design, harder to reuse01/14/19 perform:Main use:pluggable viewsconvertersmenusCan often be replaced by blocksSee “Pluggable Behavior” in Smalltalk Best Practice Patterns01/14/19 Command patternRepresent a command as an object so you can decouple choosing a command from executing it. Now you can pass it over a network, save it in a menu, undo it, or log it.Blocks and selectors (with perform:) are both light-weight, language-specific implementations of the Command pattern.01/14/19 MVC InterfacesController-Viewview is responsible for its controllerview is responsible for its area on the screenview is responsible for its subviewview can scroll itselfview can redisplay itself01/14/19 MVC interfacesController-Modelmodel keeps track of its dependentsapplication dependent operationsView-Modelmodel keeps track of its dependentsapplication display operations01/14/19 Template MethodsEach level of the class hierarchy implements the abstract methods of its superclasses, often with a template method that introduces new abstract methods.Classes lower in the class hierarchy are easier to use, abstract methods are finer-grained.01/14/19 Morphic and MVCMorphic combines View and Controller into the Morph.Often merges model with Morph, too.Very large library of classes, but they can rarely be reused without modification.Inheritance important, more white-box than MVC.01/14/19 ConduitsTCP/IP for Choices - Johnny Zweig• white boxATM signaling protocol - ASCOM (Robert Engel, Hermann Hueni)• black boxIssues:• using design patterns• how frameworks become more black box01/14/19 Network Protocol HandlersProtocol stacks - layers of protocol handlers.Messages flow up and down stacks.Stacks should be plug compatible.Should be able to make new stack easily.Each box is a c onduit that passes messages up or down the protocol stack.TCPIPEthernetHTTP01/14/19 Sending Messages with ConduitsTCPConduitIPConduitEthernetConduitHTTPConduitSendFromTop(Message *) sends a message down the stack.SendFromBottom(Message *) sends a message up the stack.Who calls SendFromBottom on the EthernetConduit?01/14/19 Adapter PatternIntent: Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.An ad apter object will make the adaptee act like it has the target interface.01/14/19 Adapter PatternTarge trequest()ClientAdapterrequest()Adaptee01/14/19 Features of ConduitsTCPConduitARPConduitEthernetConduitUDPConduitIPConduit#1 #2#3#4Multiplexing and demultiplexing BidirectionalOne-ended vs. two-endedTCP ports01/14/19 MultiplexorMux is a kind of composite.ConduitsendFromTopsendFromBottomMuxEthernetConduit01/14/19 Handling ProtocolsState dependent behaviorTCPConduit has many states: open, listening, connected, closing.Legal operations depend on its state.State pattern: split state into separate objectdelegate operations that depend on state to the state object01/14/19 State PatternTCPConduitTCPStateTCPOpenStateTCPClosedStateTCPListeningStatecurrent state01/14/19 Delegation in DetailTCPState has subclasses TCPOpenState, TCPClosedState, TCPListeningState, etc.TCPConduit has a current state that is a subclass of TCPState.TCPConduit delegates operations like send and open to its current state. Many operations change current state of the TCPConduit.Each kind of state has different "send" and "open" methods.TCPConduit has to pass pointer to itself along to current state.01/14/19 TCPState class {public:virtual open( Conduit*);virtual close( Conduit*);virtual send( Conduit*,


View Full Document

UIUC CS 598 - Frameworks

Download Frameworks
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Frameworks and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Frameworks 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?