Part II Software engineering Geant 4 rigorous approach

  • Slides: 24
Download presentation
Part II Software engineering Geant 4 rigorous approach to software Maria Grazia Pia, INFN

Part II Software engineering Geant 4 rigorous approach to software Maria Grazia Pia, INFN Genova 1

Part II: outline 3 Motivations for software engineering in HEP 3 The software process

Part II: outline 3 Motivations for software engineering in HEP 3 The software process 3 Components of the software life-cycle 3 Object Oriented technologies 3 Brief digression on basic OO concepts 3 OOAD in Geant 4 3 Quality Assurance 3 Standards Maria Grazia Pia, INFN Genova 2

Why software engineering in HEP? ] Software engineering is somewhat new to the HEP

Why software engineering in HEP? ] Software engineering is somewhat new to the HEP environment l other engineering branches more consolidated in this environment (mechanics, electronics, accelerators etc. ) ] Benefits derive from a rigorous approach to software l the lesson can be learned from the world of software professionals! l even the most talented professionals need an organized environment to do cooperative work l advanced technology cannot be fully effective without an organizational framework The question I am always asked at this point: Is there any room for creativity? Yes! Also in other disciplines a rigorous approach can be combined with creativity: architecture, music etc. Maria Grazia Pia, INFN Genova 3

Software engineering strategies in Geant 4 Software engineering plays a fundamental role in Geant

Software engineering strategies in Geant 4 Software engineering plays a fundamental role in Geant 4 v v v v The software process Requirements Analysis and Design Object Oriented methodologies Quality Assurance Testing Physics validation Maria Grazia Pia, INFN Genova 4

The software process It is the set of actions, tasks and procedures involved in

The software process It is the set of actions, tasks and procedures involved in producing a software system, through its life-cycle ] Complex domain, evolving, with many types of models available; some examples of software process models are, for instance: l the Waterfall model l the Iterative Incremental Development model ] The Waterfall model l analysis design coding l each phase starts following the completion of the previous one ] The Iterative Incremental Development model l cycles of analysis design coding, with incremental refinement Maria Grazia Pia, INFN Genova 5

The software process in Geant 4 ] Based on the Booch methodology l l

The software process in Geant 4 ] Based on the Booch methodology l l choice resulting from a thorough study of various models critically evaluated and adapted to the Geant 4 peculiar environment ] Spiral-type software process: cycles of incremental analysis design implementation testing iterations Maria Grazia Pia, INFN Genova 6

Requirements ] Requirements are the quantifiable and verifiable l behaviours that a system must

Requirements ] Requirements are the quantifiable and verifiable l behaviours that a system must possess l constraints that a system must work within ] User requirements l this phase defines the scope of the system ] Software requirements l l this is the analysis phase of a software project builds a model describing what the software has to do (not how to do it) ] Requirements are subject to evolution in the lifetime of a software project! è ability to cope with the evolution of the requirements Maria Grazia Pia, INFN Genova 7

Geant 4 requirements Geant 4 has adopted a rigorous approach to requirements l user

Geant 4 requirements Geant 4 has adopted a rigorous approach to requirements l user requirements collected from the user communities in the initial phase l coded according the PSS-05 standard èGeant 4 User Requirements Document l continuously updated Maria Grazia Pia, INFN Genova 8

Object Oriented technology ] OO technology is built upon a sound engineering foundation, whose

Object Oriented technology ] OO technology is built upon a sound engineering foundation, whose elements are called the object model ] The object model encompasses the principles of l abstraction l encapsulation l modularity l hierarchy l typing l concurrency l persistence brought together in a synergistic way Geant 4 is based on Object Oriented technology Maria Grazia Pia, INFN Genova 9

What is an object? G. Booch (in OOAD with Applications): “An object has state,

What is an object? G. Booch (in OOAD with Applications): “An object has state, behaviour and identity; the structure and behaviour of similar objects are defined in their common class”. Maria Grazia Pia, INFN Genova 10

Some fundamental concepts in OOD -1 ] The Open Closed Principle Open for extension,

Some fundamental concepts in OOD -1 ] The Open Closed Principle Open for extension, Closed for modification l l l A software module that is designed to be reusable, maintainable and robust must be extensible without requiring modification new features are added by adding new code, rather than by changing old, already working, code The primary mechanisms behind are abstraction and polymorphism ] The Liskov Substitution Principle Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it l l Derived types must be substitutable for their base types It is an important feature for conforming to the OCP Maria Grazia Pia, INFN Genova 11

Some fundamental concepts in OOD -2 ] The Dependency Inversion Principle Modules that implement

Some fundamental concepts in OOD -2 ] The Dependency Inversion Principle Modules that implement high level policy should not depend on the modules that implement low level details l l l Both high level policy and low level details should depend on abstractions This ensures reusability and maintainability The interdependence makes a design rigid, fragile and immobile: a single change triggers a cascade of changes in dependent modules ] The Interface Segregation Principle Clients should not be forced to depend on interfaces that they do not use l l Polluted interfaces generate unnecessary couplings We want to separate interfaces whenever possible to avoid the disadvantages of couplings Maria Grazia Pia, INFN Genova 12

Analysis Webster definitions: ] separation or breaking up of a whole into its fundamental

