DOC PREVIEW
MSU CSE 870 - More Frameworks

This preview shows page 1-2-17-18-19-36-37 out of 37 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

More FrameworksOverviewRecap on OOPInheritance and polymorphismProtocolAbstract classesUse of Abstract Class to Represent a ProtocolAbstract Operations and Design CouplingExample Decoupling using abstract operationsExample: Use of these classesExample: continuedPlug CompatibilityIntro to OO FrameworksFrameworkFrameworksClass Libraries vs Frameworks vs PatternsCharacteristics of FrameworksObject-Oriented FrameworksExample: Java AWT Framework (abstracted)Whitebox FrameworksExample: Event handling in Java AWT 1.02 and beforeBlackbox FrameworksExample: Event handling in Java AWT 1.0 and 1.1Event handling (AWT 1.1)AWTEvent hierarchyEvent routingListenersExample: An action-event listenerExample: A mouse-event listenerDesign schema for event routingExample OO Framework:SubArctic and animationAbstract UML of the frameworkData DictionarySubArctic animationsApplication Construction Environments (Toolkits)Influence of OO FrameworksRRRMore Frameworks•Acknowledgements:–K. Stirewalt–R. Johnson, B. Foote–Johnson, Fayad, SchmidtRRROverview•Review of object-oriented programming (OOP) principles. •Intro to OO frameworks: oKey characteristics. oUses. oBlack-box vs. white-box frameworks. •Example study: Animations in the subArctic UI toolkit.RRRRecap on OOP•Key features that differentiate OOP from traditional block-structured languages: –Polymorphism: a late-binding feature, whereby a procedure is dynamically bound to a message request. –Inheritance: allows operations to be defined in one (parent) class and then overridden in another (child) class. •Inheritance and polymorphism together are the principle tools of OO frameworks.RRRInheritance and polymorphism •Subclasses provide different methods for same operation. •Benefit: Enables decoupling of cooperating classes. –Clients need not know how an operation is implemented. –Thus, designs are portable and extensible. –Code can be reused. •Two cases: 1. Superclass provides a method for the operation. •we say the subclass overrides this method. •subclass method may explicitly invoke superclass method. 2. Superclass provides no method for the operation. •we say the operation is abstract in the superclass.RRRProtocol •Operations performed on objects by ``sending them messages''. •Specification of an object given by its message protocol: –Set of messages that can be sent to it; –Includes type of arguments of each message. •Objects with identical protocol are interchangeable. •Interface between objects defined by protocols they expect each other to understand. •In most languages, protocol is bound to an object's class1.RRRAbstract classes •Defn: class that cannot have any instances. •Only subclasses can have instances. •How to specify that a class is abstract: –C++: Implicit; abstract class has pure virtual functions. –Java: •Class can be explicitly declared abstract, or •Abstract operations can be grouped into an interface. •Used to define standard protocols.RRRUse of Abstract Class to Represent a ProtocolRRRAbstract Operations and Design Coupling•Imagine: a tool that places figures on a grid. –Example: gridding of program icons in a window manager. –Example: placement of button figures in a panel. •Grid-management code allocates figures to grid positions, avoiding collisions and possibly implementing a fill policy. •Code should not be concerned with how to draw a figure. •Question: How do you separate grid management from the drawing of figures?RRRExample Decoupling using abstract operationsRRRExample: Use of these classes#include "Square.h" #include "Triangle.h" #include "Circle.h" #include "Grid.h" ... Grid myGrid; ... myGrid.AddFigure( new Square );myGrid.AddFigure( new Triangle );myGrid.AddFigure( new Circle ); myGrid.Draw();RRRExample: continued class Figure : public WindowComponent { public: virtual void Draw() = 0; // pure virtual function!}; class Grid : public WindowComponent { public: void AddFigure( Figure* ); void Draw() { for( int i=0; i < 3; ++i ) { figures[i].Draw(); } private: Figure* figures[3]; };RRRPlug Compatibility•If several classes define same protocol, then objects in those classes are plug compatible. •Thus complex objects can be created by plugging together a set of compatible components. •Style of programming called building tool kits.RRRIntro to OO FrameworksRRRFramework•Support reuse of detailed designs•An integrated set of components:–Collaborate to provide reusable architecture for–Family of related applicationsRRRFrameworks1. Frameworks are semi-complete applications•Complete applications are developed by inheriting from, and•Instantiating parameterized framework components2. Frameworks provide domain-specific functionality•Ex.: business, telecommunication, dbases, distributed, OS kernels3. Frameworks exhibit inversion of control at run-time•Framework determines which objects and methods to invoke in response to eventsRRRClass Libraries vs Frameworks vs Patterns•Definition: –Class Libraries:•Self-contained,•Pluggable ADTs–Frameworks:•Reusable, semi-complete applications–Patterns:•Problem, solution, contextApplicationSpecificLogicNetworkingMathDbaseADTsUIEventLoopApplicationSpecific LogicMathADTsEventLoopUINetworkingDbaseInvokesInvokesCall BacksClass Library ArchitectureFramework ArchitectureRRRCharacteristics of Frameworks•Often: oUser-defined methods invoked by the framework code itself. oFramework plays the role of ``main program''. •This inversion of control allows frameworks to serve as extensible code skeletons. •User-supplied methods tailor generic framework algorithms for a specific application.RRRObject-Oriented Frameworks•A.k.a: Object-oriented abstract design. •Consists of: oAbstract class for each major component; oInterfaces between components defined in terms of sets of messsages. oUsually a library of subclasses that can be used as components in the design. •Many well-known examples: oAll modern UI toolkits (e.g., Java AWT, subArctic, MFC). oDistributed computing toolkits (e.g., ACE).RRRExample: Java AWT Framework (abstracted)RRRWhitebox Frameworks–Program skeleton:•Subclasses are the additions to skeleton–Implications:•Framework implementation must be understood to use•Every application requires the creation of many new subclasses•Can be difficult to learn:–Need to need how it was constructed


View Full Document

MSU CSE 870 - More Frameworks

Documents in this Course
HW2

HW2

3 pages

splc1

splc1

21 pages

Lessons

Lessons

3 pages

revision

revision

13 pages

ft1

ft1

12 pages

john.dsn

john.dsn

21 pages

Survey

Survey

2 pages

revision

revision

38 pages

Load more
Download More 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 More 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 More 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?