# Repository Pattern (Laravel) > Repository pattern(트레이드오프, 사용 사례), contracts, service layer, SOLID 원칙, dependency inversion, 테스트 용이성, 사용하지 말아야 할 경우 - 20 면접 질문 - Senior - [면접 질문: Laravel](https://sharpskill.dev/ko/technologies/laravel/interview-questions.md) ## 1. Laravel에서 Repository Pattern이란 무엇인가요? **답변** Repository Pattern은 비즈니스 로직과 데이터 계층 사이에 추상화 계층을 추가하는 design pattern입니다. 데이터 접근 로직을 전용 클래스(repositories)에 캡슐화하여 관심사를 분리하고 코드를 더 테스트하기 쉽게 만듭니다. controllers에서 Eloquent를 직접 사용하는 것과 달리, repository는 복잡한 쿼리를 중앙화하고 애플리케이션의 나머지 부분에 영향을 주지 않고 데이터 소스를 변경하기 쉽게 합니다. ## 2. Repository Pattern이 가장 큰 가치를 제공하는 시나리오는 무엇인가요? **답변** Repository Pattern은 정교한 쿼리와 여러 데이터 소스를 가진 복잡한 애플리케이션에서 특히 유용합니다. 데이터 접근 로직이 복잡하고, 여러 곳에서 재사용되거나, 변경될 가능성이 있는(예: MySQL에서 MongoDB로 마이그레이션) 엔터프라이즈 프로젝트에서 진가를 발휘합니다. 단순한 CRUD나 소규모 애플리케이션에서는 불필요한 과도한 설계가 될 수 있습니다. ## 3. Repository Pattern의 주요 트레이드오프는 무엇인가요? **답변** 주요 트레이드오프는 코드의 복잡성과 유지해야 할 파일 수의 증가입니다. 각 repository는 최소 2개의 파일(interface + 구현)을 추가하므로 단순한 애플리케이션에서는 금세 장황해질 수 있습니다. Laravel Eloquent는 이미 사용 사례의 80%를 해결하는 강력한 추상화이며, 쿼리가 단순한 경우 추가 레이어를 두면 실질적인 이점 없이 개발 속도를 늦출 수 있습니다. ## 17개 추가 질문 이용 가능 - Repository Pattern은 SOLID의 Dependency Inversion 원칙을 어떻게 적용하나요? - 테스트에서 Repository Pattern의 주요 장점은 무엇인가요? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Laravel 면접 주제 - [PHP 기초](https://sharpskill.dev/ko/technologies/laravel/interview-questions/php-basics.md): 25개 질문, Junior - [PHP 객체지향 기초](https://sharpskill.dev/ko/technologies/laravel/interview-questions/php-oop-essentials.md): 20개 질문, Junior - [Composer & Autoloading](https://sharpskill.dev/ko/technologies/laravel/interview-questions/composer-autoloading.md): 18개 질문, Junior - [Laravel 기초](https://sharpskill.dev/ko/technologies/laravel/interview-questions/laravel-fundamentals.md): 20개 질문, Junior - [Laravel 라우팅](https://sharpskill.dev/ko/technologies/laravel/interview-questions/laravel-routing.md): 20개 질문, Junior - [Blade Templates](https://sharpskill.dev/ko/technologies/laravel/interview-questions/blade-templates.md): 18개 질문, Junior - [Request & Response](https://sharpskill.dev/ko/technologies/laravel/interview-questions/request-response.md): 20개 질문, Junior - [Eloquent ORM 기초](https://sharpskill.dev/ko/technologies/laravel/interview-questions/eloquent-orm-basics.md): 22개 질문, Junior - [Eloquent Relationships](https://sharpskill.dev/ko/technologies/laravel/interview-questions/eloquent-relationships.md): 25개 질문, Mid-Level - [Migrations & Schema Builder](https://sharpskill.dev/ko/technologies/laravel/interview-questions/database-migrations.md): 20개 질문, Mid-Level - [유효성 검사와 폼](https://sharpskill.dev/ko/technologies/laravel/interview-questions/validation-forms.md): 22개 질문, Mid-Level - [인증](https://sharpskill.dev/ko/technologies/laravel/interview-questions/authentication.md): 20개 질문, Mid-Level - [인가와 Policies](https://sharpskill.dev/ko/technologies/laravel/interview-questions/authorization-policies.md): 18개 질문, Mid-Level - [API Resources & Authentication](https://sharpskill.dev/ko/technologies/laravel/interview-questions/api-resources-authentication.md): 26개 질문, Mid-Level - [미들웨어](https://sharpskill.dev/ko/technologies/laravel/interview-questions/middleware.md): 18개 질문, Mid-Level - [Service Container & DI](https://sharpskill.dev/ko/technologies/laravel/interview-questions/service-container-di.md): 20개 질문, Mid-Level - [Queues & Jobs](https://sharpskill.dev/ko/technologies/laravel/interview-questions/queues-jobs.md): 22개 질문, Mid-Level - [Events & Listeners](https://sharpskill.dev/ko/technologies/laravel/interview-questions/events-listeners.md): 18개 질문, Mid-Level - [알림 및 메일](https://sharpskill.dev/ko/technologies/laravel/interview-questions/notifications-mail.md): 20개 질문, Mid-Level - [File Storage](https://sharpskill.dev/ko/technologies/laravel/interview-questions/file-storage.md): 18개 질문, Mid-Level - [Testing & PHPUnit](https://sharpskill.dev/ko/technologies/laravel/interview-questions/testing-phpunit.md): 24개 질문, Mid-Level - [Caching](https://sharpskill.dev/ko/technologies/laravel/interview-questions/caching.md): 18개 질문, Mid-Level - [Livewire & Inertia](https://sharpskill.dev/ko/technologies/laravel/interview-questions/livewire-inertia.md): 20개 질문, Mid-Level - [Eloquent Advanced](https://sharpskill.dev/ko/technologies/laravel/interview-questions/eloquent-advanced.md): 24개 질문, Senior - [Laravel 패키지](https://sharpskill.dev/ko/technologies/laravel/interview-questions/laravel-packages.md): 20개 질문, Senior - [Performance Optimization](https://sharpskill.dev/ko/technologies/laravel/interview-questions/performance-optimization.md): 22개 질문, Senior - [Security Best Practices](https://sharpskill.dev/ko/technologies/laravel/interview-questions/security-best-practices.md): 22개 질문, Senior - [Laravel Octane](https://sharpskill.dev/ko/technologies/laravel/interview-questions/laravel-octane.md): 18개 질문, Senior - [Laravel Distributed Systems](https://sharpskill.dev/ko/technologies/laravel/interview-questions/laravel-distributed-systems.md): 22개 질문, Senior - [Observability & Monitoring](https://sharpskill.dev/ko/technologies/laravel/interview-questions/observability-monitoring.md): 20개 질문, Senior - [Deployment & DevOps](https://sharpskill.dev/ko/technologies/laravel/interview-questions/deployment-devops.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/laravel/interview-questions/repository-pattern