CouncilDataProject / cdptools_v2

Tools you can use to interact with and run Council Data Project instances.
Other
7 stars 9 forks source link

Idea: ORM style objects for easier enforcement of data #150

Closed evamaxfield closed 3 years ago

evamaxfield commented 4 years ago

Use Case

Please provide a use case to help us understand your request in context

So I think the idea is decently simple enough. Currently all of our database functions (current and planned) all simply accept dictionaries. If instead we said "we accept a Body object, or a Event object, it would be self validating and also somewhat easier to define a "general" pipeline as "this function must accept a Event and must return a Transcript or similar.

I will note I think this is probably a longer term thing and not immediately needed but taking opinions.

tohuynh commented 4 years ago

I like the idea. Also if we ever change the object, we would only need to change the code in one place.

isaacna commented 4 years ago

I think this is a good idea too, especially now with the new database redesign we have a good starting point to build off of. This will make the code more flexible and easier to refactor. With dedicated objects I think the code gains readability since we'd easily know what's available to an object without needing domain knowledge on a dictionary's keys.

ghost commented 4 years ago

I've been getting to know the codebase. Since data types are changing for this issue, I think a good way to refactor would be TDD

evamaxfield commented 4 years ago

@osethan I don't know what the acronym "TDD" stands form :joy:

ghost commented 4 years ago

Test Driven Development, rewrite tests then make code pass.