Intermediate C++ and Object-Oriented Programming Topics Version 1.0 August 18 - 26, 1997 Rob Kennedy Liz Sexton-Kennedy ================== Course Description ================== Schedule -------- 8/18 M, 8/19 Tu, 8/21 Th, (at B0 Pump room) 8/25 M, 8/26 Tu (tentatively at Hirise Computing learning lab --7NE) 3-5pm, with discussion to continue past 5pm if necessary Availability ------------ If you are interested in attending this course, please send email to johny@fnal.gov. There is no charge for attending this course. There is still time to sign up for the "Beginner c++ course" which will start at Monday, 8/4 at the B0 pump room (see CDFNEWS 14248)--which will satisfy much of the pre-requisites for this course. Description ----------- This course will cover intermediate level topics in C++ and in Object-Oriented Programming. Examples will be drawn from the CDF Trybos product and the BaBar/CDF Framework/AC++ product, though the course in general is not intended to be CDF-specific. This course will provide a basic description of each topic, present examples, and then refer to other sources for further study. For instance, rules and guidelines from Effective C++ and from More Effective C++ by Meyers will be sprinkled throughout the course, but the detailed explanation which the author provides will at best be tersely summarized. Time will be set aside at the end of each day for open discussion. The course will be video-taped; attendees and others could then view the video to re-enforce the material learned. Prerequisites ------------- Assumed: Some general knowledge of software development and event analysis concepts in HEP. Not Assumed: Detailed knowledge of CDF or particular software packages. Assumed: Knowledge of and some experience using "basic" C++ features and syntax as described in first few chapters of The C++ Programming Language by Stroustrup (2nd edition, or the just published 3rd edition). Some knowledge of "intermediate" features like inheritance, templates, and namespace is desirable. Not Assumed: Experience using "intermediate" features like inheritance, templates, and namespace. Knowledge of or experience using "advanced" features of C++, like exceptions and run-time type identification. Assumed: Some knowledge of the basic concepts of Object-Oriented software development, though related summary material is suggested below for those unfamiliar with the topic. ------------------------------------------------------------------------------- Day 1: Rob Kennedy (M 8/18, 3PM, B0 pump room) 0) Course Introduction - Goals and course format 1) Review of concepts - Simple concrete C++ classes This will be a quick review of some C++ class-related concepts using a few Trybos classes like TRY_Bank_Name and TRY_Bank_Number as examples. The goal will be to teach/review basic concrete C++ class design and implementation. 2) OOP design and code re-use with inheritance (a) basic concepts - the design view and the implementation view (b) abstract interfaces with concrete implementations The basic concepts behind the use of inheritance are defined. A OO design-related use of inheritance is described using the TRY_Abstract_Record and its child classes as an example. ------------------------------------------------------------------------------- Day 2: Rob Kennedy (Tu 8/19, 3PM, B0 pump room) 2) OOP design and code re-use with inheritance (cont.) (c) generalization and sub-typing with concrete base classes (d) using inheritance to establish policy, and other inheritance topics This topic continues with a design and implementation driven use of inheritance with TRY_Generic_Bank as an example. Using inheritance to enforce implementation policy will be explored using TRY_Named_Bank and various Bank classes as examples. 3) Iterators and collections The concept of an iterator, completely foreign to many novice C++ programmers will be reviewed. First the STL iterator class, and then in detail the TRY_Record_Iter_* classes, will be used as examples. ------------------------------------------------------------------------------- Day 3: Rob Kennedy (Th 8/21, 3PM, B0 pump room) 4) C++ Library topics Several commonly used classes from the C++ Standard Library will be briefly described, including string, iostreams, and a few commonly used collection classes. 5) C++ Standardization and Non-conforming Compilers Since many of the C++ compilers today do not yet implement the draft C++ standard, a few issues which may cause problems maintaining code for both "old-style" and standard C++ compilers will be discussed. Work-arounds already tested in Trybos will be described. 6) Physical Design and Mechanics (a) Classes and physical design - file organization and class layout (b) Fermilab C++ "Style Lite" Guidelines (c) Class Declarations versus Class Definitions - straight from Lakos (d) Interpreting and reacting to cryptic C++ compiler error messages Much of this topic is covered in some way in Large-Scale C++ Software Design by Lakos or in WWW-accessible documentation. For instance, the so-called "Style Lite" guidelines can be found at: http://www.fnal.gov/docs/working-groups/c++wg/Blurbs/style-lite.ps ------------------------------------------------------------------------------- Day 4: Rob Kennedy (M 8/25, 3-5PM, Tentatively, Hirise 7NE) 7) OOP Design (a) Review of OO analysis and (mostly) design concepts (b) The Unified Modeling Language i) Static class diagrams - abstraction and implementation views ii) Use-Case diagrams - what actually can "happen" at run-time iii) State diagrams - underlies Framework/AC++ processing model (c) Analysis and Design Patterns - what's all the fuss about? (d???) Brief demo of Graphical Designer - equipment availability? There are a number of references for this broad topic, for instance: Object-Oriented Modeling and Design - Rumbaugh, et al. Object-Oriented Analysis and Design with Applications - Booch UML Distilled: Applying the Standard Object Modeling Language - Fowler Design Patterns - Gamma, et al. For brief review of concepts, one can look at: (URL for my talk on Software Engineering and Object-Orioented Programming) - RDK ------------------------------------------------------------------------------- Day 5: Liz Sexton-Kennedy (Tu, 8/26, 3-5PM, Tentatively, Hirise 7NE) 8) Creating and using Framework/AC++ modules (a) Review of what Framework/AC++ does (b) Review of how to write an Framework/AC++ module These topics are discussed in: http://www-cdf.fnal.gov/upgrades/computing/projects/framework/frame_over/ frame_over.html and they will be quickly reviewed here. (c) Mechanics of using SoftRelTools to build example (d) Mechanics of using cdfsoft2 code mgmt to maintain example These topics are discussed in: http://www-cdf.fnal.gov/offline/code_management/run2_cmgt/run2_cmgt.html I will be emphasizing how to use the system if you are a developer. You must be a developer if you want to contribute any new Bank classes or AC++ modules to the system. (e) Tearing apart an example program - dimuon spectrum Here we will take a look at the example and explain anything that is not clear so that 9) and 10) will be possible. 9) Creating and using Trybos Bank classes For related background material, check the documentation listed in: http://www-cdf.fnal.gov/upgrades/computing/projects/trybos/trybos.html 10) Suggestions to extend example (a) From the physics point of view i) Add cuts to candidate muons and/or tracks ii) Implement a "distance of closest approach" cut iii) Extend to electron or meson candidates, other decays (b) From the programmers point of view i) Identify banks needed, create classes for them ii) Create AC++ modules to reformat compressed banks, if needed iii) Create a higher level "physics" object to hide Trybos use -----------------------------------------------------------------