Naming Swift protocols, classes, structs + Bridging UIKit & SwiftUI | iOS Dev Live Mentoring

  Рет қаралды 13,958

Essential Developer

Essential Developer

Күн бұрын

Пікірлер: 2
@alexeylobankov
@alexeylobankov 3 жыл бұрын
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?
@EssentialDeveloper
@EssentialDeveloper 3 жыл бұрын
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 ✅
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
I built an Omni-Directional Ball-Wheeled Bike
27:55
James Bruton
Рет қаралды 2,8 МЛН
The Secrets of Photorealism
24:38
Blender
Рет қаралды 879 М.
This free Chinese AI just crushed OpenAI's $200 o1 model...
4:41
Fireship
Рет қаралды 1,7 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН