Answer the question
In order to leave comments, you need to log in
How to design a framework?
Hello! I am writing a small framework for myself for educational purposes. I made a base - parsing the route, calling the method. And already at this stage, a plug - for example, I want to shove something like a Pipeline (chain of responsibilities) there to process the request (middleware if it's easier). How to design a framework in such a way that in the future it would not be necessary to shovel all the code, including the core, in order to introduce new elements? I understand about SOLID there, but if you follow the single responsibility rule, then there will be just a whole mountain of files, and this is directly in the framework. The question also arises, for example, I now have routing a la microframework, in order to fasten MVC, I need to implement a controller search and a method call. Should this be done in a separate class?
Answer the question
In order to leave comments, you need to log in
I understand about SOLID there, but if you follow the single responsibility rule, then there will be just a whole mountain of files,Yes. so it will be
The question also arises, for example, I now have routing a la microframework, in order to fasten MVC, I need to implement a controller search and a method call. Should this be done in a separate class?no need to ask such questions. If you write something, you must be sure of the correctness of your architecture. Otherwise, you will ask a question for every sneeze.
I am writing a small framework for myself for educational purposesin general , the idea is absolutely stupid, harmful and will only lead you to burnout . For in fact, you will work for free, do something, but there will be no sense . I myself wrote the framework for several years in my free time, I wrote it, but it’s better for you to spend it all studying what is now and making the final product - it will be more useful. Plus experience on the actual tool in karma.
How to design a framework in such a way that in the future it would not be necessary to shovel all the code, including the core, in order to introduce new elements?
I understand about SOLID there...
Framework from start to finish (with pipelines, middleware and container):
https://youtube.com/playlist?list=PLE20id3DjfFnio1...
If you can’t figure out 100% why and what is used where in https://github.com/phpstan/phpstan-src/tree/master... (at least in this namespace), then forget it, it won’t work out well.
Funny videos are not worth watching. It is impossible to explain how to really do it well without experience and without knowing why someone does it the way they do it (like the phpstan team).
First you need to study and learn how to practically apply: algorithms and data structures, design patterns. And try to design.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question