Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:03:42+00:00 2026-05-27T11:03:42+00:00

I am having a confusion regarding object modeling, which I will illustrate using a

  • 0

I am having a confusion regarding object modeling, which I will illustrate using a simple lending library project.

The library has books (one copy for each book to keep things simple) and patrons. Patrons can loan a book, if that book is not loaned to another patron.

This will need 3 classes, Book, Patron and Loan.

Book will have an id and a name. Patron will have an id and name. Loan will have an id, book_id, patron_id and loan date.

Where will the loan and return method be defined? Is this a method of book, patron or loan object?

Book is the one getting lended, patron is the one who lends the book and loan is the one who keeps all details about the particular lending operation.

Why is Loan class really needed? Of course the DB table is needed with the fields mentioned above, but from an MVC framework perspective (eg: Symfony or Rails) should this be defined as a model?

I know this is a simple and solved problem, but after being out of touch with oop design for long, I am not quote able to “view” this problem correctly!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:03:43+00:00Added an answer on May 27, 2026 at 11:03 am

    Make a class that is responsible for creating a Loan object. You could call this LoanCreator or if it is helpful for you to think of it in the following way you could call it Librarian. You would pass this new class a Book and a Patron object and it would create the Loan for you. Generally if you find yourself unsure if a method should belong to a particular class then perhaps it is time to consider creating a new class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a confusion which domain to go with. domain or www.domain I
I'm having a little bit of confusion regarding how low-level winsock is? I am
I'm having a bit of confusion regarding the Ansi vs regular rtl string functions
I am having some confusion with the new keyword,things work fine when I am
I'm having a bit of confusion in attempting to retroactively create a new base
I having one confusion about a particular git behavior: Following are the steps and
There seems to be quite a lot of confusion regarding integrating Maven with GWT
Having read all the StackOverflow entries regarding Model-View-ViewModel architecture along with most of the
I am having confusion with the following code: class A { int x; static
I'm having a little confusion when distinguishing this in an as3 file lets say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.