solid -clean code for mere mortals
TRANSCRIPT
SOLIDClean code for mere mortals
{What is software development?
‹ Software development is not (only) programming
‹ Agile Software Development: Principles, Patterns, and Practices
‹ The Pragmatic Programmer
‹ Manifesto for Software Craftsmanship
Software requirements
‹ Notoriously fluid
‹ Changes in scope
‹ Changes in functionalities
‹ Changes in environments
‹ The only constant is change
‹ We should embrace change!
{
{Software Rot
‹ Occurs to any software that survives the first version
‹ Rigidity
‹ Fragility
‹ Immobility
‹ Viscosity
SOLID Principles
‹ Introduced by Robert C. Martin (Uncle Bob)
‹ An acronym of acronyms
‹ Not a piece of code
‹ Tool for “code smell” detection
{
SOLID Principles
‹ Single Responsibility Principle
‹ Open Closed Principle
‹ Liskov Substitution Principle
‹ Interface Segregation Principle
‹ Dependency Inversion Principle
{
SOLID
‹ Single Responsibility Principle
‹ Single Level of abstraction
‹ Just one reason to change
‹ Antithesis of the “God” object
{
SRP IN ACTION
SOLID
‹ Open Closed Principle
‹ Inspired from work on Eiffel
‹ Open for extensions
‹ Closed for modification
‹ Use polymorphic behaviours
{
OCP IN ACTION
SOLID
‹ Liskov Substitution Principle
‹ Named after Barbara Liskov
‹ Subclasses should be substitutable for their base classes.
‹ Design by Contract
‹ A Circle is not an Ellipse
{
LSP IN ACTION
SOLID
‹ Interface Segregation Principle
‹ It’s not always about the `interface` keyword
‹ An interface should have a single purpose
‹ An interface should define a client
{
ISP IN ACTION
SOLID
‹ Dependency Inversion‹ Depend upon abstractions.‹ Do not depend upon concretions.‹ Object creation problems – use
object factories.‹ The principle behind Inversion-of-
control and Dependency Injection
{
DIP IN ACTION
Bonus Principle: YAGNI
‹ You Ain’t Gonna Need It
‹ Just-in-time implementation
‹ Avoid architecture astronauts
‹ Simpler code is easier to refactor
‹ Keep it as simple as possible, but not simpler
{
Questions?• Complete the electronic evaluation
forms on the computers in the hall and enter to win!– Telerik Ultimate Collection– RedGate .NET Reflector VSPro– ComponentOne Enterprise Studio Suite– Pluralsight yearly subscriptions– CodeSmith Tools Generator Pro
Personal– JetBrains ReSharper– Semos Education Training Voucher– and many more…