Yale CPSC 427 - Object-Oriented Programming
School name Yale University
Pages 42

Unformatted text preview:

OutlineReview for Exam 2Graphical User InterfacesThe gtkmm FrameworkOutline Review GUI gtkmmCPSC 427a: Object-Oriented ProgrammingMichael J. FischerLecture 23aNovember 29, 2011CPSC 427a, Lecture 23a 1/42Outline Review GUI gtkmmReview for Exam 2Graphical User InterfacesThe gtkmm FrameworkCPSC 427a, Lecture 23a 2/42Outline Review GUI gtkmmReview for Exam 2CPSC 427a, Lecture 23a 3/42Outline Review GUI gtkmmPrivacyIHow privacy attributes are determined.IHow privacy attributes affect visibility.IHow to use privacy to support OO-programming.CPSC 427a, Lecture 23a 4/42Outline Review GUI gtkmmCode efficiencyIHow to measure running time.IHow to build an adaptor class (Stopwatch) to a systemresource (struct timeval).IDefining and using a cast.IEfficiency of various kinds of containers.IRuntime tester.IUse of member function pointers.CPSC 427a, Lecture 23a 5/42Outline Review GUI gtkmm15-Hangman game demoIUse of derivation for classes Alphabet and HangWord.IThe StringStore data structure and its implementation.CPSC 427a, Lecture 23a 6/42Outline Review GUI gtkmm15-Hangman-full game demoIRemoving fixed size limits in StringStore and thevocabulary.IDefinition and use of a template class.IIntroduction of a new class Player. Why was this done?CPSC 427a, Lecture 23a 7/42Outline Review GUI gtkmmTemplatesIPurpose of templates.IContrast variability using templates with variability throughpolymorphic derivation.ITemplate functions.ISpecialization.ITemplate classes.ICode structure and compiling templates.ITemplate parametersIExamples: 15-Hangman-full and 16-Evaluate.CPSC 427a, Lecture 23a 8/42Outline Review GUI gtkmmC++ standard libraryIContainers. Focus on understanding vector, list, and map.IUse of class pair.IMeaning of value semantics.IIterators: What they are; how to use them.IOther container functions: operator[](), size().IStandard algorithms.IDefining a comparison function for use with std::sort().Istring class.CPSC 427a, Lecture 23a 9/42Outline Review GUI gtkmmCasts and conversionsIKinds of casts in C: value, pointer,IKinds of casts in C++: static, dynamic, reinterpret, const.IThree different syntaxes for explicit casts.IImplicit casts.IResolving ambiguity.Iexplicit keyword.CPSC 427a, Lecture 23a 10/42Outline Review GUI gtkmmOperator extensionsICorrespondence between operator symbols and operatorfunctions.ISpecial cases: operators that can be either prefix or postfix(++, --).IOther special cases: subscript, arrow, function call, cast, new,delete.CPSC 427a, Lecture 23a 11/42Outline Review GUI gtkmmPolymorphism and virtual functionsIWhen to use?IWhat happens to a virtual function when inherited by aderived class?IAbstract class and interfaces.IExamples 18a-Dynamic cast, 18b-Virtue, and18c-Virtual.IDependency graph for include files.CPSC 427a, Lecture 23a 12/42Outline Review GUI gtkmmExceptionsIWhat are exceptions?IWhy is a special exception-handling mechanism needed?IHow is an exception signaled? throw.IHow is an exception handled? try and catch blocks.IStandard exceptions and how to catch them.IMultiple catch blocks.Irethrow.IAvoiding need to rethrow by putting resource cleanup codeinto destructors.CPSC 427a, Lecture 23a 13/42Outline Review GUI gtkmmMultiple inheritance and ordered container examplesIDemo 20a-Multiple.IElement ordering, keys, and comparison operators.IMultiple inheritance.IObject structure with multiple inheritance.CPSC 427a, Lecture 23a 14/42Outline Review GUI gtkmmTightly-coupled classes and circularityIWhat it means to be tightly coupled.IProblems with #include.IHow to resolve circularity: forward declarations; out-of-linefunction definitions.CPSC 427a, Lecture 23a 15/42Outline Review GUI gtkmmTemplatized ordered linear data structuresIExamples 20b-Multiple-template and21a-Multiple-template combine templates withpolymorphic derivation.IHow is each used?IHow is the KeyType template parameter used? Who definesit? Who uses it?CPSC 427a, Lecture 23a 16/42Outline Review GUI gtkmmSTL and PolymorphismIWhy do some people say never to use STL containers as baseclasses?IWhen is it safe to do so?IUnder what situations might there be problems?CPSC 427a, Lecture 23a 17/42Outline Review GUI gtkmmSimple versus polymorphic derivationIWhat is simple derivation good for?IWhat are its advantages and disadvantages?IWhat is polymorphic derivation good for?IWhat are its advantages and disadvantages?IComposition as an alternative to derivation.CPSC 427a, Lecture 23a 18/42Outline Review GUI gtkmmDesign patternsIGeneral OO principlesIWhat does a design pattern consist of?IAdaptor pattern.IIndirection pattern.IProxy pattern.IPolymorphism pattern.IController pattern.IBridge pattern.ISubject-Observer pattern.ISingleton pattern.CPSC 427a, Lecture 23a 19/42Outline Review GUI gtkmmSoftware design processIThe Waterfall process.IThe Spiral process.IOO-design.ICode reusability.IReducing dependencies among classes.IBuilding in flexibility.IUML notation.CPSC 427a, Lecture 23a 20/42Outline Review GUI gtkmmGraphical User InterfacesCPSC 427a, Lecture 23a 21/42Outline Review GUI gtkmmUser InterfacesModern computer systems support two primary general-purposeuser interfaces:Command line: User input is via a command line typed at thekeyboard. Output is character-based and goes to aphysical or simulated typewriter-like terminal.Graphical User Interface (GUI): User input is via a pointing device(mouse), button clicks, and keyboard. Output isgraphical and goes to a window on the screen.CPSC 427a, Lecture 23a 22/42Outline Review GUI gtkmmInterfaces for C++The C++ standard specifies a command line interface: iostreamand associated packages. No similar standard exists for GUIs.De facto GUI standards in the Linux world are GTK+ (used by theGnome desktop) and Qt (used by the KDE desktop).GTK+ is based on C; Qt is based on an extension of C++ andrequires a special preprocessor.gtkmm is a C++ wrapper on top of GTK+.Advantages: Provides type safety, polymorphism, and subclassing.Provides a native interface to C++ code.Disadvantages: Components not so well integrated.Documentation spread between gtkmm, gtk+, andother components but improving.CPSC 427a, Lecture 23a 23/42Outline Review GUI gtkmmOverall Structure of a GUIA GUI manages one or more windows.Each window displays one or more widgets.These are objects that provide graphical and textual input andoutput to the program.A GUI package such as gtkmm maintains a widget tree.A widget controls a particular kind of user input or output.Examples: label, text box, drawing area,


View Full Document

Yale CPSC 427 - Object-Oriented Programming

Download Object-Oriented Programming
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 Object-Oriented Programming 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 Object-Oriented Programming 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?