Is making a class just for opening and closing a database connection taking Single Responsibility to far?

  • 1
    Seems like it. I'm not sure I've seen it done like that. Doesn't make it a terrible idea tho
  • 0
    @corscheid how would you feel inheriting a project with classes like that?
  • 3
    Such a thing already exists. That would be a connection pool. You normally don't need to implement one yourself, as there are plenty of frameworks around for that.
  • 2
    Wrote one myself as the connection pool for the dotnet mysql connector sucks donkey balls under load, also included a lot of nice tricks. It currently is one of the most usefull parts of our project.
Add Comment