Answer the question
In order to leave comments, you need to log in
The question of the organization of architecture. Performance or maintainability?
In the process of writing an application, it always breaks me into writing beautifully and maintainably or effectively and ugly. The question is how much slower does the application become if abstractions are used everywhere to comply with SIP?
In one of my applications, I have a Save controller in which I read the stream from the HTTP body of the message and pass this stream to my other application (like micro services). There is not much code, but perhaps it should be placed in a separate object? But then, every time the client accesses this controller, I will have to create this object and these are resources.
What do you do in such cases?
Answer the question
In order to leave comments, you need to log in
every time the client accesses this controller, I will have to create this object
You are too obsessed with the principles of programming. This is good only in "heavy" large projects, but it greatly spoils small applications. Any constructions should be introduced as needed, and not because it is so beautiful and correct.
Calculate whether there are any advantages from such an architecture, SIP, as well as other development principles, this, of course, is a guideline, but this does not mean that under the conditional helloworld you need to create a bunch of abstractions in accordance with the principles. There are other principles, for example, KISS (Keep it simple). If you do not see obvious advantages, then you may not need a lot of abstractions
Do not get hung up on principles and blindly follow them. The choice between performance and maintainability is always based on the characteristics of the project. It is worth considering how important maintainability is in general in a particular project and how much performance-improving solutions can worsen it. If the project is small or is developed as some kind of temporary solution, then it is unlikely that performance code will greatly degrade maintainability. If the project is large and changes will be actively made to it in the future, you should prefer performance maintainability
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question