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 815933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:45:24+00:00 2026-05-15T01:45:24+00:00

How should I implement items that are normalized in the database in object oriented

  • 0

How should I implement items that are normalized in the database in object oriented classes? In the database I have a table of items and Groups. Each item belongs to one group:

+----------------------------------------+
| Inventory                              |
+----+------+-------+----------+---------+
| Id | Name | Price | Quantity | GroupId |
+----+------+-------+----------+---------+
| 43 | Box  | 34.00 |     456  |     4   |
| 56 | Ball | 56.50 |       3  |     6   |
| 66 | Tin  | 23.00 |      14  |     4   |
+----+------+-------+----------+---------+
Totally 3000 lines

+----------------------+
| Groups               |
+---------+------+-----+
| GroupId | Name | VAT |
+---------+------+-----+
|     4   | Mini | 0.2 |
|     6   | Big  | 0.3 |
+---------+------+-----+
Totally 10 lines

I will use the OOP classes in a GUI where the user can edit items and groups in the inventory. It should also be easy to do calculations with a bunch of items. Group information like VAT is needed for calculations.

I will write an Item class, but do I need a Group class? If so, should I keep them in a global location or how do I access them when I need it for item calculations? Is there any design pattern for this case?

  • 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-15T01:45:25+00:00Added an answer on May 15, 2026 at 1:45 am

    First of all, the most common practice is to use an ORM (object-relational mapping) tool. These are available to most any modern OO language, and they take care of generating the classes needed to interact with the database, managing retrieval and updating, and managing connection lifetime.

    That aside, yes, you need a Group class that has a collection of Items, and (ideally) a reference from Item to its parent Group. This is one of the areas where an ORM can help, since it can ensure that these two references (the collection of children and the parent reference) stay in sync.

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

Sidebar

Ask A Question

Stats

  • Questions 413k
  • Answers 413k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The IIS server (or rather the ASP.NET worker process) is… May 15, 2026 at 8:28 am
  • Editorial Team
    Editorial Team added an answer Yes you can, and I was suprised to see you… May 15, 2026 at 8:28 am
  • Editorial Team
    Editorial Team added an answer Old Solution Found the problem. The DialogWatcher was not initialized… May 15, 2026 at 8:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.