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

  • Home
  • SEARCH
  • 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 915861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:57:32+00:00 2026-05-15T17:57:32+00:00

How would you handle grouping different objects? For example, lets say you have a

  • 0

How would you handle grouping different objects?

For example, lets say you have a book of sport cards and you want to organize and spit out data about that book of sport cards. Obviously each sport card should have its own class and be its own object, but how would you group different sets of sprots cards? What if you wanted to see how many cards (and even the cards themselves) that were made by a given manufacturer in a given year?

Should There be a class card_book that organizes each card with functions like

getTotalBySport($sport) // Gets total number of cards within a given sport

getTotalByPrice($min, $max) // Gets total number of cards within a given price range

getCardsBySport($sport) // Get an array (or whatever other container) of cards within a given sport

or should those functions be implemented directly into the cards class?

  • 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-15T17:57:33+00:00Added an answer on May 15, 2026 at 5:57 pm

    You would have one class that describes the sports cards. From that class, you’d create objects representing each card, with all of its sundry details.

    You may also want a class that represents a collection of sports cards to, well, manage a collection of sports cards.

    Functions with in the sports card class (called methods in OOP speak) deal with managing the card’s details. Functions within the collection class would deal with the collection.

    Edit:

    To expand on this:

    The constructor for the card class would accept parameters to initialize the object when it’s created. How you go about this depends on various issues. Since there’s likely a lot of data, I would favor an associative array. This would make creating a bunch of objects easier.

    You’d also likely want setter methods for all the info that a card represents, and of course getter methods in order to retrieve that info. Depending on your needs, you may do this for each piece of information, or chunk things up as reasonable. So, for example, maybe one method to add a year’s worth of statistics, instead of one method for each particular type of stat. Meanwhile, something like the player’s name would have it’s own set of methods.

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

Sidebar

Related Questions

I am curious how others would handle this situation. I have a domain layer
I am looking for a free CMS that would handle subdomains very well. Say
I'm curious to know how Hibernate would handle the following situation. Let's say we
How would i go about writing a function that would handle the data in
I would like to handle a return result from an AsyncTask outside of the
I would like to handle the case where I don't like the format of
I would like to handle a button clicked event in a native c++ class.
How would you correct way to handle an exception in this situation? Initially I
What would be the best way to handle lightweight crash recovery for my program?
How would I be able to handle downloads using HttpResponse in Java? I made

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.