Desenvolupament d'aplicacions web amb frameworks: Diferència entre les revisions

De Cacauet Wiki
Dreceres ràpides: navegació, cerca
m (Què és un framework?)
(Què és un framework?)
Línia 3: Línia 3:
 
Per començar, us reprodueixo el què explica la [http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/introduction.html web de Pyramid], un conegut ''framework'' per Python, que compara la idea de llibreria i ''framework'':
 
Per començar, us reprodueixo el què explica la [http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/introduction.html web de Pyramid], un conegut ''framework'' per Python, que compara la idea de llibreria i ''framework'':
  
<table width="600">
+
<div style="background-color:#dddddd;max-width:600px;padding:1em 2em;">
<tr><td bgcolor="#dddddd">
+
 
'''Frameworks vs. Libraries'''
 
'''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.
 
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.
</td></tr>
+
</div>
</table>
+
  
  

Revisió de 14:55, 26 set 2016

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 servidor web)
  • Un conjunt de bones pràctiques ...molt important!!


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:

Microframeworks Python:

Frameworks PHP: