Ingegneria del Software Corso di Laurea in Informatica per il Management. Software quality and Object Oriented Principles

Similar documents
17.11 Bean Rules persistent

Software Engineering

OO Class Design Principles

Open Closed Principle (OCP)

Bruno Bossola SOLID Design Principles

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Single Responsibility Principle (SRP)

CHAPTER 5: PRINCIPLES OF DETAILED DESIGN

Outline. Software Rots

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Highlights of Previous Lecture

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Conception Orientée Objets. Programmation SOLID

SOLID Principles. Equuleus Technologies. Optional Subheading October 19, 2016

Principles of Object-Oriented Design

Principles of OO Design

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

CSC207H: Software Design SOLID. CSC207 Winter 2018

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

OOD Smells and Principles

SOLID: Principles of OOD

Agile Principles, Patterns, and Practices in C#

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

09. Component-Level Design

Component-Level Design

[Sample] Quality Report: <<project>>

Software Engineering CSC40232: SOFTWARE ENGINEERING. Guest Lecturer: Jin Guo SOLID Principles sarec.nd.edu/courses/se2017

Agile Software Development

Software Engineering Design & Construction Dr. Michael Eichberg Fachgebiet Softwaretechnik Technische Universität Darmstadt

20 Years of. Improve the Design of your Code. Dr Dimitris Dranidis JAVA Meetup Group, Thessaloniki May 2015

Why Use Object-Oriented Programming in the First Place?

Object-Oriented Design

S.O.L.I.D. Principles of

Object-oriented design principles

Ingegneria del Software Corso di Laurea in Informatica per il Management

Introduction to Testing and Maintainable code

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107

Inheritance and object compatibility

EasyChair Preprint. Software Metrics Proposal for Conformity Checking of Class Diagram to SOLID Design Principles

Produced by. Agile Software Development. Eamonn de Leastar

1 Introduction 2 Complex Systems 3 Object Model 4 Dependency Management 5 Class Design. Object Oriented Programming in Physics

CS 2340 Objects and Design

Tecniche di Progettazione: Design Patterns

Component-Level Design. Slides copyright 1996, 2001, 2005, 2009 by Roger S. Pressman. For non-profit educational use only

Object-Oriented Programming and Design

Summary of the course lectures

S.O.L.I.D: Software Engineering Principles

Chapter 5 Object-Oriented Programming

Object Oriented Software Design - I

Build Testable Client and Service Applications

COURSE 2 DESIGN PATTERNS

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Object-Oriented Design

Object-Oriented Design II

11/2/09. Code Critique. What goal are we designing to? What is the typical fix for code smells? Refactoring Liskov Substitution Principle

Basic design patterns

Abstraction. Design fundamentals in OO Systems. Fundamental Software Development Principles

Liskov Substitution Principle

Outline. Subtype Polymorphism, Subtyping vs. Subclassing, Liskov Substitution Principle. Benefits of Subtype Polymorphism. Subtype Polymorphism

Today's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles

Stability. Introduction

C++ Modern and Lucid C++ for Professional Programmers

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

GRASP Design Patterns A.A. 2018/2019

Intro to: Design Principles

Princípy tvorby softvéru Dizajnové princípy

Class Design Principles

Software Design and SOLID Principles

Ingegneria del Software Corso di Laurea in Informatica per il Management (D)VCS. Davide Rossi Dipartimento di Informatica Università di Bologna

CHAPTER 5 GENERAL OOP CONCEPTS

Influence of Design Patterns Application on Quality of IT Solutions

Object-Oriented Design II - GRASP

Course 1 October, 9, Adrian Iftene

Chapter 8: Class and Method Design

Refactoring and Rearchitecturing

The Release Reuse Equivalency Principle (REP) The Common Closure Principle (CCP) The Common Reuse Principle (CRP)

CHAPTER 5: PRINCIPLES OF DETAILED DESIGN. Software Engineering Design: Theory and Practice

The following topics will be covered in this course (not necessarily in this order).

n HW5 out, due Tuesday October 30 th n Part 1: Questions on material we ll cover today n Part 2: BFS using your graph from HW4

More on object orientation

Single Responsibility Principle

Course 2 October, 16, Adrian Iftene

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Object-Oriented Design I - SOLID

OO Package Design Principles

Last Time: Object Design. Comp435 Object-Oriented Design. Last Time: Responsibilities. Last Time: Creator. Last Time: The 9 GRASP Patterns

Refactoring. Software Engineering, DVGC18 Faculty of Economic Sciences, Communication and IT Eivind Nordby

Using Design Patterns in Education and Tutoring for the Software Systems Projects in Economic

PROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development

Improve Your SystemVerilog OOP Skills

Software Engineering Design & Construction Dr. Michael Eichberg Fachgebiet Softwaretechnik Technische Universität Darmstadt

Designing with patterns - Refactoring. What is Refactoring?

Object-Oriented Technology. Rick Mercer

Software Development

Object design. François Schwarzentruber ENS Cachan Antenne de Bretagne

Exam in TDDB84: Design Patterns,

Lessons Learned. Johnny Bigert, Ph.D., Skype/Microsoft October 26, 2011

Clean Code * * Or why is more important how we write code rather what we write. Assoc. prof. Catalin Boja, Asist. Bogdan Iancu, Lect.

Course December Adrian Iftene

Software Engineering Design & Construction

Transcription:

Ingegneria del Software Corso di Laurea in Informatica per il Management Software quality and Object Oriented Principles Davide Rossi Dipartimento di Informatica Università di Bologna

