python - Django: Chicken or Egg question -


i building application send api call , save resulting information after processing information in apirecord(models.model) class.

1) should build separate class in such way class api call, processes information (including checking against business rules) , creates instance of apirecord() class?

or

2) should build separate class appropriate methods processing, , calling api, , in model, override apirecord.save() method call separate class's api methods , save results?

or

3) should build model class appropriate methods calling api , processing response (including checking values , other business rules)?

i tried # 2 , ran problems flexibility (but still open suggestion). i'm leaning towards # 1, i'm not sure of negatives yet?

it design decision. depends design , programming interests. used combination of 3 methods said. if need informations can build other fields create internal function in model class. if need other records of database create function outside of model class. , other unusual needs computed everywhere need them.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -