Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lightweight MVC - no framework [closed]

Hi sorry if this is a naive question, but what did people do before mvc frameworks became so popular? All you hear of nowadays, and im talking php here, are mvc, Zend etc but what did developers do beforehand?

Are there some developers who use the mvc pattern but without a framework - if so how do they do this and is it really complicated to set up?

like image 915
David Avatar asked Jun 07 '26 06:06

David


1 Answers

MVC is a design pattern. You can easily roll your own MVC "framework" (technically even without using object-oriented programming). The main goal is simply to have a separation between data storage, business logic, and presentation.

When I was first learning about MVC, I decided that trying to sift through the mountains of code of CakePHP or other frameworks was simply too complicated. I started writing my own "framework" using this tutorial (http://fuelyourcoding.com/php-frameworks-just-roll-your-own-part-1/). It's really not as much work as you think (you can go through that tutorial in a day and have a very nice mini-MVC), and you can expand it later into a full-fledged framework later on if you have the time and dedication.

As to the question of what developers did before frameworks, well, they just wrote everything themselves. Unfortunately this led to a lot of spaghetti code with HTML mixed with PHP blocks and SQL statements, but that's not really a fault with not having a framework, rather with not trying to implement any sort of separation of concerns.

Edit: Part 2 is probably the most important part because it shows you how to make a template. This isn't actually the exact tutorial, the one I used seems to have disappeared.

like image 148
Lotus Notes Avatar answered Jun 10 '26 08:06

Lotus Notes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!