Readit News logoReadit News
chausen commented on Keep Pydantic out of your Domain Layer   coderik.nl/posts/keep-pyd... · Posted by u/erikvdven
golly_ned · a month ago
I still don’t quite get the motivation for “don’t use pydantic except at border” — it sounds like it’s “you don’t need it”, which might be true. But then adds dacite to translate between pydantic at the border and python objects internally. What exactly is wrong with pydantic internally too?
chausen · a month ago
Could be wrong, never used Pydantic. But looking it up it seems like it's used for validation/typing of external data. Sounds like it's mainly going to be doing schema validations. So, your data arrives at your domain layer and you have guarantees based on Pydantic's validations. At this point, your validations are going to semantic in nature based on your domain; what value is Pydantic bringing?
chausen commented on Keep Pydantic out of your Domain Layer   coderik.nl/posts/keep-pyd... · Posted by u/erikvdven
NeutralForest · a month ago
I'm not sure I agree, you can still use Pydantic in the domain model and update the version of the API when you change the expected schemas of your CRUD application.

Where I'm with you, is that you should take care of your boundaries and muddling the line between your Pydantic domain models and your CRUD models will be painful at some point. If your domain model is changing fast compared to the API you're exposing, that could be an issue.

But that's not a "Pydantic in the domain layer" issue, that's a separation of concerns issue.

chausen · a month ago
Often you want your domain models to be structured differently than API models, to make them as convenient/understandable to work with as possible for your use case. If you already have different models, why would you want Pydantic in the domain? Even if they start out the same, this would allow them to more easily evolve to be different. I'm not a python expert, so I could be missing the point on Pydantic, but it seems like its value is at the edges of your application.
chausen commented on Keep Pydantic out of your Domain Layer   coderik.nl/posts/keep-pyd... · Posted by u/erikvdven
IshKebab · a month ago
This seems ridiculously over-complicated. This guy would love Java.

He doesn't even say why you should tediously duplicate everything instead of just using the Pydantic objects - just "You know you don’t want that"! No I don't.

The only reason I've heard is performance... but... you're using Python. You don't give a shit about performance.

chausen · a month ago
The article is written for those who want to apply DDD/onion architecture to Python apps using Pydantic. Those concepts explain the motivation and the article assumes the reading knows about them. As others are writing, it may not be worth it to apply this to simple apps, but as an app grows in complexity it will help make it more extensible, maintainable, etc.

I'm not a Python expert, but looking into it briefly it seems like Pydantic's role is at application boundaries for bringing validation/typing to external data sources. If you are not working with external data, there is no reason to use it. So, if you separate out a domain layer, it brings no benefit there. Creating a domain layer where you handle business logic separately from how you interact with external data means those layers can evolve independently. An API could change and you only need to update your API models/mapping.

chausen commented on Getting things “done” in large tech companies   seangoedecke.com/getting-... · Posted by u/swah
yawgmoth · 4 months ago
> you can plausibly make up the rest about what you actually did there.

I would never do this, and if you would do this I wouldn't want to work with you. Maybe I'm a sucker, but I sleep alright.

chausen · 4 months ago
What about actually accomplishing some things over 10 years while maintaining good work life balance?
chausen commented on Software development topics I've changed my mind on   chriskiehl.com/article/th... · Posted by u/belter
hliyan · 7 months ago
There's another way to look at this: if you consider the school of thought that says that the code is the design, and compilation is the construction process, then stressing over code style is equivalent to stressing over the formatting and conventions of the blueprint (to use a civil engineering metaphor), instead of stressing over load bearing, material costs and utility of the space.

I'm fond of saying that anything that doesn't survive the compilation process is not design but code organization. Design would be: which data structures to use (list, map, array etc.), which data to keep in memory, which data to load/save and when, which algorithms to use, how to handle concurrency etc. Keeping the code organized is useful and is a part of basic hygiene, but it's far from the defining characteristic of the craft.

chausen · 7 months ago
I overall agree. The one thing I will say is that what you call code organization (anything pre-compilation) also includes structuring the code to improve maintainability, extensibility, and testability. I would therefore disagree that code organization is only basic hygiene, not part of design, and not a large part of the “craft” (use of that word is something I’ve changed my opinion on—while it feels good to think of it that way, it leads to exactly the thing we’re discussing; putting too much emphasis on unimportant things).

Code style though, I do agree isn’t worth stressing about. I do think you may as well decide on a linter/style, just so it’s decided and you can give it minimal energy moving forward.

chausen commented on David Chang on the long, hard, stupid way   herbertlui.net/david-chan... · Posted by u/herbertl
esperent · a year ago
Is this actually substantiated by people who've worked with him? Or is it put out by his PR team? Because I've also heard this several times, but only through comments like this on the internet.
chausen · a year ago
He has been on shows where he’s an ass and shows where he is not. Watching both, it seems like the former is purposely done for the drama and latter is closer to what he’s actually like. Who knows what he’s like with no cameras in an actual kitchen, and maybe it’s just because he’s older now, but it seems to me that the majority of content he’s in he seems really nice.
chausen commented on Show HN: Create diagrams of complex data flows in software systems   github.com/jodigiordano/g... · Posted by u/j0d1
beardedwizard · a year ago
Who is using this? I have only seen plantuml written about on blogs, never actually in use.
chausen · a year ago
I’ve used it for a long time; even if I don’t end up sharing with others it can help me quickly visualize things (the ease of change often makes better than pen and paper). At one of my jobs we had an architect join and he was amazing; I really respected him. He used PlantUML and would open it up and start writing sequence diagrams with us. He would make sure complex flows that were actively being implemented were kept up to date and they were useful references.

u/chausen

KarmaCake day11July 31, 2024View Original