Onion Architecture vs Clean Architecture Comparison

Поділитися
Вставка
  • Опубліковано 15 лис 2024

КОМЕНТАРІ • 186

  • @MilanJovanovicTech
    @MilanJovanovicTech  Рік тому +4

    Get the source code for this video for FREE → the-dotnet-weekly.ck.page/clean-onion
    Want to master Clean Architecture? Go here: bit.ly/3PupkOJ
    Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt

    • @GreatTaiwan
      @GreatTaiwan 5 місяців тому

      why not just in github ?

  • @iojourny
    @iojourny Рік тому +62

    My architecture is like an Onion - it has many layers, and each time you peel one to expose a deeper layer it makes you want to cry.

  • @maacpiash
    @maacpiash Рік тому +13

    Ah, we really needed a video on this topic, a comparison between these seemingly similar architectures. Thanks!

  • @mshahabfar
    @mshahabfar Рік тому +5

    I used to implement my feature handlers in the Application layer even though they use ORM (DbContext). But now I see you bring them into Infrasructure (Persistence) layer. Is this by the rule or it is just your approach?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Just an idea I got from Jeffrey Palermo's original Onion Architecture repository.

    • @sotsch9280
      @sotsch9280 Рік тому +2

      It have to be in application layer because you often want more than just use a database. If the use Case need more information or requires more than one infrastructure, you are forced to gather this in application.

  • @yeevirgen
    @yeevirgen Рік тому +4

    Great video, also thanks for not focusing on theory only and including the example projects from the scratch. Some things are best learned with an example

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      I think this aligns nicely with my way of teaching. Some theory, but more focus on practice and practical implementations

  • @Benke01
    @Benke01 Рік тому +3

    Good video. 👍A couple of thoughts:
    * Service interfaces is useful for unit tests when services depends on other services.
    * Recommend also setting the respository impl classes (and others) as internal so they can't be accessed by other layers. Only keep a public class with extension methods to IServiceCollection to add them into the DI flow.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Great suggestions 👌

    • @riseofaskari
      @riseofaskari 9 місяців тому

      One question here, in case of using onion architecture, service interfaces would be placed in application layer or domain layer?@@MilanJovanovicTech

    • @d_6963
      @d_6963 4 місяці тому

      ​@@riseofaskariAll the interfaces that are used in the infrastructure layer are stored in the domain layer.

  • @d3tn3tracer
    @d3tn3tracer Рік тому +2

    Thank you Mr. Jovanovic. You are first one (not FirstOrDefaul :D ) who explained it so cleaner. And with demo. Good job!

  • @d_6963
    @d_6963 2 місяці тому

    I see a lot of comments about the Query handlers been in the infrastructure layer. Your reason being: "For a query usually don't care how it's implemented, I only care about the result I get back." This makes sense to me. Will definitely switch to doing this because keeping all the query concerns in the infrastructure is to me a much better separation of concerns. Thank you for sharing

    • @MilanJovanovicTech
      @MilanJovanovicTech  2 місяці тому +1

      Another thing I do is leave them in Application layer, and simply use EF/SQL/Whateveriwant. Not pure CA, but same result with less indirection.

    • @d_6963
      @d_6963 2 місяці тому

      This is how I am currently doing it. It works, but having infra stuff like the ORM in the app layer really bothers me. That is why it made sense when you mentioned having the Query Handler in the infra layer.
      However, after thinking about this for a bit, I realised this is a separation concern for me.
      I will add an extra layer, the Query Layer, dependent on the infra and domain layers; this is where the query handler will be. The presentation layer will then depend on the query layer and app layer. Queries go to the Query layer, and Commands go to the Application layer. This approach aligns with the CQRS pattern and would align with my architectural concerns. I have even considered renaming the app layer to the command layer.
      I have been trying to shoehorn the CQRS pattern into clean architecture, so the results have bothered me. But this would clear that up for me.
      I'm rambling here a bit; it's easier for me to formulate an idea when I have to define it, and it's also good to have feedback on it when you put it out there.

  • @edwinroman30
    @edwinroman30 Рік тому +3

    Nice video! I used to see it as if onion architecture were part of clean architecture! At the end, they shared some of their philosophy. Thanks, Milan!

  • @sunzhang-d9v
    @sunzhang-d9v 10 місяців тому +1

    The front-end command needs to create an order and create a payment at the same time, and this operation should be logically processed at the order application layer? Or is it processing logic at the endpoint?

    • @MilanJovanovicTech
      @MilanJovanovicTech  9 місяців тому

      You can process them both on the backend, as one transaction.

  • @TrungTran-le2ht
    @TrungTran-le2ht Рік тому +1

    I have a small question. Why didn't u put the QueryHandler in the Application layer and then inject a repository (which is located in the Domain layer) into that QueryHandler? That way, you can get rid of references to DbContext (external concern).

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Repositories should return domain entities. If I use that in a query handler - it's not optimal performance. If I start returning DTOs from the repository, it starts getting too many concerns.

    • @ynotj5386
      @ynotj5386 9 місяців тому

      I was asking myself the same exact question. Imo, the not using the repository in the query handler for performance reasons argument doesn't hold water. As a matter of fact, the approach presented in this video leaks application layer specific logic, i.e. the business logic, in the external layer. The Article Service is practically mapping user input to domain entities & passing them to the Article Repository. The Query Handler should be no different; it should map domain entities returned by the repository to dtos which are then consumed by the external layers.

  • @sushilb7994
    @sushilb7994 Рік тому +2

    Thanks Milan! Great video! It would be interesting to see Hexagonal architecture comparison as well :)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Great suggestion!

    • @sotsch9280
      @sotsch9280 Рік тому

      Its the same as the clean architecture. Just another visualization in my opinion.

  • @expertreviews1112
    @expertreviews1112 Рік тому +1

    These are not necessarily like for like comparisons... For eg, Onion Architecture doesn't appear to use MediatR while Clean Architecture does... In which case Clean Architecture has Application project with a library dependency on MediatR which does not make it technology agnostic... This imo should be in Infrastructure... Pls suggest

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Not necessarily, architecturally they are pretty identical. Disregard the implementation details.

  • @fbrunof
    @fbrunof Рік тому +1

    I dont know why that i'm not find you before. You have videos for all of my doubts. Thankssss!!

  • @adrianspikes6454
    @adrianspikes6454 Рік тому +1

    I prefer 📂 s named UseCaseViaService and UseCases then individual folders for each use. More for future organizational planning.

  • @saddamhossaindotnet
    @saddamhossaindotnet Рік тому +2

    Great video, my friend. Now I have a clear concept of those two architectures. Thanks a lot!

  • @DotNetFun
    @DotNetFun Рік тому +2

    Application layer acts somewhat as the request orchestrator ( calling different services using interfaces and also calling domain services/ invariants in the process). Persistence purely deals with database stuff .so shouldn't handlers related to query also be in application layer and use the repository interface ( for getting an article in this example)? This way also provides higher cohesion IMO

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      What would be the value of that indirection via the repository?

    • @DotNetFun
      @DotNetFun Рік тому +1

      @@MilanJovanovicTechPreventing references to any external concerns in application layer ( just like the thing you did in creating an article command handler)

  • @donaldmafa
    @donaldmafa Рік тому +1

    Thanks Milan for this explanation. When building an enterprise application with lots of entities, would it be practical to use the Clean Architecture, it appears to me that you would need a lot of query handlers and commands, which is a lot of code compared to using services? Then secondly, is there a need to use a Repository pattern if using EF Core, is this not just an extra layer?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      You're free to use EF directly. It's more or less the same amount of code (+-10%) but it's in different places.

  • @PelFox
    @PelFox Рік тому +3

    11:44 I don't agree with putting the handler down in infrastructure. In that case I would rather do something like an ArticleQueryService/ArticleReadRepository that holds the queries.
    But regardless I find both of these architectures very bloated and see little use case of actually using them unless you are building a big monolith, which in todays world with all cloud providers you rarely do.

  • @ignacioinnovo5308
    @ignacioinnovo5308 9 місяців тому +1

    Let me congratulate you because of the videos you do. You are very clear with your explanations!

  • @JoeWarren-z4i
    @JoeWarren-z4i Рік тому +1

    Hey Milan, I've just discovered your videos and really enjoying them. I was just wondering if your Visual Studio theme is something available/easy for us to use? The syntax colors appear easier on the eyes than the default theme. Thanks!

  • @lindermannla
    @lindermannla Рік тому +2

    Milan one question, in your Clean Architecture example, in the Core/Application "layer", isn't it a conceptual flaw to create a dependency on MediatR?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Why? It's just an in-memory messaging library

    • @lindermannla
      @lindermannla Рік тому

      Yes, I understand it is a messaging library. But, if I wanted to use these use cases in another application, isolating it in a project, wouldn't it be better not to create this dependency, since in the other application I might not use MediatR?

    • @pilotboba
      @pilotboba Рік тому +1

      @@lindermannla If you are really concerned, you could only reference Mediatr.Contracts in the application layer and then the full mediatr in the presentation (application root) layer.

    • @davidaltran8526
      @davidaltran8526 Рік тому +1

      Great video! I have the same question. Why is Automapper considered external concern but not MediatR? Using MediatR for convience is a acceptable answer :)

    • @pilotboba
      @pilotboba Рік тому

      @@davidaltran8526 Isn't mapping usually done in the Web project/layer? Map requests to commands and entities to responses ???
      I guess I could see the entity to response mapping being done in the application layer. But not where I do it.

  • @hermesfranklin
    @hermesfranklin 7 місяців тому +1

    I can't see differences, just synonyms, because all the examples I see of both have things implemented in one and not in the other, but that don't belong to the model, this takes the focus away from the comparison, it would be interesting to leave preferences aside and focus on implement the same functionalities in both, without a mediator, without a mapper, and all these things that can be implemented in both, but are not necessary to compare, especially if there is only an example of the code in Onion or Clean

  • @expertreviews1112
    @expertreviews1112 Рік тому +1

    What about placing Automapper in Application layer? Doesn't that bind it with business logic? If at a later stage, another mapper or custom mapper is needed, it would require many changes to decouple old mapper and then implement new... Do you think it's better to have mapper in Infra ?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      The chances of changing a mapper are slim to none

    • @expertreviews1112
      @expertreviews1112 Рік тому

      @@MilanJovanovicTech agree... They are slim but can't be ruled out... I had to recently replace Automapper with a more optimized mapper as my application was very large and Automapper was taking toll on memory... That's when I realized I needed Clean Architecture as Automapper was tightly engrained with every single project... Having it in Infra helps me as I can swap out very easily

  • @91-Orca
    @91-Orca Місяць тому

    hi Milan, thanks for these details. are the hexagonal architecture and onion architecture the same ? what about ports and adapters architecture ? thanks

    • @MilanJovanovicTech
      @MilanJovanovicTech  Місяць тому +1

      I would say hexagonal is a bit "different" from an implementation perspective, more moving parts. But the result is pretty much the same, in terms of direction of dependencies.

    • @91-Orca
      @91-Orca Місяць тому

      @@MilanJovanovicTech thanks. Hexagonal is the same as ports and adapters i think

  • @sunzhang-d9v
    @sunzhang-d9v Рік тому +1

    The previous video was clean architecture? Adapters were replaced with Infrastructure

  • @NikhilThakralYeah
    @NikhilThakralYeah Рік тому +5

    IMO both these architectures become a mess within a couple of days into development. We ditched them and switched to vertical slice architecture. It has been over an year now and we now maintain huge projects with ease. It would be great if you could compare it as well. Kudos to your work.

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +4

      Within a couple of days? I've maintained CA/Onion systems for years, and they didn't become a mess. Maybe it's not the architecture, but the engineers...

    • @acuencadev
      @acuencadev Рік тому

      @@MilanJovanovicTech "Maybe it's not the architecture, but the engineers...". Damn...

  • @pilotboba
    @pilotboba Рік тому +2

    interesting. This is the first time I've seen anyone put the query handlers in the infrastructure (persistence) project. I've mostly seen the query handlers in the Application project which is also where the command handlers are.
    Do you see an advantage to putting them there?

    • @okito
      @okito Рік тому

      the only real reason is that your application layer doesnt need a dependency on the ORM when handlers are in persistance/infrastructure

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Avoiding a reference to any persistence mechanism in the Application layer. And continuing down that train of thought, it makes sense. For a query I usually don't care how it's implemented, I only care about the result I get back. So I can move the details of that to Infrastructure. For command handlers, I definitely care about the implementation because it has business logic, so I want it in the Application layer. This is an idea I got from Jeffrey Palermo's Onion Architecture repo, and I just adapted it to MediatR.

    • @pilotboba
      @pilotboba Рік тому +3

      ​@@MilanJovanovicTech So your repositories implementation only have the queries needed for the command handlers? And your query handlers use EF dbcontext directly I assume?
      Frankly, though, I consider Queries a use case so prefer them in the UseCase (application) project.
      So many ways to skin the cat I guess.

    • @kostasgkoutis8534
      @kostasgkoutis8534 Рік тому +1

      This goes very well hand in hand with the asymmetric approach DDD/CQRS follows. The write side of the application tends to be more strict and specific than the read side that can just fetch the data however it wants. Which would make the Domain project (Entites + Repositories) less significant for the read side.

    • @pilotboba
      @pilotboba Рік тому

      @@kostasgkoutis8534Yes, I like the suggestion that there is a projection that matches each "view" in the UI so the query is nothing more than select * from CustomerSummaryView (or whatever)
      But, I've never got to this point.

  • @trouserMuncher
    @trouserMuncher 11 місяців тому

    Свака част, феноменалан видео. Посебна похвала за пример, остали само теорију понављају... 60 секунди твог примера и све сам скапирао. Жив био.

  • @murat.yuceer
    @murat.yuceer Рік тому +1

    If you separate application service methods by class then it changes from onion to clean right? :)

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      It's the same thing, either way you look at it. Using services doesn't change the architecture

    • @murat.yuceer
      @murat.yuceer Рік тому

      Do you have example project without clean arch. I need startup template with onion like your paid project@@MilanJovanovicTech

  • @nosaanthony7310
    @nosaanthony7310 6 місяців тому

    Thank you for this wonderful video. I have been using both architecture without having a clear understanding of the disticntion between the two architecture, and this video has cleared all grey areas. I noticed the Persistent project references the Domain project, is this allowed in clean architecture? My understanding is that only the application layer should reference the domain layer, but in your exmaple I see the "Article" object spanning across all layers up to the persistent/infrastructure layer.

  • @dotnetMasterCSharp
    @dotnetMasterCSharp 3 місяці тому +1

    Most useful videos, thank you Milan

  • @adshtecnologia4335
    @adshtecnologia4335 Рік тому +2

    Uncle Bob didn't tell us "how to implement Clean Architecture". so for me "Architecture" is just Onion. The concept of Clean Architecture could simply be called "Clean Code Design"

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      That's an odd take

    • @adshtecnologia4335
      @adshtecnologia4335 Рік тому

      @@MilanJovanovicTech It is simple, Clean Architecture does not strictly specify how to organize the outer layers. Onion Architecture, on the other hand, is more prescriptive about organizing the external layers, requiring them to contain specific infrastructure details, such as database access and UI.

  • @matthayden1979
    @matthayden1979 11 місяців тому +1

    Can't we put entities and repositories outside of domain and create a 2 separate layers among them?

    • @MilanJovanovicTech
      @MilanJovanovicTech  11 місяців тому +1

      Yes

    • @matthayden1979
      @matthayden1979 11 місяців тому

      @@MilanJovanovicTech Thanks! That won't impact the overall onion architectural style?

    • @matthayden1979
      @matthayden1979 11 місяців тому

      @@MilanJovanovicTech Thanks! That won't impact the overall onion architectural style?

  • @markokafor7432
    @markokafor7432 Рік тому +1

    Nice video and explanation but there isn’t much difference based on this tutorial. Just naming and package, for the onion architecture you used services and EFcore while for the clean architecture you used command and mediatr.

  • @zakraw
    @zakraw Рік тому +1

    Looks like I was implementing Onion Architecture instead Clean Architecture and I didn't know that. 😄

  • @cancurva
    @cancurva Рік тому +1

    Do you know any Java spring channel as good as this one ?

  • @masoudmotlagh6384
    @masoudmotlagh6384 Рік тому +1

    thanks for the video, how to access your sample codes? github?

  • @ismailfedaoui6841
    @ismailfedaoui6841 Місяць тому

    Thank you for the explanation, but I still don't see the difference. You've used MediatR in the Onion architecture, but not in the Clean architecture. Does using MediatR in the Onion architecture mean we've migrated to the Clean architecture?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Місяць тому

      That's because... the difference is pretty much non-existent

  • @obedasante2168
    @obedasante2168 11 місяців тому

    Apart from grouping features with folders what different thing does the clean architecture actually brings? It keep confusing me. Everyone implements it differently. I love onion. Simple and straight forward 😊😊

  • @Zainjerr
    @Zainjerr Рік тому

    Bro do you have any plans on making a videos series on an entire application from start to finish? frontend backend, db, containers, the whole 9 yards.

  • @PrashantShekher
    @PrashantShekher 10 місяців тому

    Please explain too that Clean Architecture focuses on layering, while Onion Architecture focuses on inverted layering.?

  • @microtech2448
    @microtech2448 Рік тому +1

    Did you need AsNoTracking() while projecting response using select new in clear architecture example?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +1

      Nope

    • @khoalong8781
      @khoalong8781 9 місяців тому

      Still using AsNoTracking while select immutable object. it's an indepence with clean architecute.

  • @RunawayYe
    @RunawayYe Рік тому +1

    A great comparison and explanation, thank you!

  • @ramiroalegre8183
    @ramiroalegre8183 6 місяців тому

    Hey Milan, i have a question about Onion Architecture, you created a Article entity in Domain project, and you used this entity in Persistence project with ArticleRepository, this is not a problem because you are using a Code First DB but what if i use database first? My Article will be created with properties based on my database columns (SQLServer, MySQL, etc). This is a problem, because my Domain will be depends of Persistence

    • @MilanJovanovicTech
      @MilanJovanovicTech  6 місяців тому +1

      You can either:
      - Use the scaffolded model, if possible, from the Domain (probably not possible)
      - Map from domain to "persistence" model
      - Add a DbContext that uses domain model, and can persist to DB?

  • @Moaaz-SWE
    @Moaaz-SWE 4 місяці тому

    Does anyone knows why the clean architecture doesn't represent the repository (repo interfaces) in its diagram
    + I didn't understand the point of making a requestQuery class in the usecases then injecting the dbContext and implementing it in the infrastructure
    rather than just declaring GetArtictleByIdQuery method in the repo interface then implementing it in the infrastructure and using just like the other requests and request handlers in the usescases

    • @MilanJovanovicTech
      @MilanJovanovicTech  4 місяці тому +1

      It's all about direction of dependencies. Both architectures can be interpreted and implemented in different ways.

  • @kodindoyannick5328
    @kodindoyannick5328 8 місяців тому

    I like so much your approach by pratice. Thank you Milan.

  • @wh33lers
    @wh33lers 7 місяців тому

    I personally would argue that mediator is part of a framework. That is why I am not using it, because every usecase class will depend on that library in the end. And use cases should describe pure business logic. I get why it is very convenient, but are you not a bit hesitant regarding the hard dependency?

  • @verbroez712
    @verbroez712 3 місяці тому

    5:59 - IArticleRepository interface references your Api. Have a look at the top using statement. It's against either onion and clean architecture rules.

    • @verbroez712
      @verbroez712 3 місяці тому

      The same thing with the service in the Application library project.

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому +1

      No, that's just the namespace of the Article (which should be Domain.Entities though) 5:39
      But the project references are correct.
      You can grab the source code and check (pinned comment).

    • @verbroez712
      @verbroez712 3 місяці тому

      @@MilanJovanovicTech ok, that's make sense. Thanks for the video, bro.

  • @theundaddy8037
    @theundaddy8037 10 місяців тому

    I think it is confusing to have a use-case (GetArticleById) in the application layer, where you only define the query and the response, and the developer is expected to know to implement the handler in the persistence layer.
    Wouldn't it be better to define a IArticleReadRepository interface, implement it in the persistence layer, and then implement the GetArticleByIdQueryHandler in the application layer, injecting the IArticleReadRepository into it?

    • @MilanJovanovicTech
      @MilanJovanovicTech  10 місяців тому

      Having an IArticleReadRepository defeats the purpose of GetArticleByIdQueryHandler. The GetArticleByIdQueryHandler becomes a wrapper calling an interface method. What's the value in that?

    • @MilanJovanovicTech
      @MilanJovanovicTech  10 місяців тому

      I made a video doing something similar: ua-cam.com/video/RgqCavV2cqQ/v-deo.html
      You can see how silly it becomes

    • @theundaddy8037
      @theundaddy8037 10 місяців тому

      @@MilanJovanovicTech
      Thank you very much for the link! I agree, it does seem pointless to create all this unnecessary abstraction with read services, if all we are doing is running a simple query.

  • @muhamotto2084
    @muhamotto2084 11 місяців тому

    isn't supposed that the GetArticleByIdQueryHandler in the persistence layer uses the ArticleRepository instead of using the ApplicationDbContext ??

  • @kristianaranda
    @kristianaranda Рік тому +1

    Great video Milan!!

  • @expertreviews1112
    @expertreviews1112 Рік тому +1

    why not shared source code? so inconvenient :(

  • @joaocampos9615
    @joaocampos9615 5 місяців тому

    Great video, Milan. Very practical info, rather to see your video to quickly be a up to speed, than reading a 500 pages Clean arquitecture book :P
    Thanks !

  • @MdFaisalMahmudShow
    @MdFaisalMahmudShow 7 місяців тому

    Im little bit confused here. Onion focus on services and clean focus on use cases.
    But service contains the use cases, isn't it?
    Then What is the difference actually, Can anyone explain it.

  • @antonmartyniuk
    @antonmartyniuk Рік тому +1

    Ah, after all you did this video! Nice!

  • @sunzhang-d9v
    @sunzhang-d9v Рік тому +1

    Clean Architecture is not Domain-Driven Design?

  • @pioners1001
    @pioners1001 2 місяці тому

    Onion, Clean, or whatever are just branding of the same thing. The most important part of this is the concept, not the implementation details or the name. Implementation might diverge and adapt to your needs.

    • @MilanJovanovicTech
      @MilanJovanovicTech  2 місяці тому

      Yes, you're spot on. I wrote about this in a few posts recently.

  • @pavelromashuk237
    @pavelromashuk237 Рік тому

    I think Clean architecture is more complicated than described in the video. Some key points - bounded context, domain objects are missed. Domain objects are completely different in onion ad clean, in clean you can`t simply take domain object and save it.

  • @Forshen
    @Forshen Рік тому +1

    Its the same, even the dotnet channel said it. "formerly known"

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      Formerly known?

    • @lettuceturnipthebeets790
      @lettuceturnipthebeets790 Рік тому +1

      ​@@MilanJovanovicTechthey probably meant dotnet channel mentioning Clean Architecture formerly known as Onion Architecture

    • @Forshen
      @Forshen Рік тому

      I wanna add, that most design patterns (including architecture) are just a theory of how to do certain stuff. But its not a strict rule, so the Clean Architecture can be implemented with different outcomes.

  • @muthumanivelv566
    @muthumanivelv566 Рік тому +3

    I thought both are one in the same🙄

    • @Forshen
      @Forshen Рік тому +3

      Its the same, even the dotnet channel said it. "formerly known"

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому

      By the end of the video, you can come to that conclusion

    • @sotsch9280
      @sotsch9280 Рік тому

      They are the same 😂

  • @wmalgoire
    @wmalgoire Рік тому +1

    Cool idea to explain differences between those two approaches👌The layer is thin.. 😁
    On a personal note I'm so glad CleanArchitecture has become more popular. I'll always remember the face of the people I tried to explain/sell "Onion" architecture benefits. Lost half of them right at the beginning 🧅🤥

  • @techpc5453
    @techpc5453 Рік тому +1

  • @juliangzr4998
    @juliangzr4998 Рік тому

    Thank you!

  • @truzhot
    @truzhot 3 місяці тому

    Both are the same, the difference for me, is that one uses CQRS and another Services.. idk

  • @Spacchio
    @Spacchio 3 місяці тому

    In clean architecure the repository belongs to the application layer not the domain. The use cases should be exposed as inbound ports of the app layer and they should not be commands, they could however be implemented underneath as commands, but that's a technical detail that the caller does not need to know. A use case should also be named as Use Case at the end, for example AddOrderUseCase to make clear we are talking about use cases and not services or bananas. All the external dependencies of the application layer should be defined in a separate project called application.ports.outbound which is the one that the external layers will implement.

    • @MilanJovanovicTech
      @MilanJovanovicTech  3 місяці тому

      UseCase = Command/Query, same thing.
      "All the external dependencies of the application layer should be defined in a separate project called application.ports.outbound which is the one that the external layers will implement" - Too much work for not so much benefit. We'll end up with dozens of projects if we go down this route.

    • @Spacchio
      @Spacchio 3 місяці тому

      @@MilanJovanovicTech not really the same thing mate. Commands and queries are a technical implementation of use cases

  • @matswessling6600
    @matswessling6600 9 місяців тому

    a VERY simple project. Why not show how a real world project is implemented... That will give a much better insigts in the real problems that you never need to handle in such simple examples..

    • @MilanJovanovicTech
      @MilanJovanovicTech  9 місяців тому

      Because the concepts get lost in the complexity of a large project, and you can't explain it all in a 10-15-20 min video.

    • @matswessling6600
      @matswessling6600 9 місяців тому +1

      @@MilanJovanovicTech I dont think so. Obviously you vcannot write that system from scratch but you can show diagrams of it and show exampkes of real code.
      these kind of simplified examples doesnt really help. it just fools people.

  • @alibabarahaei2229
    @alibabarahaei2229 6 місяців тому

    Perfect❤

  • @emrahyigit
    @emrahyigit Рік тому +11

    Both architectures are trash and will be deprecated very soon anyway. But thanks for the video. (Liked)

    • @juliansegura5507
      @juliansegura5507 Рік тому +2

      Interesting take... why do you say so?

    • @MilanJovanovicTech
      @MilanJovanovicTech  Рік тому +11

      They've been saying that for almost 20 years now.

    • @pilotboba
      @pilotboba Рік тому +2

      Is it the architecture that's trash or the project organization?
      Code to interface not implementation is a pretty well-established OOP principle.
      That said, why is it "trash"? Objective evidence, please.

    • @sotsch9280
      @sotsch9280 Рік тому +3

      Anyone saying this has no Idea imho! 😂 sorry, but this architectures keep the most basic and ever important keypoints. You will always have to deal with dependencies and layers. Have Met alot of people saying the same, watching their "architectures" and know whats their problem.. they are mostly beginners, although few of them programming for tons of years.

    • @hungngo2857
      @hungngo2857 4 місяці тому

      nothing is trash when u really understanf the idea behind it