为什么 Connection 没有 executeQuery 方法

Why Connection doesn't have executeQuery method

为什么 executeQuery() 方法在 Connection Class 中不可用?

如果可用,我们可以使用 Connection 对象轻松调用 executeQuery 方法。

那么我们不能将 Statement Class 扩展到 Connection Class 来实现这个吗?

它打破了 Single responsibility principle

principle that states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class.

连接 class 处理连接但不处理 decide/know 如何执行查询(单个、批处理、模板...)