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

The Archive Base Latest Questions

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

My question began as an inquiry regarding naming a new object based on a

  • 0

My question began as an inquiry regarding naming a new object based on a variable, but as I wrote out my problem, I realized my solution’s approach may not be appropriate, so I will ask instead for general design advice. Allow me to set forth a simple example of the type of problem I’d like to solve.

Problem:

There exists a database that holds information on each planet in the solar system. The database has multiple tables.

The program intends to access this data to display it to the user in a variety of manners. The program does not intend to manipulate the data at its source, though calculations on two fields may be performed to determine certain display characteristics.

What is the optimal method for accessing the data?

My initial approach, (read: gut feeling, no research) was to take each related row of data from the database and create an object of a custom class based on the data. So you might wind up with:

Universe.Planet.Earth.mass = 1
Universe.Planet.Earth.radiusPolar = 1
Universe.Planet.Earth.radiusEquatorial = 1
Universe.Planet.Earth.aphelion = 1.106
Universe.Planet.Earth.perihelion = .983

Universe.Planet.Mars.mass = .107
Universe.Planet.Mars.radiusPolar = .531
Universe.Planet.Mars.radiusEquatorial = .533
Universe.Planet.Mars.aphelion = 1.666
Universe.Planet.Mars.perihelion = 1.381

Then use these objects to perform whatever actions the program needed to. I ran into a lot of problems trying to implement this, so that I believe my design approach is fundamentally flawed.

Any advice on how I might approach this?

  • 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-26T17:32:58+00:00Added an answer on May 26, 2026 at 5:32 pm

    I would abstract it further. Create a Universe and a universe has galaxies, so there should be a collection of galaxies in the universe. Each galaxy would contain space objects (planets, moons, etc). I would end up with a class that similar to your except:

    • the object name would be a property of the class
    • the object would have a enumerated type (planet, moon, etc)
    • something describing location (distance from center of galaxy???)

    I’m not a space junkie, so I don’t know what you could building into a base class that would apply to all objects, but I’m guessing you do.

    If there are calculations, it may be better to have SQL calculate them and make it part of a returned recordset.

    What are you calculating?

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

Sidebar

Related Questions

I recently began doing facebook application development. But it seems that the information out
Inspired by this question I began wondering why the following examples are all illegal
I will begin this question by admitting I am very new to MVC. The
Simple question; what's better and why? out.resize( in.size() ); T1::iterator outit = out.begin(); for(
I just recently began using synthesized instance variables in my iPhone projects. The problem
I have started a new app a few days ago and began working with
This is likely a dense question, seeing as I began learning how to script
This question grew out of SQLServer: Why avoid Table-Valued User Defined Functions? . I
I apologise for what I'm pretty sure is a fairly stupid question, but I
This question may be a stupid question, but I'm really curious. After playing games

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.