Design goal The goal of design-related activities is to produce high-quality software systems What is high-quality software?

Software and quality External qualities Qualities the end user can perceive Functional Non functional Internal qualities Qualities related to how the software is organized

External qualities Correctness Usability Efficiency Reliability Integrity Adaptability Accuracy Robustness Source: Steve McConnell - Code Complete

Internal qualities Maintainability Flexibility Portability Re-usability Readability Testability Understandability Source: Steve McConnell - Code Complete

Internal qualities Maintainability Flexibility Portability Re-usability Readability Testability Understandability Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Source: Steve McConnell - Code Complete

SquaRE ISO 25010 Software product Quality Requirements and Evaluation. An evolution of ISO 9126 (and ISO 14598). Three quality models: software product quality model, data quality model, quality in use model.

ISO 25010 Software product quality (characteristics can be measured internally or externally). Functional suitability Security Reliability Compatibility Performance efficiency Maintainability Operability Portability

ISO 25010 Quality in use Effectiveness Efficiency Satisfaction Safety Usability

Consortium for IT Software Quality (SEI+OMG) Software structural quality: 5 major desirable characteristics of a piece of software needed to provide business value Reliability Efficiency Security Maintainability Size

Consortium for IT Software Quality (SEI+OMG) Software functional quality conformance to explicitly stated functional requirements level of satisfaction experienced by end-users (usability)

Do we need a framework to assess quality? Yes, at times. But most of the times we just want our software to be reusable and designed for change.

OO Principles We design OO systems, so we have to correctly identify our objects and find the right mix of encapsulation, inheritance and polymorphism in order to obtain high-quality software. Principles can be used to guarantee the maximization of software qualities.

OO Principles The critical design tool for software development is a mind well educated in design principles. [C. Larman]

Design smells Rigidity Fragility Immobility Viscosity Needless complexity Needless repetition Opacity Source: Robert C. Martin - Agile Principles, Patterns, and Practices

Design smells Rigidity Rigidity is the tendency for software to be difficult to change, even in simple ways. A design is rigid if a single change causes a cascade of subsequent changes in dependent modules. The more modules that must be changed, the more rigid the design. Fragility Fragility is the tendency of a program to break in many places when a single change is made. Often, the new problems are in areas that have no conceptual relationship with the area that was changed. Fixing those problems leads to even more problems.

Design smells Immobility A design is immobile when it contains parts that could be useful in other systems, but the effort and risk involved with separating those parts from the original system are too great. This is an unfortunate but very common occurrence. Viscosity Viscosity of the software: some options to make changes in a software system preserve the design; others do not. When the design-preserving methods are more difficult to use than the hacks, the viscosity of the design is high. Viscosity of environment: when the development environment is slow and inefficient.

Design smells Needless Complexity Needless complexity of a design in when it contains elements that aren't currently useful. This frequently happens when developers anticipate changes to the requirements and put facilities in the software to deal with those potential changes. Needless Repetition Copy and paste may be useful text-editing operations, but they can be disastrous code-editing operations. When the same code appears over and over again, in slightly different forms, the developers are missing an abstraction.

Design smells Opacity Opacity is the tendency of a module to be difficult to understand. Code can be written in a clear and expressive manner, or it can be written in an opaque and convoluted manner. Code that evolves over time tends to become more and more opaque with age. A constant effort to keep the code clear and expressive is required in order to keep opacity to a minimum.

SOLID Single responsibility principle Open-closed principle Liskov substitution principle Interface segregation principle Dependency inversion principle

SRP: Single responsibility principle A class should have one, and only one, reason to change. Each responsibility is an axis of change. If a class has more than one responsibility, the responsibilities become coupled. Changes to one responsibility may impair or inhibit the class's ability to meet the others. This kind of coupling leads to fragile designs.

OCP: open-closed principle A class should be open for extension, but closed for modification (1). Can be generalized to: software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. Failing to respect OCP leads to a change resulting in cascades of changes (rigidity). OCP advises us to refactor our design to avoid that. (1) Bertrand Meyer - Object Oriented Software Construction

Refactoring Refactoring is a disciplined technique for restructuring a software system so that its internal structure is modified without changing its external behavior

LSP: Liskov substitution principle The relation among classes in a hierarchy should be sub-typing What is wanted here is something like the following substitution property: If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2 then S is a subtype of T. (1) (1) Barbara Liskov - Data Abstraction and Hierarchy

LSP: Liskov substitution principle If a method f, accepting as argument a reference to B, misbehaves when is passed a reference to an instance of D, subclass of B, then D is fragile in the presence of f. The Liskov Substitution Principle is one of the prime enablers of OCP.

ISP: interface segregation principle The dependency of one class to another one should depend on the smallest possible interface. Or: clients should not be forced to depend on methods they do not use. Failing to respect this principle can lead to unneeded dependencies and to degenerate implementations of interfaces, causing needless complexity and potential violations of LSP.

DIP: dependency inversion principle Depend upon Abstractions. A) High level modules should not depend upon low level modules. Both should depend upon abstractions. B) Abstractions should not depend upon details. Details should depend upon abstractions.

Layered architectures "All well structured object-oriented architectures have clearly-defined layers, with each layer providing some coherent set of services through a well-defined and controlled interface." [Booch] Layered is a family of very common architectural styles.

Beware of layers A naive application of the layered style can easily lead to a violation of the DIP. A common solution is to make lower layers dependent upon a service interface declared in upper layers.