# Repository Pattern: Properly Organizing Your Data Layer

DevFeed: [Repository Pattern: Properly Organizing Your Data Layer](<https://devfeed.tech/articles/repository-pattern-properly-organizing-your-data-layer-22832.md>)

Original publisher: [Read original article](<http://androidessence.com/repository-pattern/>)

Author: Adam McNeilly

Published: 2019-05-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [Android Essence](<https://devfeed.tech/sources/android-essence.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [API](<https://devfeed.tech/topics/api.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [code](<https://devfeed.tech/tags/code.md>), [developers](<https://devfeed.tech/tags/developers.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [programming](<https://devfeed.tech/tags/programming.md>), [retrofit](<https://devfeed.tech/tags/retrofit.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

## AI overview

This tutorial explains the Repository Pattern for organizing an application's data layer. It shows how separating data access from a ViewModel or Presenter can keep those classes focused on requesting data while allowing the underlying source to change, such as between a Retrofit service, GraphQL API, or local database.

## Source excerpt

How to properly architect your application is a concern we as developers constantly face. There's unfortunately no one size fits all answer to it, and sometimes we don't even know where to begin. I've learned along my Android journey that the answer can also vary depending on what portion of your app you're trying to organize. Of course, you might say, it depends. When it comes to your data layer, though, there are some really good tips on how to write clean, maintainable code. One of them is the Repository Pattern, and I'd like to provide a quick walk through of what it is and why it's important.