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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:26:17+00:00 2026-05-14T22:26:17+00:00

I am having trouble correctly modeling related objects that can use templates. This is

  • 0

I am having trouble correctly modeling related objects that can use templates. This is not homework, but part of a small project in the university.

In this application the user can add several elements, which can either be passive or active. Each concrete element has different attributes, these must be set by the user. See diagram 1:
diagram 1

Since the user will create many elements, we want there to be templates for each type of element, so some of the attributes are filled in automatically. See diagram 2:
diagram 2

In my opinion, this is a bad design. For example, to get all possible templates for a PassiveElementA-object, there has to be a list/set somewhere that only holds PassiveElementATemplate-objects.

There has to be a separate list for each subclass of Element. So if you wanted to add a new PassiveElement-child, you also have to edit the class which holds all these separate lists.

I cannot figure out a good way to solve this problem. Since the concrete classes (i.e. PassiveElementA, …, PassiveElementZ) have so many different attributes, many of the design patterns I know do not work.

Thanks in advance for any hints, and sorry for my bad English.

  • 1 1 Answer
  • 2 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-14T22:26:18+00:00Added an answer on May 14, 2026 at 10:26 pm

    If I understood you correctly and by template you mean object, which would have complicated construction and therefore you have many ready objects, which get copied as you need them, you might consider using Prototype design pattern. Otherwise, maybe some sort of Abstract Factory or maybe even Dependency Injection. It might help if you provide reasons for deciding to have it the way your design looks like now.

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

Sidebar

Related Questions

I'm having trouble trying to get ValueInjector to map my objects correctly. This is
I am having trouble setting up this Dynamic Linq Library so i can use
I'm having trouble getting a sample program to link correctly (in this case against
I'm apparently having some trouble learning how to use classes correctly. I expect the
I am having a constant trouble with pages not rendering correctly between FF and
I'm having trouble using gsub correctly: Given this code: replace me.gsub(/replace me/, this \\0
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I’m having trouble getting a AJAX/JSON function to work correctly. I had this function
I'm having trouble figuring out why my web service is not working correctly when
I have been having trouble getting this plugin to attach correctly to ajax loaded

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.