Desenvolupament d'aplicacions web amb frameworks
Contingut
Què és un framework?
Per començar, us reprodueixo el què explica la web de Pyramid, un conegut framework per Python, que compara la idea de llibreria i framework:
Frameworks vs. Libraries A framework differs from a library in one very important way: library code is always called by code that you write, while a framework always calls code that you write. Using a set of libraries to create an application is usually easier than using a framework initially, because you can choose to cede control to library code you have not authored very selectively. But when you use a framework, you are required to cede a greater portion of control to code you have not authored: code that resides in the framework itself. You needn’t use a framework at all to create a web application using Python. A rich set of libraries already exists for the platform. In practice, however, using a framework to create an application is often more practical than rolling your own via a set of libraries if the framework provides a set of facilities that fits your application requirements. |
Podriem dir, en resum, que un framework és:
- Un seguit de llibreries
- Uns mecanismes de control (en el cas del web, seria el serividor web)
- Un conjunt de bones pràctiques
Separació de codi i disseny
Model multicapa
Frameworks i microframeworks
Han sorgit molts microframeworks per desenvolupament superràpid, tot i que per a grans projectes potser els pot faltar algunes features que podem voler.
Frameworks Python:
- Django: és el que treballarem aquest curs
- Pyramid:
- Pyramid (oficial)
- Python: Pyramid framework (a cacauet.org)
Microframeworks Python:
Frameworks PHP: