A
A
Anton2018-09-29 00:46:23
Python
Anton, 2018-09-29 00:46:23

How to create a class hierarchy?

Hello. I have some heterogeneous data sets with indicators, they can be presented in several forms: a list, a chart, a graph. Also, this data can be displayed in three formats: html, pdf and plain text in which graph and chart views are not available. Please tell me how not to produce a bunch of classes, with the ability to easily add new types and formats?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Mirilaczvili, 2018-09-29
@2ord

In total, it will be necessary to write M × N transformations, where M is the number of views, and N is the number of formats.
Input: view, data itself, additional parameters depending on the format
Output: format
Operations: Build You
can build only if you know from what and in what format, that is, it will not work at all in the abstract.

K
Konstantin, 2018-10-05
@Junart1

Use the Abstract Factory design pattern

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question