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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:26:14+00:00 2026-06-11T11:26:14+00:00

I have a database layer at my application. At my front side I have

  • 0

I have a database layer at my application. At my front side I have graphics to show users. I get necessary data from database and show that data at web site. When I get raw data from database I process that data for which API I use (highcharts etc.). I designed something like that:

ChartDTO

The main interface for all chart implementations. Has methods as like:

public Object getTotalUsersPieChart(DatabaseData databaseData);

and

HighChartsDTOImpl

An implementation of ChartDTO. All its methods returns Object type variables.

At client side I directly feed my graphics with the data coming from server side without needing any pre-process at client side.

My question is that:
I know there is a design mistake here and maybe it is not a DTO design (at least my architecture says that)

How I could design that scenario?

  • 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-06-11T11:26:15+00:00Added an answer on June 11, 2026 at 11:26 am

    I suggest you use some sort of Factory pattern.
    You should pass the client a "hint" on the type of chart you want to create,
    And have a ChartFactory create it for you.
    Here is a code snippet:

    public class ChartFactory {
        
        public Chart createChart(ChartType, ChartParameters params) {
           Chart chart = ... //Creates a chart object based on type and ChartParameters
           return chart;
        }
    }
    

    You can have this factory to be a Singleton,
    so if you need to do some factory initializing, you will do that only once.
    ChartParameters should hold parameters for creating an object of specific chart type.
    It can be a simple map of keys and value, i.e look like:

    public class ChartParameters {
        private Map<String,Object> params = new HashMap<String,Object>();
    
        public Object getParam(String paramName) {
            return params.get(paramName);
        }
    
        //Add here more methods... maybe a CTOR that takes a map of params,
        //And a method to add a parameter
    }
    

    Or this can have another implementation.
    You may also decide to have parameter class per each one of the subclasses of Chart (all these parameter classes will extend ChartParameters),
    But this may cause you some sort of duplication at the inheritance tree.

    To conclude,
    In this way all you need to send to the client is the chart type, and the parameters, and it will instantiate that proper chart object.

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

Sidebar

Related Questions

I have a C++ application that loads lots of data from a database, then
I have an ASP.NET MVC application that uses LINQ2SQL as the database layer. I
I have a C# database layer that with static read method that is called
I work with an OO database abstraction layer that I wrote. I have parameters
I'm working on a project in which we have a database, data layer (entity
In your typical MVC application, you have many layers. Database layer Model layer (possibly
I have an application that creates an Jet database at run-time, and imports ~100k
I have a system that we have recently developed - a web application over
I am working on a pyramid web application that uses SQLAlchemy. I have a
I'm trying to design application that will have UI with database in the backend.

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.