Mainstream open-source PHP applications such as Discuz, WordPress, and various cms are basically not developed using open-source frameworks. Aside from the historical reasons: 1. is it safer, more mature, and more stable to use framework development? 2. what causes these open-source projects to not adopt the open-source MVC framework 3. What are the disadvantages of using the open-source MVC framework? Mainstream open-source PHP applications such as Discuz, WordPress, and various cms
Basically, no open-source framework is used for development.
Except for historical reasons:
1. is development using frameworks more secure, mature, and stable?
2. what causes these open-source projects to not adopt the open-source MVC framework?
3. What are the drawbacks of using the open-source MVC framework? Reply: Hello, friend. thank you for your invitation. I hope my understanding is more helpful than misleading. Next, let's talk about my views.
I can see through the question that the subject is very familiar with PHP. Although I am not a professional phper, I have actually learned and practiced it. I feel that php is indeed a powerful tool for counterattack, with low development costs and high performance. Now, we are not talking about languages, but on open source, frameworks, mvc, and other topics.
First of all, let's talk about the author's question. I don't know how you understand mvc. Mvc is a design idea and a design pattern. This should be true, but the selling point of any framework is not because it is developed in the mvc mode. Instead, it provides a fast solution to a certain type of problems. You use it because you have such a need that it can bring convenience to you. However, the introduction of an mvc framework is basically like this. xx is an mvc framework used to solve the xx problem. you can see what the focus is on, rather than the mvc framework. The framework is like a product for Programmers. if a product is not generated for a specific type of problem, the meaning of this product is hard to say. If you only use mvc as a product, it is like you can do anything about your product, but nothing can be done, and no one needs such products.
I think I just went a long way. In fact, I just want to say that choosing a framework usually depends on the development purpose of the framework, not the development mode.
Speaking of the framework, I immediately remembered the java ssh framework. It seems to be a part of java itself. People who have learned java now generally continue to learn about the ssh framework. The ssh usage is also very high. I remembered the time when I was reading a huge java book in the library. Ah, the past is terrible. Now, let's move on to the subject.
Next, let's talk about the problems that may arise when a framework is introduced:
- Performance loss. Any framework may cause performance loss. this is also why some projects with high performance requirements often do not use the framework, and they are customized and optimized for their own scenarios. Of course, this performance can be ignored now.
- Increased complexity. Learning cost and deployment cost are the problems you must face.
- Adaptability. Once the framework is introduced, your overall structure will be fixed. you need to use it in a fixed mode. here, you need to add some specific code written by yourself, and add a bit in another place, these are all set by the framework for you. This may be quite good, but you have to adapt to it.
- Friction. This is hard to say. some frameworks may be very suitable for your needs, but some may not be what you want or even reverse. At this time, you can either hack or modify the source code of the framework. In short, you will not be very comfortable using it.
Let's talk about the php language. As a language that is easy to learn and use, a large number of functions are built in. You find that many of your operations do not need to be encapsulated and implemented by yourself. the built-in functions are powerful enough. In the past, I was deeply influenced by mvc. I used php to write things like this. first, I created three directories: module, view, and server, and then followed these steps to fill in the corresponding code. Is this a simple implementation of mvc? Therefore, I personally think that the powerful built-in php may lead to fewer frameworks. A framework cannot be too abstract or specific. This is hard to grasp for php. Sometimes you should think about whether you need some php code snippets or a framework.
Why don't we use open-source frameworks for Discuz, WordPress, and so on? I also want to try to answer. But I just want to speculate.
These things often have a single responsibility, clear goals, and use php for development, the amount of code is not necessarily very large. The framework makes it difficult to flexibly adapt to the needs of the scenario, resulting in higher complexity. For this type of public products, most users need quick installation and use, and a small number of programmers want to modify the customization. So no matter what the demand is, complexity is always not a good thing. Another possible reason is that the author cannot view other people's code. How can I write it myself. Open-source code tends to pursue freedom, while commercial projects tend to pursue efficiency. Therefore, commercial projects tend to use frameworks more frequently.
I spoke about such a framework, because this is the focus of our problem. In fact, a good framework can save you a lot of work and time. Therefore, a framework is a good thing, but it often encounters a programmer who does not understand it.
I think when selecting an open-source framework, any one or all of us must clearly define our own needs and understand the framework you will use. After necessary trade-offs, you can determine whether to use the framework. If you don't want to use the framework, you can use it if you want to use it. Otherwise, your tears will only fall if you finally know the truth.
If you can elaborate on the php open-source mvc framework, I may be able to answer more questions. The above is just a humble opinion. The open-source projects you mentioned have a relatively large scope and do not know which open-source projects you have viewed. Different open-source projects have different purposes and applicable scenarios. as far as I have seen them, they can be roughly divided into the following categories:
- The basic tool library helps you deal with dirty or tricky tasks, allowing you to focus on business logic. for example, jQuery in the front-end field encapsulates many browser compatibility issues, provides a very unified interface for front-end engineers;
- Workflow Framework helps you sort out typical workflows of some jobs, such as websites that process user requests and provide responses, involving data, logic, and view layers, most of these frameworks use a lot of mature design patterns. The typical pattern is MVC. of course, to make these frameworks easier to expand, other patterns will also be used, for example, there are too many frameworks in the factory mode and proxy mode. Each language has many and countless frameworks, such as Java Spring, PHP Cake, Zend, Think, and Javascript backbone, nodejs express, python django, and so on.
In general, each open-source project is an open-source project where the author puts the accumulation of his work and skills for others to use, hoping to get the contributions of others, at present, many projects on github are like this. with these projects, the work of the later parties can be said to be on the shoulders of giants. I guess the MVC idea is not popular in PHP when the two companies are developing.
Now PHP is also popular with MVC, and they already have their own framework.
I have read their source code a little before, and I feel like they are all written by madmen. I cannot maintain it, and I don't know what their team thinks. It may be process-oriented agile development. Or consider performance or other factors.
But looking at the open-source programs that come out, basically all follow MVC, such as PHPWIND and SHOPEX, so MVC is the inevitable direction. I am also considering using a framework .... do I feel that I can develop a lot of redundant code... I personally think that using a framework is dependent on others. they have the ability to build their own framework. instead of spending their energy on researching a framework, they are better off writing a framework by themselves. (Large projects frequently modify the Framework eXtension .) An open-source social Q & A program in WeCenter in China uses the Mvc framework. I think MVC is quite good and the development efficiency is quite high. I have read the dedecms source code and it is a bit bad.