Should I use a framework or write my own MVC?

I have a project that is currently everywhere, and I am thinking of creating it MVC.

The problem is that the system is currently in use and I cannot change the interface (it is in frames: s). There are also certain things that I will need to handle on my own, such as creating passwords, login and user levels.

I already have a side down MVC model, so I wonder if it's worth using a framework like Zend Framework or CakePHP, or just to code my own View and Controllers to solve this problem?

I will need to work this slowly, and I'm not sure if I can do this if I use one of the ready-made frameworks.

+6
php model-view-controller cakephp refactoring zend-framework
source share
8 answers

Normally, I would step back in horror and advise against adding another MVC web structure to the world, but it’s fair to say that our hosts Joel and Jeff have one more opinion about this:

From Joel: In Defense of the Revival of the Wheel From Jeff: Do Not Reset the Wheel

One last thought: if it is a project from one person, then you only influence this choice. My resistance would come up if a team developing a long-lived product participated. You can render a bad service to the team and the client if you refuse on your own.

+8
source share

I wrote my own MVC framework for Coldfusion because the current Mach-II "flavor of the month" was terribly slow. After switching, the page generation time is reduced from 2-5 seconds to 9 milliseconds.

Over the past 3 years, I developed this structure as a competitor for any commercial or open source code that I used (and I used a lot), creating libraries of functions and components for a number of common tasks (CMS, CC processing, image processing, etc. .)

Despite the fact that there was no doubt that some kind of “reinventing the wheel” the wheel that I got into was exactly what I needed to do my job. I understand how this works with intimacy that no documentation can provide.

Of course, one day some future programmer can curse my code, wanting smallpox for me, so as not to use their favorite library - but, to be honest, I didn’t care. I wrote this for me, he does what I need, and everything is fine. I also learned a lot in this process.

Having said that you DO NOT automatically make your customers / employees poor service by writing your own framework. Social frameworks, as a rule, have no real direction, therefore, as a rule, they swell everywhere, trying to keep everyone satisfied. This bloating means learning more about what may go wrong. Your infrastructure will meet a much smaller set of requirements and with good documentation it can be much easier to understand and configure than a more public one.

I say, follow him, live a little on the edge. Perhaps in 5 years you’ll release the next “Mach II” or something else, and we can all judge it.

+8
source share

You will find that CakePHP in particular is quite "invasive." IMHO for this you should use a light frame or write your own. I usually do not recommend writing your own for this kind of thing, but when you are dealing with software that you cannot change, it can sometimes be the best solution. In addition, the controller in PHP is not a difficult task to write, so sometimes you can unnecessarily exaggerate the solution if you use a ready-made solution that is either too heavy or just not suitable for your current limitations.

For lightweight MVC frameworks, I highly recommend CodeIgniter .

+4
source share

Rethinking wheels is bad. Use a tried and tested structure, such as the Zend Framework, unless you have a really special reason not to.

+3
source share

It depends on your task. Some trivial tasks already have excellent solutions, but sometimes it’s more difficult to fix errors or find a solution for your needs than to write your own.

In any case, when you start using the framework, you need to spend some time to learn it. And sometimes writing is faster than learning.

Just talk about the necessary solutions, find mature ones, look at their functionality, read open errors and decide if you want to use them. That’s all I can tell you without a detailed task.

+2
source share

The problem is that the system is currently in use and I cannot change the interface (it is in frames: s). There are also certain things that I will need to handle on my own, such as creating passwords, login and user levels.

I will need to work this slowly, and I'm not sure if I can do this if I use one of the ready-made frameworks.

Without knowing the details of your situation, I would say that the fact that the system is currently running will complicate the integration of the MVC environment.

Having said that, many MVC structures consist of modular components that can be used as stand-alone objects. You can use some functions of these frameworks for use in your project.

User authentication, session management and password processing is one of the areas, in particular, which should be built only from scratch, if you have extensive experience in this field.

+2
source share

Developing a framework is not an easy task, by the way, you must constantly coordinate, test, fix, test and develop new functions. Therefore, if you are not going to do this with open source, that we would be a good idea to create a huge community of development testers, you should not think about reinventing the wheel. It is round, it rotates well, so choose the best one that suits your needs and profit from several months of coding and testing the community.

Best wishes

+1
source share

The question is old, but still valid. Personally, I type from scratch. I like to save time, but not at all cost. Therefore, I use the framework interchangeably. This means that I create all my business classes / rules in the TDD process outside of any structure, and then integrate them into a structure that allows me to combine my work with standard services and librairies. But my work is not related to them. They are free and fast.

For a more direct answer to the question. I created my own CMS. And I can tell you that if you want to know about something, create your own. Even if you never share it. You get a much better understanding of other systems, and it will be much easier for you to choose it. Again, you may never want to use another, and then yours. But this usually happens after several revisions :)

So give your own, but study others.

+1
source share

All Articles