About the UserRepository protocol. I don't realy like java style naming where you have an interface called UserRepository and the implementation like UserRepositoryImpl. You've mentioned that we should show the concrete intent that the implementation does (like CoreDataUserRepository) and I kinda agree. But... What if the implementation is more complicated than just core data wrapper. What if the default concrete implementation of UserRepository protocol has 2 or more DAO (API and local storage). We still got loosely coupled testable code. The responsibility of that class remains the same. It is a single source of truth that provides CRUD operations for some User model. It's just a bit smarter than just CoreDataUserRepository. How do I name such a class?
Hello! Following a good separation of concerns, you can create two separate implementations in this case: CoreDataUserRepository and APIUserRepository. Then, you can create a third implementation as a composite: UserRepositoryComposite that can compose any number of repositories. We show this and other advanced approaches in the iOS Lead Essentials program ✅
About the UserRepository protocol. I don't realy like java style naming where you have an interface called UserRepository and the implementation like UserRepositoryImpl. You've mentioned that we should show the concrete intent that the implementation does (like CoreDataUserRepository) and I kinda agree. But... What if the implementation is more complicated than just core data wrapper. What if the default concrete implementation of UserRepository protocol has 2 or more DAO (API and local storage). We still got loosely coupled testable code. The responsibility of that class remains the same. It is a single source of truth that provides CRUD operations for some User model. It's just a bit smarter than just CoreDataUserRepository. How do I name such a class?
Hello! Following a good separation of concerns, you can create two separate implementations in this case: CoreDataUserRepository and APIUserRepository. Then, you can create a third implementation as a composite: UserRepositoryComposite that can compose any number of repositories. We show this and other advanced approaches in the iOS Lead Essentials program ✅