Created
December 5, 2012 18:14
-
-
Save vilmosioo/4218079 to your computer and use it in GitHub Desktop.
Repository concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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