The benefits of SOLID in software development Ruben Agudo Santos (GS-AIS-HR)

Slides:



Advertisements
Similar presentations
Design Principles & Patterns
Advertisements

1 Object-Oriented Reengineering © R. Marinescu Lecture 5 Radu Marinescu Principles of Object-Oriented Design.
Since 1995, we’ve been building innovative custom solutions specifically designed to meet the unique needs of America’s most recognized companies. If you.
St Louis Day of.NET 2011 Refactoring to a SOLID Foundation Steve Bohlen Senior Software Engineer SpringSource/VMware Blog:
General OO Concepts and Principles CSE301 University of Sunderland Harry R. Erwin, PhD.
Lecture 9 Improving Software Design CSC301-Winter 2011 – University of Toronto – Department of Computer Science Hesam C. Esfahani
SOLID Object Oriented Design Craig Berntson
Inheritance and object compatibility Object type compatibility An instance of a subclass can be used instead of an instance of the superclass, but not.
Common mistakes Basic Design Principles David Rabinowitz.
Common mistakes Basic Design Principles Amit Shabtay.
Advanced Principles I Principles of Object-Oriented Class Design Copyright  by Object Mentor, Inc All Rights Reserved Portions of this material.
1 OO Design Novosoft, 2001 by V. Mukhortov. 2 OO Design Goals  Flexibility Changes must be localized  Maintainability Modules requiring changes can.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Company Confidential – Do Not Duplicate 2 Copyright 2008 McLane Advanced Technologies, LLC S.O.L.I.D. Software Development Achieving Object Oriented Principles,
Principles of Object-Oriented Design SEI, SJTU WEB APPS and SERVICES.
© 2004 Capgemini - All rights reserved SOLID - OO DESIGN PRINCIPLES Andreas Enbohm, Capgemini.
CSE 301 Exam Revision Lecture
Introduction to SOLID Principles. Background Dependency Inversion Principle Single Responsibility Principle Open/Closed Principle Liskov Substitution.
S.O.L.I.D. Software Development 12 January 2010 (Martin Verboon, Patrick Kalkman, Stan Verdiesen)
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
Design Principles iwongu at gmail dot com.
 What is SOLID  The S in SOLID  The O in SOLID  The L in SOLID  The I in SOLID  The D in SOLID  Questions.
Software Design Principles
Incremental Design Why incremental design? Goal of incremental design Tools for incremental design  UML diagrams  Design principles  Design patterns.
Elements of OO Abstraction Encapsulation Modularity Hierarchy: Inheritance & Aggregation 4 major/essential elements3 minor/helpful elements Typing Concurrency.
OO Design Principles Copyright © Vyacheslav Mukhortov, Nikita Nyanchuk-Tatarskiy, Copyright © INTEKS LLC,
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Design for testability as a way to good coding Simone Chiaretta Architect, Council of the EU December 9 th,
High Cohesion Low Coupling Old Standards for Object Oriented Programming.
Five design principles
1 Design by Principles (Robert Martin) Software Engineering.
Evaluating an Object-Oriented Design ©SoftMoore ConsultingSlide 1.
CHAPTER 3 MODELING COMPONENT-LEVEL DESIGN.
Principles of Object Oriented Design
PRINCIPLES OF OBJECT ORIENTED DESIGN S.O.L.I.D. S.O.L.I.D Principles What is SOLID?  Acrostic of 5 Principles:  The Single Responsibility Principle.
Component Design Elaborating the Design Model. Component Design Translation of the architectural design into a detailed (class-based or module- based)
SOLID Design Principles
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Session 33 More on SOLID Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office: Moench.
S.Ducasse Stéphane Ducasse 1 Some Principles Stéphane Ducasse ---
SOLID PHP & Code Smell Wrap-Up
Liskov Substitution Principle Jon McBee CLA, CLED, CTD, CPI, LabVIEW Champion.
Microsoft Advertising 16:9 Template Light Use the slides below to start the design of your presentation. Additional slides layouts (title slides, tile.
Clean Code and How to Achieve Zero Defects Jason Jolley Director, Application Development Micro Strategies, Inc.
NCCUCS Software Engineering 補充投影片 April 14, 2014.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
14 Jul 2005CSE403, Summer'05, Lecture 09 Lecture 09: Fundamental Principles and Best Practices for Software Design Valentin Razmov.
Mantas Radzevičius ifm-2/2
What is Agile Design? SRP OCP LSP DIP ISP
Interface Segregation / Dependency Inversion
Course information Old exam Resit Report Result and walkthrough
More Design Heuristics
Software Design Principles
CSE687 - Object Oriented Design class notes Survey of the C++ Programming Language Jim Fawcett Spring 2004.
Copyright © by Curt Hill
Factory pattern Unit of Work
Software Design Principles
lecture 08, OO Design Principle
11/29/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Subtype Polymorphism, Subtyping vs
15 letters that will change your code
Questions First On class? On project? On material we’ve discussed?
Principles of Object-Oriented Design
The SOLID Principles.
A (partial) blueprint for dealing with change
Principles of Object-Oriented Design
Object Oriented Design & Analysis
Dependency Inversion principle
Some principles for object oriented design
Presentation transcript:

The benefits of SOLID in software development Ruben Agudo Santos (GS-AIS-HR)

Table of contents  What is SOLID?  Single Responsibility Principle  Open-Closed Principle  Liskov’s Substitution Principle  Interface Segregation Principle  Dependency Inversion Principle  Why we should care  QA  Bibliography  What is SOLID?  Single Responsibility Principle  Open-Closed Principle  Liskov’s Substitution Principle  Interface Segregation Principle  Dependency Inversion Principle  Why we should care  QA  Bibliography

What is SOLID? Uncle Bob Not a state of matter

Single Responsibility Principle “THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE”

Single Responsibility Principle BROKEN !!

Single Responsibility Principle

Open-Closed Principle “SOFTWARE ENTITIES SHOULD BE OPEN FOR EXTENSION, BUT CLOSED FOR MODIFICATION”

Open-Closed Principle public void DrawAllShapes(Shape[] shapes) { for (int i = 0; i < shapes.length; i++) { Shape s = shapes[i]; switch(s.itsType) { case Shape.SQUARE: drawSquare((Square) s); break; case Shape.CIRCLE: drawCircle((Circle) s); break; } BROKEN !!

Open-Closed Principle public void DrawAllShapes(Shape[] shapes) { for (int i = 0; i < shapes.length; i++) { Shape s = shapes[i]; s.draw(); }

Liskov Substitution Principle “FUNCTIONS THAT USE POINTERS OR REFERENCES TO BASE CLASSES MUST BE ABLE TO USE OBJECTS OF DERIVED CLASSES WITHOUT KNOWING IT”

Liskov Substitution Principle

Moral of the story:  Model the classes based on behavior.  “...when redefining a routine [in a derivative], you may only replace its precondition by a weaker one, and its postcondition by a stronger one.” Moral of the story:  Model the classes based on behavior.  “...when redefining a routine [in a derivative], you may only replace its precondition by a weaker one, and its postcondition by a stronger one.”

Interface Segregation Principle “CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DO NOT USE”

Interface Segregation Principle BROKEN !!

Interface Segregation Principle

Dependency Inversion Principle 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” 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”

Dependency Inversion Principle void Copy() { int c; while ((c = readKeyboard()) != EOF) { writePrinter(c); }

Dependency Inversion Principle enum OutputDevice {printer, disk}; void Copy(outputDevice dev) { int c; while ((c = ReadKeyboard()) != EOF) if (dev == printer) WritePrinter(c); else WriteDisk(c); } BROKEN !!

Dependency Inversion Principle abstract class Reader { public abstract int read(); }; abstract class Writer { public abstract void write(char); }; void copy(Reader r, Writer w) { int c; while((c=r.Read()) != EOF) w.Write(c); }

Why we should care  Cleaner code (Remember Ben Wolff’s presentation)  Code smells are kept away  Codebase that is maintainable and expandable  Usually integrated in Agile methodologies, i.e. Scrum  Cleaner code (Remember Ben Wolff’s presentation)  Code smells are kept away  Codebase that is maintainable and expandable  Usually integrated in Agile methodologies, i.e. Scrum

QA THANKS FOR COMING!

Bibliography Robert C. Martin Duck Panel Robert C. Martin Photo Uploaded by Tim-bezhashvyly, under CC BY-SA 4.0 Robert C. Martin Duck Panel Robert C. Martin Photo Uploaded by Tim-bezhashvyly, under CC BY-SA 4.0