开发者

What exactly is a framework? Like Zend Framework for PHP

I am new to coding and would jus开发者_StackOverflowt like to know a bit more about frameworks. How does a framework help you code and what exactly is it? Such as Zend for php.


A framework is basically a way to program "inside out". In traditional programming, you write the "main" code and call functions from the library when and where you need them. A framework, on the contrary, handles the "main" code on its own, and calls your functions when appropriate. In other words, a framework is a pre-written, ready-to-run application, which you can extend or adjust to your needs.


A framework is an organized group of code that takes care of some "lower-level" details for you, so you can concentrate on building your application (or whatever it is you are working on).

For PHP, most frameworks implement the MVC architecture pattern. These frameworks organize your code for you into models, controllers, views, and other directories of "stuff" (depending on the framework) - this keeps your code cleaner and more maintainable. Instead of trying to maintain this organization on your own, just use the framework and you do not need to worry about many details. Many MVC frameworks also have many other nice features built-in, such as unit testing, classes to simplify database access, etc.

So in short, using a (good) framework simplifies development because it solves many problems that you would otherwise have to deal with yourself.


A framework is essentially a foundation for applications. Which means the following:

  • If you build your application on a framework, it can't be separated from it: there is a dependency to that framework.
  • The framework provides all that is necessary for your application to run. It handles about everything a typical application needs. (Think of: (internal) data storage, output and input)

Zend for PHP is a framework for creating internet applications. It has a lot of modules, which will help you build your application more productive.

The difference between a framework and a plain library is that a framework often consists of multiple libraries which need each other to function properly. An example of a framework you probably have used: Windows. The Windows platform provides a set of libraries for you to use, but those libraries need each other too to function properly, e.g. the library for letting applications play video-files needs the library for outputting pixels on your screen.


A framework is basically a group of libraries that make you follow a certain way of coding your app. Like in most php frameworks you are required to follow the mvc design pattern. Zend is not exactly a framework because it let's you just use whatever you want and you use just the parts you want.

Hope this helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