0

I understand the workings of OO Programming but have little practical experience in actually using for more than one or two classes. When it comes to practically using it I struggle with the OO Design part. I've come to the following case which could benefit from OO:

I have a few sets of data from different sources, some from file, others from the internet through an API and others of even a different source. Some of them are quite alike when it comes to the data they contain and some of them are really different. I want to visualize this data, and since almost all of the data is based on a location I plan on doing this on a map (using Folium in python to create a leafletjs based map) with markers of some sort (with a little bit of information in a popup). In some cases I also want to create a pdf with an overview of data and save it to disk.

I came up with the following (start of an) idea for the classes (written in python to show the idea):

class locationData(object):
    # for all the location based data, will implement coordinates and a name
    # for example

class fileData(locationData):
    # for the data that is loaded from disk

class measurementData(fileData):
    # measurements loaded from disk

class modelData(fileData):
    # model results loaded from disk

class VehicleData(locationData):
    # vehicle data loaded from a database

class terrainData(locationData):
    # Some information about for example a mountain

class dataToPdf(object):
    # for writing data to pdf's

class dataFactory(object):
    # for creating the objects

class fileDataReader(object):
    # for loading the data that is on disk

class vehicleDatabaseReader(object):
    # to read the vehicle data from the DB

class terrainDataReader(object):
    # reads terrain data

class Data2HTML(object):
    # puts the data in Folium objects.

Considering the data to output I figured that each data class render its own data (since it knows what information it has) in for example a render() method. The output of the render method (maybe a dict) would than be used in data2pdf or data2html although I'm not exactly sure how to do this yet.

Would this be a good start for OO design? Does anybody have suggestion or improvements?

Yorian
  • 2,002
  • 5
  • 34
  • 60

1 Answers1

0

the other day I described my approach for a similar question. I think you can use it. I think the best approach would be to have an object that can retrieve and return your data and another one that can show them as you wish, maybe a may, maybe a graph and anything else you would like to have.

What do you think?

Thanks

Alberto
  • 446
  • 5
  • 14