Skip to content

Instantly share code, notes, and snippets.

@vilmosioo
Created December 5, 2012 18:14
Show Gist options
  • Save vilmosioo/4218079 to your computer and use it in GitHub Desktop.
Save vilmosioo/4218079 to your computer and use it in GitHub Desktop.
Repository concept
// It is recommended to use an interface when using a repository.
// This way you can change the implementation without affecting the usage
public interface IRepository {
public void connect();
}
public class Repository implements IRepository {
// get the instance of the controller
private MainController controller = MainController.Current();
public Repository() {
}
public void connect() {
// TODO Connect to a database, call an API etc...
}
// Other methods ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment