Alternatives to Using Repositories12:49 with James Churchill
Now that we've gone through the process of adding repositories to our web app, let's talk about the pros and cons of the repository design pattern and look at an alternative approach that utilizes query and command classes.
To follow along committing your changes to this course, you'll need to fork the dotnet-comic-book-library-manager repo. Then you can clone, commit, and push your changes to your fork like this:
git clone <your-fork> cd dotnet-comic-book-library-manager git checkout tags/v3.8 -b alternatives-to-using-repositories
Are Repositories Necessary?
Over the years, some developers have begun to question the value of using repositories. For more information about this discussion, see the following blog posts.
- Favor Query Objects Over Repositories
- Wither the Repository
- Limiting Your Abstractions
- Repositories On Top UnitOfWork Are Not a Good Idea
Organizing Projects By Feature Instead of Class Type
Instead of organizing projects by class type, it's possible to organize your projects by feature. For more information on what this is and how to do it, see this blog post from Tim G. Thomas.
YAGNI - You Aren't Going to Need It
YAGNI, or You Aren't Going to Need It, is the idea that you shouldn't add something to your application until you actually have a need for it. Sounds like a simple idea, but you'd be surprised how often as programmers we feel the urge to add stuff that we don't actually need.
For more information see this article on Wikipedia: https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
You can download the code for the ComicBookArtistsController_QueriesAndCommands class from this GitHub Gist.
You need to sign up for Treehouse in order to download course files.Sign up