Professional Documents
Culture Documents
GROUP 5 PRESENTATION Slide OF LECTURE 2-Compressed
GROUP 5 PRESENTATION Slide OF LECTURE 2-Compressed
GROUP 5 PRESENTATION Slide OF LECTURE 2-Compressed
Lecture-2
Student ID Deep Dive in Design Principles
1805016
1805035
1805045
1805048
1805051
1805056
SOLID is a set of principles that
were introduced by Robert C.
Martin in the early 2000s as a
guide for object-oriented
software design. The principles
are meant to help software
developers create software that
is easy to understand, maintain,
and modify.
Deconstructing SOLID
Deconstructing SOLID
But…they are often inseparable
Oops…wrong diagram :p
Refactoring
Refactoring is the process of making minor, incremental changes to
existing code to enhance its readability, maintainability, and
performance. It entails renaming variables, extracting methods or
classes, reducing duplication, simplifying difficult conditionals,
enhancing naming standards, and many other things. It is a vital
aspect of the software development process and necessitates careful
design, testing, and documentation.
Logging
Logging is a vital tool for developers since it allows them to understand the behavior of
their code and troubleshoot problems during runtime. It can also assist track user
activity, detect security breaches, monitor performance, and verify compliance with
legislation and standards. Logging gives useful insights into the behavior of code and
assists developers in improving the quality, dependability, and security of their systems.
Log files are a valuable tool for developers to connect with the production environment,
offering a common language, repeatability, collaboration, feedback, and
documentation. Log files can be shared with other developers, testers, and support staff
to improve cooperation and troubleshooting, offer feedback, discover patterns and
trends, and act as documentation. By leveraging log files, developers can ensure that
they are working closely and delivering high-quality software that meets the needs of
users.
Logging
Caching
Caching is an efficient approach to increase an application's
performance by lowering the time and resources required to
conduct specific tasks. It can minimize data access time,
network traffic, database load, enhance scalability, and ensure
the system can manage huge levels of traffic without becoming
overloaded.
Storage
Encapsulation
Fixing SRP Violation
Common SRP
Violation
SRP states that each class should
have a single responsibility, and that
responsibility should be entirely
encapsulated by that class.
It's common to see logging
statements scattered throughout
business logic classes.
Logging
Issue
Scattered Logging Vision Effect
We can create a separate We only need to update the
If we decide to change “StoreLogger” class, and all
storage class that is
the format of our logs of the code that uses it will
responsible for handling all
or switch to a different automatically use the
of the logging functionality.
logging library, we updated functionality. This
like “StoreLogger”. Relevant
would need to update conforms to the SRP
methods would take
every single logging principle because each class
parameters to specify the
statement in every has a single responsibility.
message text, severity level,
single class.
and any other relevant
information.
An example of SRP Violation
THE METHOD
Updating Logging Introducing
libraries and StoreLogger class
messages
1.Inheritance : 2.Composition:
INHERITANCE
An example of open closed through inheritance
We can add a new behaviour of database storage without changing the
internal structure
Classes and objects created through inheritance are tightly coupled
because changing the parent or superclass in an inheritance relationship
risks breaking your code
FOR EXAMPLE