News for hackers. Stuff that matters.
Re:I wrote a free book about TDD and clean architecture in P... by MrSaints on Friday December 28, 2018 @04:24AM (#18775756)
Awesome. I've always been curious over examples of clean architecture in Python. I had a cursory glance. As a suggestion, I think the `Room` domain model could be improved with dataclasses (https://docs.python.org/3/library/dataclasses.html).
Re:I wrote a free book about TDD and clean architecture in P... by thedigicat on Friday December 28, 2018 @04:40AM (#18775813)
Ah, you already know what you will find in the next releases of the book =) Thank for the suggestion, actually I was struck by dataclasses as they are exactly what I needed for a project I have, a sort of library for clean architectures. We'll see. Thanks!
Re:I wrote a free book about TDD and clean architecture in P... by BerislavLopac on Friday December 28, 2018 @05:01AM (#18775906)
Or even more by attrs: https://www.attrs.org/en/stable/
Re:I wrote a free book about TDD and clean architecture in P... by jimbo1qaz on Friday December 28, 2018 @10:27AM (#18777236)
Try @attr.dataclass. It uses the cleaner 3.6+ dataclass syntax, but is more flexible (supports kw-only classes).
Re:I wrote a free book about TDD and clean architecture in P... by thedigicat on Monday December 31, 2018 @03:54AM (#18793718)
Thank you both for your suggestions, I will consider using one of these in the next versions of the book. Python is a moving target, so I will have to update the examples.
Re:I wrote a free book about TDD and clean architecture in P... by MrSaints on Wednesday January 09, 2019 @05:14AM (#18863664)
I've recently also come across https://pydantic-docs.helpmanual.io/ which appears to be useful for enforcing simple constraints on domain entities.