简体   繁体   English

使用MVC方法(基于PHP)的Web应用程序是否必然意味着它会比其他方法更具可伸缩性?

[英]Does using an MVC approach to (PHP-based) web applications necessarily mean that it will be more scalable than other approaches?

据我了解,MVC框架相当庞大(Zend,Cake,CodeIngniter),因此似乎几乎与讨论可伸缩性并建议使用MVC背道而驰。

Zend, Cake, CodeIgniter... they all come with a bunch of stuff you don't need. Zend,Cake,CodeIgniter ...它们都附带了一堆您不需要的东西。 A basic MVC framework is simple, and does not need many files to work. 一个基本的MVC框架很简单,不需要很多文件即可工作。

Also, applications built upon a MVC structure are no more or less scalable than other approaches may be, but may be more organized. 而且,建立在MVC结构上的应用程序的可伸缩性不会比其他方法可伸缩,但可能会更具组织性。 It's subjective. 这是主观的。

Although the point of MVC is simple - having data access (Model), GUI creation (View) and flow control (Controller) as separate components - it can be implemented in very different ways. 尽管MVC的要点很简单-将数据访问(模型),GUI创建(视图)和流控制(控制器)作为单独的组件-但可以用非常不同的方式实现它。

From a purely technical viewpoint, MVC has very little to do with computational scalability. 从纯粹的技术角度来看,MVC与计算可伸缩性几乎没有关系。 It's more about the human factor and having a way to organize huge piles of code into meaningful sub-units that are much easier to understand. 它更多地是关于人为因素,并且具有一种将大量代码组织成有意义的子单元的方法,这些子单元更容易理解。

I work with codeigniter every day and compared to the others mentioned it's very light weight. 我每天与Codeigniter一起工作,与其他人相比,它重量轻。

You have to consider that you will likely not use a lot of the functionality provided in the largest frameworks so just because the files are there, it's not necessarily heavy unless you include lots of the files in your actual executing code. 您必须考虑到您可能不会使用最大框架中提供的许多功能,仅因为文件在那里,就不一定很繁琐,除非您在实际执行的代码中包括了许多文件。

You can help make your own code scalable in these situations by considering when and when not to use functionality provided by the framework. 通过考虑何时以及何时不使用框架提供的功能,可以帮助使自己的代码在这些情况下可伸缩。 Learn PHPs built in functions well as they will almost always be faster than anything in a framework (because they are written in C). 很好地学习内置函数的PHP,因为它们几乎总是比框架中的任何东西都要快(因为它们是用C编写的)。

A good framework should really just help you structure you code and give you extra functionality when you ask for it, not lumber your application with a lot of extra processing. 一个好的框架实际上应该只是帮助您构造代码并在需要时为您提供额外的功能,而不是为您的应用程序增加大量的额外处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM