Pre-Class Activity 1: SOLID Principles Review

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Pre-Class Activity 1: SOLID Principles Review

Aim

To review the SOLID principles and practise applying them to improve


implementation class designs.

Instructions

1. Review the SOLID principles for implementation class design


described in the lecture material from week 4 of INFS 2044
(Software Design and Implementation).
2. Review the videos on SOLID principles from LinkedIn Learning, start
by only watching the following (approx. 15 minutes)):
0. Introduction to S.O.L.I.D. Programming:
0. What could Go Wrong?
1. Explore a non-SOLID Class
2. Overview of the SOLID principles
3. Given your review of the SOLID principles and the Black Jack
example from 'Explore a non-SOLID Class' from the LinkedIn
Learning videos, consider how you would fix/refactor the Black Jack
design to adhere to the principles.
4. Record your answers to the following questions, w.r.t. the Black
Jack/card games example:
0. What are the key interfaces (sets of operations & visible
attributes) needed for Black Jack and other card
games? (Interface Segregation Principle)
1. Why should the key interfaces be segregated, i.e., what
indicators suggested that the separation should occur or what
are the sources of change? (Interface Segregation Principle)
2. What classes can/should be able to be replaced by another
implementation at runtime without changes to dependent
code? (Liskov Substitution principle)
3. What aspects of the interface truly need to be exposed to
support different features/functionality/implementations of
the interface? (Open/Closed principle)
4. Where should references to concrete class names (i.e.,
details) appear? Where should dependencies to abstractions
be used? (Dependency Inversion Principle)
5. What are the responsibilities of each class? That is: what do
they know? and, What do they do? (Single Responsibility
Principle)
6. How would you ensure each class has only one reason to
change? (Single Responsibility Principle)
5. Draw a UML Class Diagram for Black Jack representing your
improved implementation design.
o Remember that there is not necessarily only one "right"
answer.
o Your class diagram and responses to the questions above will
be included in the Checkpoint 4 content.
6. It is recommended that you review the remainder of the LinkedIn
Learning course on SOLID principles, but it is not essential that it be
completed before the class.
o After you have reviewed the course, reflect on the differences
between your solution and the possible solutions presented in
the LinkedIn Learning course: do your revisions adhere to the
principles (or make justified trade-offs)? would you make any
changes?

Note:

video link:

https://www.linkedin.com/learning/learning-s-o-l-i-d-programming-principles/overview-of-the-
solid-principles?autoSkip=true&autoplay=true&resume=false&u=58640609

You might also like