Skip to content

Instantly share code, notes, and snippets.

@ra0van
Created February 19, 2020 06:18
Show Gist options
  • Save ra0van/092d4a99eafd0345ad0229bd53d957c4 to your computer and use it in GitHub Desktop.
Save ra0van/092d4a99eafd0345ad0229bd53d957c4 to your computer and use it in GitHub Desktop.
PR Guidelines - OO Design

PR Guidelines

Business layer/ Domain Layer

  • Define interfaces or contracts for DB Layer.
  • Inject Dependencies for Infra & Db layer from api/application layer
  • Avoid tight coupling between components
  • Single responsibility for components/classes/functions
  • Invert all dependencies for better control & unit testability
  • Use Data Transfer Objects/Intermediate objects for transfer between layers & components.
  • Avoid accessing config files directly. Use dependency injection.

Sql queries & DB layer

  • Use parameterised queries
  • Use prepared statement.
  • Using enums & Lk tables in db
  • Avoid joins on LK tables by maintaining enums(for better performance)

Written with StackEdit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment