3 ms·
I've never really seen the benefit of using frameworks... are they as highly customizable as php, when it comes to html code? because if not, I can save myself
by jcfrei 15y ago
I've never really seen the benefit of using frameworks... are they as highly customizable as php, when it comes to html code? because if not, I can save myself a lot of work by writing the whole html by hand and then use ajax calls to retrieve all the dynamic content... unless of course page generation is absolutely crucial and I want as few http requests as possible...
could someone elaborate on this?
- meric 15y agoWhat you're describing sound more like the definition of a CMS than of a framework. With frameworks you no longer have to manage your own sockets/sessions/connections (some servers take care of this also). Instead of you calling on a socket to send data to clients, the framework calls your functions that simply return the data. More elaborate frameworks come with "helper" functions that, for example, cleans up input data for preparation of saving to the database, (preventing SQL injections), abstracts away the database models. i.e write only one set of models in python, so you don't have to rewrite your database tables when you switch from MSSQL to PGSQL. Each framework come with their own set of design patterns. While this might reduce the flexibility in terms of the architecture design, a framework has been tested and used many times, so the patterns a framework comes with are usually quite suited for what the framework is designed for. e.g. with Django web framework, you (must) use an MVC architecture. Although it is quite difficult to diverge from the MVC pattern, the MVC pattern is a suitable choice for web applications. Frameworks abstracts away the bare metal of the HTTP protocol, the database, and allows you to concentrate only on the content and logic. A framework is basically a semi-built application; Look at your past websites, what are the common things between all of them? If you abstract all of that into a 'library', you might have some sort of framework there. Of course with PHP, a lot of that is already taken care of. One thing I remember from PHP was that you write your code in a .php file, and the name of the file becomes part of the URL the user must type into the browser. Well, a framework can abstract away that too, so you can write your own urls and redirect to the appropriate function/file to handle the 'visit'. I might have overstated what a framework can do here, I rarely go without it so perhaps maybe running with only a server can still provide some of the above described functionality, especially with regards to connections and sockets.