Skip to content

Instantly share code, notes, and snippets.

@JensRantil
Last active April 7, 2016 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JensRantil/ae3ea8725437e096f42af99fffc35982 to your computer and use it in GitHub Desktop.
Save JensRantil/ae3ea8725437e096f42af99fffc35982 to your computer and use it in GitHub Desktop.
Pseudo code for layered architecture.
public class MainContainer {
public static void main(String[] args) {
// Frameworks and drivers
DatabaseDriver jdbcDatabaseDriver = new MysqlDatabaseDriver();
// Interface adapters
UserRepository userRepository = new UserMySQLRepository(jdbcDatabaseDriver);
// Use cases.
UserBusinessUseCases userBusinessCases = new UserBusinessCases(userRepository);
// Interface adapter
WebService userServiceResource = new UserServiceResource(userBusinessCases);
// Frameworks and drivers
Webserver webserver = new Webserver();
webserver.registerService(userServiceResource);
webserver.startServiceOn("http://localhost:8080");
}
}
// Being used everywhere.
class domain.User {
public UserIdentifier id;
public Username username;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment