De Leon, Kelvin Kier C.
BSIT501P
Laboratory Exercise: Requirements Elicitation
For each class diagram that violates a design principle shown in the table below,
provide a solution that implements the design principle
...
De Leon, Kelvin Kier C.
BSIT501P
Laboratory Exercise: Requirements Elicitation
For each class diagram that violates a design principle shown in the table below,
provide a solution that implements the design principles.
o Analyze how the given class diagram violates the design principles.
o Formulate a solution on how you will implement design principles to make the class
diagram conform to a design principle. Note: Provide only one (1) solution for each class
diagram.
o Draw your solution in MS PowerPoint and explain your solution. If you using a mobile
phone, you may draw on a clean sheet of paper. Take a photo of your output then upload
it to the provided DropBox.
1. Single Responsibility Principle
Let us study the Single Responsibility Principle. Using it I make a simple class diagram.
You see the class diagram of the book and the inside is the title and author. This violates because
the class diagram of the book has many functions.
I will make it easier because I will separate the two so that they have different
responsibilities. The solution here to fully understand is I will just put to whom they belong. You
see in my solution is separated and combined into a class diagram. But this does not mean that
when you create a program it is separate, it just makes the whole of that program easier. The
book is for the book, the title is for the title, and the author is for the author.
Book
+ searchBook():
void
2. Open/Closed Principle
I now discussed the Open/Closed Principle. It promotes the use of interfaces to enable
you to adapt the functionality of your application without changing the existing code. The class
diagram of Book Discount was good. When I first saw it, he was fine. But when I use him Open /
Closed Principle. This can increase the function of the Book Discount. It probably violates
discounts and books.
[Show More]