Live data from Hacker News

Hexagonal Architecture and Domain Driven Design

towardsdev.com

71–74 of 74 posts

Re: Hexagonal Architecture and Domain Driven Design

#71
post #66

Earlier quoted context omitted.

I haven't used Rails before, so I may be missing something, but is this necessarily the case? If I remember correctly the blue book isn't too keen on modelling your domain in your database, but rather build it out of POJOs and then build a separate layer. But at the same time it's open to using DDD with a logic paradigm, which is eerily similar to a relational database. If, after you've done the necessary work with t…

I'm quite certain that with some effort, and possibly some stretching of definitions, one can "do DDD with Rails". But at that point you are going against the grain. You are both missing out on some good parts of Rails and spending a lot of time to work around or against what Rails wants and needs: Rails is very opinionated, don't forget that. From https://en.wikipedia.org/wiki/Active_record_pattern#Criticis... > Ano…

I can’t speak from experience, but the article you linked seems to make sense.

Rails appears to have very little to do with object oriented programming, except as an implementation detail. My point is that although Evans strongly recommends OOP for DDD in the blue book, it’s not a requirement.

If the first design phase of DDD, where you sit down with the domain experts, you might discover that what you are building is really just a CRUD app. Then it’s probably wise to actually use a CRUD framework, Rails or otherwise. You’re still using DDD, and you’re not even going against the grain or missing out on framework features.

When you make your database your model you delegate “decoupling from persistence” to the authors of your RDBMS. They have already decoupled it for you in that you’re not opening files and writing data, your INSERT statement is just stating facts about your domain.

I’ve explored the pattern of putting the entire domain model in the database in the form of constraints, triggers and queries that return JSON. The controllers just map URLs to queries, validate the input and just pass the result of the query to the client without looking at it.

It’s extremely powerful and productive. You never have to think about N+1. It’s more like logic programming than anything else. The downside is that SQL and associated tools aren’t terribly ergonomic, and it’s hard to find developers who are comfortable working like that.

Re: Hexagonal Architecture and Domain Driven Design

#72
post #66

Earlier quoted context omitted.

I'm quite certain that with some effort, and possibly some stretching of definitions, one can "do DDD with Rails". But at that point you are going against the grain. You are both missing out on some good parts of Rails and spending a lot of time to work around or against what Rails wants and needs: Rails is very opinionated, don't forget that. From https://en.wikipedia.org/wiki/Active_record_pattern#Criticis... > Ano…

I can’t speak from experience, but the article you linked seems to make sense. Rails appears to have very little to do with object oriented programming, except as an implementation detail. My point is that although Evans strongly recommends OOP for DDD in the blue book, it’s not a requirement. If the first design phase of DDD, where you sit down with the domain experts, you might discover that what you are building i…

I think part of the point is that if you are a Rails shop first, then trying to strap DDD on is only rarely going to work. If you are a "right tools for the job" shop who decide to do DDD as a primary tool, then there might be cases where it is what you choose.

Re: Hexagonal Architecture and Domain Driven Design

#73

Earlier quoted context omitted.

I can’t speak from experience, but the article you linked seems to make sense. Rails appears to have very little to do with object oriented programming, except as an implementation detail. My point is that although Evans strongly recommends OOP for DDD in the blue book, it’s not a requirement. If the first design phase of DDD, where you sit down with the domain experts, you might discover that what you are building i…

I think part of the point is that if you are a Rails shop first , then trying to strap DDD on is only rarely going to work. If you are a "right tools for the job" shop who decide to do DDD as a primary tool, then there might be cases where it is what you choose.

Even if you are a Rails shop first, you can use DDD to determine if it's wise to take on the project in the first place. If it turns out that the domain cannot be expressed as a CRUD app, maybe refer the client to someone else. Then you will officially have used Rails with DDD, even if you haven't written a single line of Rails code for the project.

Much of DDD is really tech independent, and takes place before a single line of code is written. This is probably also where it's the most important. You're going to have to learn the domain first or the project will be a world of pain regardless of what architecture you choose.

Re: Hexagonal Architecture and Domain Driven Design

#74
post #65

Earlier quoted context omitted.

Yes but unfortunately I don't see how it invalidates my point. a) you either replace DIC with custom hard-wired functions (composed using any-order custom helpers) and then it's still hard-wired at one place b) you reinvent DI with functions but it's still some magic, late-configurable, easy-to-plugin container (aka the circus which I think you were referring to and which I have said it's actually useful and worth) E…

Yes, you do need a certain level of indirection to achieve the things you mentioned without polluting your code with non-business concerns such as transactionality. But the key differences are: 1. Application startup is faster because you avoid reflection. 2. It's type-safe because you avoid reflection, so you get compile-time errors instead of startup errors (or worse, startup errors only in certain configurations).…

Oh, sorry for my misunderstanding then, I thought you were OP.

1. that's... not a problem for me 2. fair but you have tests & pipelines, so not a problem... for me :) 3. this is kind of fair, yeah

4. I absolutely agree about unnecessary layers, java engineers are the worst when they learn about something new and don't have enough practice yet

Post reply on HN