Analysis Webster definitions: ] separation or breaking up of a whole into its fundamental elements or component parts ] a detailed examination of anything complex ] the practice of proving a mathematical proposition by assuming the result and reasoning back to the data or already established principles In the software world: ] it is the decomposition of a problem into its constituent parts ] it is accomplished by beginning with a set of stated requirements, and reasoning back from those requirements to a set of established software components and structures ] OOA is the act of determining the abstractions that underlie the requirements ] In OOA the components are objects and their collaborations Maria Grazia Pia, INFN Genova 13

Design ] Design embodies the set of decisions that determine how the components will

Design ] Design embodies the set of decisions that determine how the components will look like ] In OOD typically class inheritance and composition hierarchies are among the decisions ] OOA and OOD cooperate synergically l they are best done concurrently ] The output of OOAD is a set of class and object diagrams, showing l the static structure l the collaborations Maria Grazia Pia, INFN Genova 14

UML: Unified Modeling Language ] UML has the goal to become a common language

UML: Unified Modeling Language ] UML has the goal to become a common language for creating models of OO software ] UML represents a unification of the concepts and notations previously in use (Booch, OMT) ] UML is comprised of two major components: l l a Meta-model a notation ] UML has a standard data representation, that is called the Meta-model l l the Meta-Model is a description of UML in UML it describes the objects, attributes and relationships necessary to represents the concepts of UML within a software application ] UML notation is comprised of two major subdivisions: l l a notation for modeling the static elements of a design (classes, attributes, relationships. . . ) a notation for modeling the dynamic elements of a design (objects, messages, finite state machines. . . ) Maria Grazia Pia, INFN Genova 15

An example of a class diagram Maria Grazia Pia, INFN Genova 16

An example of a class diagram Maria Grazia Pia, INFN Genova 16

Another example of a class diagram Maria Grazia Pia, INFN Genova 17

Another example of a class diagram Maria Grazia Pia, INFN Genova 17

C++ ] OO technology and C++ are not equivalent! l l OO methodologies can

C++ ] OO technology and C++ are not equivalent! l l OO methodologies can be implemented in a variety of languages, not only in C++ One can write procedural code in C++, that is not object oriented ] C++ provides many features that make it suitable for OO implementations of large scale software projects ] An overview of C++ language features and OO technology is beyond the scope of these lectures ] Many textbooks, courses and online material are available as learning aids; a few references: l l l I. Pohl, OO programming using C++ S. B. Lippman, J. Lajoie, C++ primer B. Stroustrup, The C++ programming language G. Booch, OO analysis and design R. Martin, Designing OO C++ applications using the Booch method Maria Grazia Pia, INFN Genova 18

OOAD in Geant 4 [ Geant 4 fully exploits the power of OOAD [

OOAD in Geant 4 [ Geant 4 fully exploits the power of OOAD [ The basic principles of OOD described in the previous transparencies are applied in Geant 4 [ They ensure a software that is reusable, maintainable, robust, extensible [ OOAD is fundamental in Geant 4 for a distributed parallel approach every part can be developed, refined, maintained independently [ Problem domain decomposition and OOAD result in a unidirectional dependency of class categories [ Booch/UML notations [ CASE Tool: Rational Rose Maria Grazia Pia, INFN Genova 19

Benefits from OO technology The OO technology provides various benefits to Geant 4 ]

Benefits from OO technology The OO technology provides various benefits to Geant 4 ] Transparency l decoupling from implementation ] Flexibility l alternative models and implementations ] Openness to evolution extensibility, implementation of new models and algorithms without interfering with existing software l possibility for the user to extend the toolkit with his/her model and data ] Interface to external software, without dependencies l databases for persistency l visualisation libraries l tools for UI l etc. l Maria Grazia Pia, INFN Genova 20

Geant 4 class category diagram Maria Grazia Pia, INFN Genova 21

Geant 4 class category diagram Maria Grazia Pia, INFN Genova 21

Quality Assurance ] Extensive use of Quality Assurance systems fundamental for a toolkit of

Quality Assurance ] Extensive use of Quality Assurance systems fundamental for a toolkit of wide public use ] Commercial tools l l Insure++, Logiscope etc. ] C++ coding guidelines l scripts to verify their applications automatically ] Code inspections l within working groups and across groups ] Testing l Unit testing in most cases down to class level granularity l Integration testing sets of logically connected classes l Test-bench for each category eg. : test-suite of 375 tests for hadronic physics parameterised models l System testing exercising all Geant 4 functionalities in realistic set-ups l Physics testing comparisons with experimental data l Performance Benchmarks Maria Grazia Pia, INFN Genova 22

Standards Geant 4 is based on standards (ISO and de facto) ] STEP l

Standards Geant 4 is based on standards (ISO and de facto) ] STEP l engineering and CAD systems ] ODMG l RD 45 ] Open. GL e VRML l for graphics ] CVS l for code management ] C++ l as programming language ] UML l as modeling language Maria Grazia Pia, INFN Genova 23

System of Units ] Geant 4 is independent from any system of units ]

System of Units ] Geant 4 is independent from any system of units ] All numerical quantities are expressed with their units explicitly ] The user is not constrained to using any specific system of units in his/her application Have you heard of the “incident” with NASA’s Mars Climate Orbiter ($125 million)? Maria Grazia Pia, INFN Genova 24