1 of 20

Software Crafters

Meet-up7

REC

SOLID Principles

2 of 20

Let's Introduce ourselves

  • Name
  • Where you work/study
  • Favourite game from childhood

3 of 20

Has this ever happened to you?

Wasted hours on a code to understand what it do?

Adding a small feature took way more hours than expected?

Implementing a simple feature led to messed up code design

The code you wrote was not easy to test

4 of 20

“Software Crafting”

SIMPLE DESIGN

REFACTORING

TDD

PAIR PROGRAMMING

DESIGN CALISTHENICS

CONTINUOUS INTEGRATION

5 of 20

“Value code that is easy to maintain

over code that is easy to write”

6 of 20

Timeline

2.00 - 2.45 pm: Kick-off & discussion

2.45 - 4.45 pm: Kata

4.45 - 6.00 pm: Retrospective

7 of 20

<SOLID/>

Uncle bob

8 of 20

SOLID: Single Responsibility

  • Responsibility = Reason to change
  • Things that change together should be placed together (cohesion)

9 of 20

SOLID: Open/Closed Principle

before

after

10 of 20

  1. Client using account is closed �for modification
  2. If we want to add new account �type it is open for extension

11 of 20

SOLID: Liskov Substitution Principle

  • Replacing a base class with any subclass should not change meaning�
  • Sometimes something that sounds right in natural language doesn't quite work in code...

12 of 20

Ref: https://stackoverflow.com/a/584732

13 of 20

SOLID: Interface Segregation

Clients should not be forced to depend upon interfaces that they do not use.

14 of 20

SOLID: Dependency Injection

Any higher classes should always depend upon the abstraction of the class rather than the detail.

15 of 20

BAD EXAMPLE

GOOD EXAMPLE

16 of 20

Some Guidelines

17 of 20

Pair Programming

“Two minds are better than one”

“For an idea to go from your head into the computer it MUST go through someone else’s hands”

18 of 20

Keep tests green

  • If you break any tests while refactoring, undo, go back to green and start over.
  • Don’t change production code that is not covered by tests.
  • Use ‘Safe Refactorings’ using IDE
  • Decouple tests first if they are coupled with implementation.

19 of 20

Kata Overview

git clone https://github.com/karachi-katas/Racing-Car-Leaderboard-Kata.git

Please share your GitHub ID in chat

create your branch e.g. ‘master-amir-saad-sauban’

20 of 20

BreakoutRooms

BreakoutRooms

BreakoutRooms

RETRO

Everyone discusses their solution

Discussion on what Kata is about

5:15 PM

3:00 PM