You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Persisting hosts into a database is a form of serialization. The Host model’s responsibility is to represent the database record. It shouldn’t on the other hand
contain any logic – instantiation, operations, export
The logic of how the fields and values are updated are in no way related to the database storage. Decoupling allows the application to operate with a simple object representing a Host instead of a database model with a lot of added behavior. The database model would be used only for the storage/retrieval. This increases predictability of the application.
The text was updated successfully, but these errors were encountered:
Adding that currently storing data to the database is also a kind of serialization. Splitting the database model (a SQLAlchemy object) from a business logic representation would allow to internally store the data in a smarter way. E.g. to use a namedtuple for canonical facts and a defaultdict for facts.
Persisting hosts into a database is a form of serialization. The Host model’s responsibility is to represent the database record. It shouldn’t on the other hand
This can be done in separate steps:
The logic of how the fields and values are updated are in no way related to the database storage. Decoupling allows the application to operate with a simple object representing a Host instead of a database model with a lot of added behavior. The database model would be used only for the storage/retrieval. This increases predictability of the application.
The text was updated successfully, but these errors were encountered: