1 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu
2 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Problems with (Object-Oriented) Design From Dreams to Reality Dreams: object-oriented mechanisms will automatically increase the quality of software e.g. make systems easier to maintain or reuse Reality: uncountable number of OO legacy systems in the industry inflexible, hard to understand, hard to extend… Why? Time Pressure Changing Requirements Immature Developers
3 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Design and Quality …“Design is hard ” [Opdyke92] Object-oriented design makes no exception... Quality is in danger Pressure of the market to control of quality but… …“ You can’t control what you can’t measure ” [DeMarco82] What should we measure? How should we measure? Software needs design but…
4 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Design Flaws… Design problems are frequent legacy systems with high business value must maintain and enhance the system Design problems are expensive high effort required for maintenance and extension Design problems will always be there! at least because of time pressure. …but I believe also because of changing requirements Why care?... are malign characteristics of design entities hinder the maintenance and evolution of the system by violating the principles and rules of good (OO) design
5 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, you would change just a small design fragment and suddenly % of all the classes in the system may require changes?! Just Imagine that...
6 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, But there is hope! Design rules, guidelines and heuristics Apply them and they will provide the desired quality Break them and they will break your design! Is There Any Hope? “There is no silver bullet!” [Brooks84] Encapsulation? Inheritance? Polymorphism? NO! These are just mechanisms Like in chess... … just knowing the pieces and the moves is not enough Hard to control, because rules are hard to quantify! How could we control the usage of design rules ?
7 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Detection of Design Problems Problem Detection The process of identifying the parts of a software system affected by a particular design flaw It‘s not easy! manual and empirical time-expensive and non-scalable "Measuring" the Design map source-code entities to numerical values used as quality indicators Idea: Use metrics to detect design problems!
8 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Problems with Software Measurement Definitions of Metrics Mapping attributes of a software product to numeric values [Fent97] Imprecise, confusing, or conflicting definitions Interpretation Models Not provided or hardly reusable in a different context Interpretation level is too fine-grained to lead to design decisions metrics values are like symptoms indicate an abnormality, but can’t indicate the cause reduces the relevance of measurement results There is a large gap between what we do measure and what we should measure! Need mechanism for higher-level interpretation of metrics!
9 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, The measurable expression of a rule, by which design fragments that are conformant to the rule can be identified in the source-code Detection Strategy Generic mean for defining metrics-based design rules use metrics together! Based on mechanisms of filtering and composition Filtering Mechanism Statistical functions that return a subset of a data-set Composition Operators articulate the composition of a detection rule
10 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Defining a Detection Strategy Analysis Detection Technique Select Metrics Detection Strategy Informal Rules (design-related) Top-level classes in a design should share work uniformly Beware of classes with much non-communicative behavior Beware of classes that access directly data from other classes access many “foreign” data large and complex classes or non-cohesive AOFD TopValues(20%) and... WMC HigherThan(30) or TCC LowerThan(0.33)
11 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Classification of Design Flaws
12 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, ProDeOOS at Work...
13 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Sources (Java, C++) Meta-Model parsing using Metrics Detection Strategy (*.sod) Statistical Filters 1.. n 1.. m executing with PRODEOOS List of Candidates manual inspection Process of Design Inspection
14 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Summary Design flaws are dangerous the larger the system, the higher the risk We can assess the quality of design by measuring its conformance to principles of OO design Ability to detect a significant set of design flaws at all levels, from methods to subsystems Strong tool support for the entire approach high degree of automatization and scalability
15 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Could We Do Better... for You? Approach successfully applied on industrial systems > LOC and up to LOC proved to be scalable and accurate Concepts already implemented in two important CASE tools metrics (since 2001) and detection strategies (since 2002) metricsdetection strategies in Borland Together CC and WSE second important CASE tool provider interested in implementing the concepts. Consultancy for software companies on quality assurance and re-engineering all over Europe, for the last 3.5 years ! This is not just about science and research!
16 Object-Oriented Design in Practice. Could/Should We Do Better? Dr. Radu Marinescu Timişoara, Should We Do Better... Together?