pcah/python-clean-architecture

Architecture: should data be internally represented by immutable structures only?

lhaze opened this issue · 2 comments

lhaze commented
Architecture: should data be internally represented by immutable structures only?

Been poking around your issues for inspiration. Thanks for putting this repo together! I've started working in Python much more heavily in the last few years and have been very disappointed with the current "best practices". It was very refreshing to run into this repo and see you folks try to apply Uncle Bob's clean architecture concepts to the Python world. I'm going to try and become more familiar with this repo and the issues and see if I can contribute :)

As far as this topic goes, I've been trying to have as much of my data objects use frozen dataclasses as possible. However, I'm finding it very difficult to make sure everything is immutable. For example, it's really easy to use dictionaries in a few places, but dictionaries are mutable. I end up writing a lot more code just to convert between types the user is used to and types I store internally as immutable values. Would love to know if you folks have experimented with making things strictly immutable and if you have a found a decent way to develop this way without writing a lot of boilerplate code.

Cheers!

lhaze commented

@ms-lolo Thank you for your appreciation and questions. I'm sorry you have to wait for the answer, but you got me during a very busy time.
I'll relate to your questions in a few days.