python-clean-architecture icon indicating copy to clipboard operation
python-clean-architecture copied to clipboard

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

Open lhaze opened this issue 7 years ago • 2 comments

lhaze avatar Jan 28 '19 23:01 lhaze

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!

ms-lolo avatar Feb 15 '21 05:02 ms-lolo

@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.

lhaze avatar Feb 23 '21 03:02 lhaze