The difference between php framework and design patterns

(*-*)浩
Release: 2023-02-24 17:08:02
Original
2904 people have browsed it

The difference between php framework and design patterns

The difference between framework and design pattern

Many programmers tend to confuse framework pattern and design pattern, thinking that MVC is a a design pattern. In fact they are completely different concepts.

The two concepts of framework and design pattern are always easy to be confused. In fact, there are differences between them. (Recommended learning: PHP programming from entry to proficiency)

Framework is usually code reuse, while design pattern is design reuse, and architecture is between the two, with some codes Reuse, part of the design is reused, and sometimes analysis can also be reused.

There are three levels of reuse in software production:

Internal reuse, that is, abstract blocks that can be used publicly in the same application;

Code reuse, which is Common modules are combined into libraries or tool sets so that they can be used in multiple applications and fields;

Reuse of application frameworks, that is, providing common or ready-made infrastructure for specialized fields to obtain the highest level of reuse sex.

Although frameworks and design patterns are similar, they are fundamentally different. Design patterns are descriptions of recurring problems in a certain environment and solutions to the problems. They are more abstract than frameworks;

Frameworks can be expressed in code and can also be directly executed or reused, while In terms of patterns, only instances can be represented by code; design patterns are smaller elements than frameworks. A framework often contains one or more design patterns. A framework is always aimed at a specific application field, but the same pattern can be applied to various fields. kind of application.

It can be said that the framework is the software, and the design pattern is the knowledge of the software.

What are the framework patterns?

MVC, MTV, MVP, CBD, ORM, etc.;

What are the frameworks?

QT, MFC, gtk in C language, SSH and SSI in Java language, smarty in php language (MVC mode), django in python language (MTV mode), etc.

What are the design patterns?

Factory mode, adapter mode, strategy mode, etc.

In short: The framework is great wisdom, used to divide labor in software design; design patterns are small Techniques, propose solutions to specific problems to improve code reuse and reduce coupling.

The above is the detailed content of The difference between php framework and design patterns. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template