Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to use the Singleton Pattern on repository classes, to make sure only one instance of each class is created. I have one

I am trying to use the Singleton Pattern on repository classes, to make sure only one instance of each class is created. I have one question and I will use the 'Item' Class on my UML as the example. Should I move the attributes and methods from my 'Item' class ( like itemNumber, getItemNumber(), setItemNumber() ) to my repository class? Since the repository class is the one creating the instance, I am thinking it would need to have those attributes and methods to create the Item, and then I would remove them from the 'Item' class. Any help or feedback is much appreciated!

Here is my UML:

image text in transcribed

image text in transcribed

ItemRepositery -item : Item -Item() +getltem(): Item +update() +insert() +fetch() \begin{tabular}{|l|l|l|} \multicolumn{1}{c|}{ Borrower } \\ -firstName: String \\ -lastName: String \\ -address: String \\ -city: String \\ - postalCede: String \\ -province: String \\ -number: int \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions