Coder Social home page Coder Social logo

Microsoft states that the CQRS pattern isn't recommended in situations where the domain or the business rules are simple about aspnetcore-realworld-example-app HOT 3 CLOSED

gothinkster avatar gothinkster commented on July 24, 2024
Microsoft states that the CQRS pattern isn't recommended in situations where the domain or the business rules are simple

from aspnetcore-realworld-example-app.

Comments (3)

adamhathcock avatar adamhathcock commented on July 24, 2024

Microsoft guidance isn't the gospel truth. There's a wide community of .NET developers that explore things outside of the Microsoft box. CQRS doesn't mean anything other than having separate pathways for commands vs queries. There is usually a big distinction in what they do.

If you're looking for a Repository pattern with horizontal layers and unnecessary duplication then this isn't it. The vertical slices for operations allows for a more concise code base. If complexity grows then refactoring can group functionality and common code together.

The references on the README try to explain further.

from aspnetcore-realworld-example-app.

VictorioBerra avatar VictorioBerra commented on July 24, 2024

I have spent the last few days pouring over all articles on the README, articles related to Onion architecture, building my own prototype apps to learn some nuances of each and I can see both having their own place.

horizontal layers and unnecessary duplication

The repository pattern allows you nice isolation of your business logic in your services for test-ability. Anyone who has ever had to talk to SQL, Hbase, and Dynamo will tell you that they are probably thankful all they had to do was re-write their repository layer. All that to say I think each pattern really depends on your use-case and the complexity of your application.

I think this RealWorld repository is inherently flawed in the fact that it says "this is the best way to solve all problems". I like the showcase of things like adding Swagger, using cors, what libraries to use and how to abstract certain things away. Also popular libraries like these tend to get some experienced eyes on them which always makes me feel better when I read and use examples from code that I know has been proofed before. Even though I have recently added an issue about a lack of comments in this code base.

My original comment was just to warn people that this library uses a very opinionated pattern of problem solving and that its not the hammer for all nails.

from aspnetcore-realworld-example-app.

adamhathcock avatar adamhathcock commented on July 24, 2024

The repository pattern allows you nice isolation of your business logic in your services for test-ability. Anyone who has ever had to talk to SQL, Hbase, and Dynamo will tell you that they are probably thankful all they had to do was re-write their repository layer. All that to say I think each pattern really depends on your use-case and the complexity of your application.

Repostory doesn't give you anything but an unneeded layer of abstraction when what you want is something specific like the Query classes do. A quick google for repository anti pattern finds a lot: https://www.infoworld.com/article/3117713/application-development/design-patterns-that-i-often-avoid-repository-pattern.html

This definitely does not say "best way to solve all problems" but it is a demo of more modern practices than things like the Repository pattern. It is definitely not a one-size-fits-all.

Every strategy is opinionated and tries to guide users down a path. Everything should be examined. As I've said, this is a demo of where a lot of the mindshare of some things that the community does outside of the Microsoft sanctioned practices.

from aspnetcore-realworld-example-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.