Domain-Driven Refactoring - Jimmy Bogard - NDC London 2022

  Рет қаралды 46,983

NDC Conferences

NDC Conferences

Күн бұрын

Пікірлер: 58
@kevinlloyd9507
@kevinlloyd9507 5 ай бұрын
Love this talk. I rewatch it at least once a year!
@Erril_Ferndal
@Erril_Ferndal 2 жыл бұрын
Amazing talk!! Every Developer should see this!
@r0shav
@r0shav 2 жыл бұрын
This was so good that it made me want to go back to work :D
@NotARealPerson12345
@NotARealPerson12345 2 жыл бұрын
I think the Calculator can be moved to application layer. In my mind, a clean domain model interface should not have dependencies outside domain model. The domain model could require a calculated offer value to be passed to it, which can be provided by higher level logic. You could argue that both application layer and domain layer are just DOMAIN layer though. In the end, the whole DDD (not in microservice world, just talking about a single project here) is just about proper OO programming, which should be the way to go in the first place.
@marna_li
@marna_li 2 жыл бұрын
This is such a great talk in all its iterations! A couple of months ago, I was working on a project in which I wanted to put some domain logic with its Domain Object. In my scenario it was about a "Document" being signed. So I come up with creating a SigningService and pass in into the Document.Sign(signingService, signer). At first I felt uncomfortable, but the more I looked at it the more it made sense in OOP. Semantically: the Document is being signed by a Signer using a specified SigningService.
@Weexow
@Weexow 2 жыл бұрын
Wouldn’t that be signer.Sign(document, service)
@marna_li
@marna_li 2 жыл бұрын
@@Weexow Good point! I guess that it depends on how you view it. What is the center of your model. But I would consider your solution if there were a Person/User concept. Because the Person signs the Document using the SigningService.
@NaaneVinu
@NaaneVinu 2 жыл бұрын
​@@marna_li I feel that, in that sense still it could have been like, the service/class that is responsible to create the document, uses the signing Service to sign the document the document.
@vin2629
@vin2629 2 жыл бұрын
This is awesome. The way he explains is so clear. I think we can design our domain classes in our own way as long as its properly encapsulated and follows the single responsibility principle in SOLID.
@wokker2
@wokker2 2 жыл бұрын
Learned some new Rider/Resharper tricks :)
@montassarkefi4064
@montassarkefi4064 Жыл бұрын
Thank you for your explanation, great to hear
@Dimestel
@Dimestel Жыл бұрын
Amazing example how to cook it!
@mahdimollaeian8840
@mahdimollaeian8840 2 жыл бұрын
where can i download project source code?
@iorch82
@iorch82 Жыл бұрын
For the average developer DDD is just a glorified set of basic OOP principles that got lost along the way because of the service layer pattern getting wild in the 00's. The other part, contex mapping, bounded contexts, etc is mostly work for very expensive western consultants that rarely gets into production systems. There is a huge industry and cargo cult around that three letter word and the machine should not be stopped
8 ай бұрын
What do you do to organize microservices and modular monoliths if not in Bounded Contexts?
@ZdobywcaTitanQuestIT
@ZdobywcaTitanQuestIT Ай бұрын
call it however you want, but the idea of separating concerns and modularization of components (whether they are microservices/classes/packages/apps/scripts/...) has been around forever
@krccmsitp2884
@krccmsitp2884 2 жыл бұрын
Simply great and inspiring!
@LDdrums20
@LDdrums20 2 жыл бұрын
That was awesome!
@botyironcastle
@botyironcastle 6 ай бұрын
what if you have huge data like 100000000comments in Post object. I don't think you can init a domain object with that much... looks useless to me when dealing with large chunks of data. Thoughts?
@arthurchia2828
@arthurchia2828 2 ай бұрын
Interesting, good talk. Got another reason not liking global usings 😂
@osten_petersson
@osten_petersson 2 жыл бұрын
zebras are closer related to donkeys actually :)
@aaronmcadam
@aaronmcadam 2 жыл бұрын
I really enjoyed this talk, but how do we stop domain models getting too big if we should try to move behaviour to them?
@aaronmcadam
@aaronmcadam 2 жыл бұрын
How can we avoid God Classes if we want to avoid anaemic domain models?
@ioanadobos2840
@ioanadobos2840 2 жыл бұрын
@@aaronmcadam maybe value objects and constant reiteration over the model I'm guessing... also when a model gets too big it's a sign it does too much and maybe we should think about spliting it. If anyone thinks about something extra I'm really curious too about other solutions
@aaronmcadam
@aaronmcadam 2 жыл бұрын
@@ioanadobos2840 yeah I think delegating to other classes might help keep the complexity down, but it’s still tricky to balance these things 😅
@finch9668
@finch9668 2 жыл бұрын
Amazing!
@ahmedameen2
@ahmedameen2 3 ай бұрын
Who's using vs white theme nowadays?
@ChrisAthanas
@ChrisAthanas Жыл бұрын
This is still all imperative and will always be brittle and hard to maintain I Like Yegor Bugayenko approach to true AK OOP style
@khanfaizan05
@khanfaizan05 6 ай бұрын
I don't know.. keep it simple. He over complicated things
@TristanBailey
@TristanBailey Жыл бұрын
Horrible refactor for the sake of possible, it was only about 20lines and could be understood. Now it’s all abstract and pulled in multiple locations. The ideas he seemed to want to convey could be good. There was no justification apart from a small % to be in own objects as there was no redundancy or over complexity that was improved. And didn’t add any tests to prove at least more testable. Just did 10 more steps than needed and could have had better example.
8 ай бұрын
Would love to see you doing an hour-long live demo covering all these topics on a non-contrived, fully-tested codebase
@maciejmeissner2574
@maciejmeissner2574 2 ай бұрын
It’s just 20 line of code. But what he have done is to move the Domain logic code to the right places. To the domain layer. Why should be the code in an application layer. Should the the application layer should all know the domain things? When should we refactor code? After 21 lines of code, or 244 lines? The amount of lines isn’t really a good indicator.
@tehklevster
@tehklevster 2 жыл бұрын
This is the worst example of code refactoring I've ever seen. Don't think about this unless you have a concern about re-use. Sorry Jimmy.
@ChrisAthanas
@ChrisAthanas Жыл бұрын
Accurate Imperative code masquerading as OOP is inherently unsustainable and un-maintainable mess I prefer Yegor Bugayenko approach
@TristanBailey
@TristanBailey Жыл бұрын
Exactly. And never even ran the code or tests to prove any of this helped and didn’t break the use of the methods!
@nickbarton3191
@nickbarton3191 Жыл бұрын
​​@@ChrisAthanasQuite ! I'm following Zoran Horvat, rich domain models. I'd like to find an example of turning imperative legacy code into a rich domain model, stepwise not to break stuff.
@cd1131
@cd1131 11 ай бұрын
Strongly disagree. This helps big time to correctly represent the business domain and avoid unmaintainable spaghetti code. It produces very comprehensible unit tests making it easy to get the logic right. Always consider this unless you are working on hello world projects or just CRUD API’s.
@bayobizzle
@bayobizzle 8 ай бұрын
​@@ChrisAthanasany link to the Bugayenko approach you mentioned?
@deyanvp
@deyanvp 2 жыл бұрын
I would have gotten excited about this talk ... 20 years ago ... My recommendation to current/new generation developers: - switch to microservices, focus more on the API/contract than internals (and of course avoid sync calls between microservices, try to do as much as possible event-driven etc etc). Consider seriously how to create behavior/capability-focused microservices vs. entity/technical ones (to avoid sync calls as much as possible - no, 100% is not possible) - switch to immutable data (go functional) separate from logic (forget anemic domain model). And yes, most if not all of the time when you feel it does not feel natural that an entity does something to itself (e.g expires, signs itself), it is really not natural ;) - keep domain logic well structured and making sure that every function is returning a valid (invariants enforced!) aggregate root - domain model has no dependency on anything, also not on service interfaces. Forget about double (saw in the code even triple-dispatch with XxxType.CalcuteXxx) - this does not make your code simpler To add (based on some of the questions below): - use NoSQL db with 1:1 aggregate root : document mapping (no ORM!, no need for db transactions) for the Write model - use columnstore index database for the Read model (much faster for complicated queries, you can still use the Write model for simple "get by id" queries) - to be able to scale differently and have different SLAs: technically seggregate your microservices inside a bounded context as per technical aspects/similar to CQRS, e.g. IdentityVerification-QueryHandling IdentityVerification-CommandHandling IdentityVerification-EventHandling (sub interservice events) IdentityVerification-EventPublishing (pub interservice events) IdentityVerification-ChangeHandling (includes Auditing) and even IdentityVerification-ExternalEventPublishing (for webhooks)
@arunnair7584
@arunnair7584 2 жыл бұрын
I found microservices drastically reduces the app's performance (when used with kafka). Also unless you have multiple teams working in multiple languages, do you see any significant benefits?
@namewastaken360
@namewastaken360 2 жыл бұрын
A very good talk that ties together a lot of these ideas is Scott Havens talk at DOES19. Here's a recording kzbin.info/www/bejne/fKTOepVviMaln6s
@RealMathewAdams
@RealMathewAdams 2 жыл бұрын
@@arunnair7584 No, the team structure is one that is the deciding factor of when to use microservices. It solves a problem of developer velocity (delivery) among very large and coordinated teams. People prescribe microservices and gloss over the many, many, problems they introduce.
@deyanvp
@deyanvp 2 жыл бұрын
​@@RealMathewAdams I beg to differ. In my context every individual developer can develop a microservice by himself (and every deveper owns more than 1 microservice for sure). And even if I was developing the whole solution by myself, I would still go for microservices, as the possibility of deploying small pieces of the whole is an extremely precious capability when it comes to CD and deploying small changes all the time. Note that my recommendation is not only to split your solution into services, but also to split every service into microservices as per CQRS, which I have briefly touched upon at the end of this article: dev.to/deyanp/tbd-current-state-last-event-as-an-alternative-to-event-sourcing-5gm5. But of course, for microservice architecture one has to learn new tricks (already mentioned sync calls vs. event-driven), which are not necessarily what was taught in the past 20 years ...
@arunnair7584
@arunnair7584 2 жыл бұрын
@@deyanvp Do you implement transactions across microservices?
@mahdimollaeian8840
@mahdimollaeian8840 2 жыл бұрын
That was awesome!
Modularizing the Monolith - Jimmy Bogard - NDC Oslo 2024
56:44
NDC Conferences
Рет қаралды 18 М.
Domain-Driven Design: The Last Explanation You'll Ever Need
21:05
Software Developer Diaries
Рет қаралды 10 М.
Domain-Driven Refactoring - Jimmy Bogard - NDC Porto 2022
1:01:29
NDC Conferences
Рет қаралды 20 М.
Back to Basics: Efficient Async and Await - Filip Ekberg - NDC London 2022
1:01:59
How To Use Domain-Driven Design In Clean Architecture
30:27
Milan Jovanović
Рет қаралды 112 М.
5 Rules For DTOs
17:56
Ardalis
Рет қаралды 45 М.
Domain Driven Design: The Good Parts - Jimmy Bogard
58:39
NDC Conferences
Рет қаралды 221 М.
This Is How the Anemic Domain Model Turns Bad
13:08
Zoran Horvat
Рет қаралды 9 М.
DDD By Example - Paul Rayner - DDD Europe 2020
54:58
Domain-Driven Design Europe
Рет қаралды 52 М.
Domain-Driven Architecture at Scale - Xin Yao - DDD Europe 2022
59:43
Domain-Driven Design Europe
Рет қаралды 9 М.