I have a SQLStatement class which builds up sql query and supports bind parameters (which is stored to the property $params).
I have a PDOAdapter class which acts just like PDO but has additional features such as prepare_query(SQL Statement $sql)
. It prepares the sql statement and binds the parameter which is stored in $sql->params
, then execute it.
And,
I think I want to add a QueryEngine class which can select, insert, update, delete which means it'll build up SQL statement using the SQLStatement class and make PDOAdapter prepare_query it.
I can say its responsibilites are to generate sqlstatement based on the method parameters using SQLStatement class AND make PDOAdapter process it. (Multiple Responsibility)
But, I can also say, its responsibility is to do basic CRUD operations. (Single Responsibility)
Does this QueryEngine class violate Single Responsibility Principle ?
Does this make SQLStatement and PDOAdapter tight-coupled ?
Actually, what is the exact definition of the word Single? I'm confused whether moving a table is single responsibility or multiple responsibility (lift the table up, move it, and put it down).