I'm asking this question with regards to Python, though it's probably applicable to most OOP languages.
When I only expect to use the data model only once in any program, I could either make a class with class/static methods and attributes or just make a regular class and instantiate it once and only use that one copy. In this case, which method is better and why?
With python, I could also write a module and use it like I would a class. In this case, which way is better and why?
Example: I want to have a central data structure to access/save data to files.
Module way:
data.py
attributes = something
...
def save():
...
main.py
import data
data.x = something
...
data.save()
Class way:
class Data:
attributes = something
@classmethod
def save(cls):
Data.x = something
Data.save()
instance way
class Data:
def save(self):
data = Data()
data.x = something
data.save()