Why do lightweight frameworks like slim not strictly differentiate between model layers?
認(rèn)證0級講師
In fact, dividing levels is a logical problem. Many novice users use frameworks from the beginning and are spoiled by frameworks. Frameworks can do almost everything. All they have learned is to write code under a certain framework. , and out of the frame, only confusion remains.
Even if a heavy framework like domestic Thinkphp
provides the Model
layer, there are still very few people using it. Why? Because using the Model
layer requires you to divide the logic yourself and write code yourself, which is painful for them, so almost all the people I have seen operate the database in the Controller
Directly M('table')->insert($data)
and so on. The utilization rate of the Model
layer is extremely low. Thinkphp
這樣的重型框架,他提供了Model
層,用的人仍然很少,為什么?因為用Model
層還需要自己劃分邏輯,仍少不了自己寫代碼,這對他們來說是痛苦的,所以我見過的幾乎所有的人操作數(shù)據(jù)庫都是在Controller
里直接M('table')->insert($data)
等。Model
層的利用率極低。
而對于非小白用戶,Model層無法就是個封裝了某個表的數(shù)據(jù)庫操作類而已,隨手就創(chuàng)建了,何須框架來多此一舉,浪費性能?
只要心中就有mvc
,一切都有層次。
而且,隨著composer
For non-novice users, the Model layer cannot be just a database operation class that encapsulates a certain table and is created casually. Why do we need a framework to do this and waste performance?
mvc
in your heart, everything has levels. ??Moreover, with the emergence of composer
, PHP development has gradually become modularized, instead of the previous framework. Now more and more people write code that uses modules directly instead of the entire framework. ??