Changhui Xu
1 min readFeb 4, 2022

--

If the queries don't change much, why did you start off refactoring? Now you build an opinionated framework which has not been widely tested and may still bound deeply to your specific use case, and then you leave your framework to future maintainers and hope they can learn it very well when something needs to change... In my opinion, your framework will soon become a technical debt.

SQL queries and statements are already simple enough. However, your framework introduces extra layers by trying to handle multiple things in some bloated methods. You probably know the Single Responsibility Principle and Open-Close Principle. I bet you may think differently if you see another person writing code in the style in this article.

More importantly, when implementing applications, we should keep in mind of the principle of "Composition over Inheritance". From what you have said, the biggest achievement is that you have reduces half lines of code. Is it still readable after 3 months? How much time do you need to pick up your mental model for this framework even though it's built by yourself? Do you still have confidence in your code when you need to update code?

--

--

Changhui Xu
Changhui Xu

Written by Changhui Xu

Lead Application Developer. MBA. I write blogs about .NET, Angular, JavaScript/TypeScript, Docker, AWS, DDD, and many others.

Responses (1)