Web Frameworks - Unina.it

2y ago
39 Views
2 Downloads
997.71 KB
55 Pages
Last View : 4d ago
Last Download : 3m ago
Upload by : Gannon Casey
Transcription

Web Frameworksweb development done rightCourse of Web TechnologiesA.A. 2010/2011Valerio Maggio, PhD StudentProf.ssa Anna Corazza

Outline Web technologies evolution Web frameworks Design Principles Case Study Django and GAE (Google App Engine) Working Example2

Intruduction Nowadays frameworks has become abuzzword Software framework Web framework Development framework So, what do you expect a web framework is?3

1. Web TechnologiesEvolution4

Web: Evolution Roadmap1HTML PagesHTML Pages: Web developers wrote every page “by hand” Update a web site means editing HTML “redesign” involved redoing every page One at a time Solution not scalable5

Web: Evolution RoadmapHTML Pages2CGI ScriptingCGI – Common Gateway Interface ( ) Pages intended as resources Pages are generated dynamically on demand Raise of (so called) server side technologies (-) Code reuse difficult Lot of “boilerplate” code (-) High learning curve6

CGI Perl Example7 What are pros and cons of these two CGIexamples ?

Web: Evolution RoadmapCGI ScriptingHTML Pages3PHP like languagesPHP like solutions ( ) Learning curve extremely shallow Code directly embedded into HTML (-) No security and/or protection mechanismprovided (?) Bunch of HTML, (Business Logic) Code,(Data) SQL code all together8

JSP Example: Pros and Cons ?9

Web: Evolution RoadmapPHP, ASP, JSP, .HTML PagesCGI Scripting4RIA and “Integrated solutions”RIA and “Integrated Solutions” RIA: Rich Internet Applications Q: Do you know what RIA means? A: Desktop-like web applications (Ajax and javascript intensive web apps) A.k.a. Solutions battery included CMS and Web Frameworks10

CMS: Content ManagementSystem Aim to manage work-flows and contents in acollaborative environment Designed to simplify the publication ofcontents to web sites and mobile devices Examples: Joomla, Drupal, Wordpress, .11

Web frameworks12 Aim to alleviate the overhead associated withcommon Web development Databases, templates, sessions, Designed to support the development of dynamicwebsites, web applications and web services Examples: Struts, Spring, Ruby on Rails, Django,Google App Engine, .

So, What is a Web Framework?13 What does this code do? What happens when multiple pages need to connect to database? Should a developer really have to worry about printing theContent-type? Is this code reusable in multiple environments with different DBconnection parameters? What happens when a web designer have to redesign the page?

Web Frameworks in a nutshell These problems are exactly what a webframeworks tries to solve Web frameworks provides a programminginfrastructure for applications Focus on developing code without having toreinvent the wheel14

2. Web Frameworks DesignPrinciples15

CGI Architecture ModelPresentation andVisualizationBusiness LogicData and Models16

CGI Architecture Model Task centric architecture (a.k.a. Model 1) Difficult reusability and maintenance of code Requires different skill-setsHigh coupling among: Presentation (View) How to show data Processing (Controller) What information to show Data Acquisition (Model) What information to extract (from DB)17

Model 1 Architecture (Java) Processing delegates as JSP and Servlets Is there any difference between CGI andServlet?18

MVC Architecture Model19 Model: Manages domain anddata acquisition View: Manages thevisualization of data Controller: Manages domain anddata processingQ: Do you think this model is feasible to be used on the web as is?

Web-MVC Architecture Model Model: Manages domain anddata acquisition View: Manages thevisualization of data Controller: Manages domain anddata processingA: No (direct) relationship between the view and the model20

Model 2 Architecture (Java)21 Model: EJB andJavabeans View: JSP and JFaces Controller: Servlets

Fulll-stack web frameworks From Python.org wiki:[.] frameworks provide support for a number ofactivities such as interpreting requests, producingresponses, storing data persistently, and so on.[.] those frameworks [.] are often known as fullstack frameworks in that they attempt to supplycomponents for each layer in the stack. So, what are such components?22

Web Frameworks Capabilities View JavaScript Library Template Engine and View Composition Development Server Controller URL Routing Controller-view Association Model Database Abstraction ORM (Object Relational Mapping)23

Database Access24 Distributed AccessLogic (JSP, Servlets) Centralized AccessLogic Q: How easy is modifythe db schema?

Active Record pattern25 An objectencapsulates bothdata and behavior Put data access logicin the domain ord.html

Heavy-weight vs Light-weightFrameworks Heavy-weight frameworks: (Mostly) Java Based Based on Model 2 Architecture High learning curve Bunch of (XML) Configuration Files Light-weight frameworks: Convention over Configuration and DRY Principles Shallow learning curve Use of Dynamic Languages Python, Ruby, Groovy, Scala26

H-W Java frameworks: Struts27

H-W Java frameworks: Hibernate28

Design Principles29 Convention over configuration “Convention over Configuration is a programming design that favorsfollowing a certain set of programming conventions instead ofconfiguring an application framework. [.]” DRY (Don't repeat yourself) “DRY is a principle that focuses on reducing information duplicationby keeping any piece of knowledge in a system in only one place.

3. Case Study:Django andGoogle App Engine30

Frameworks and Languages31

Python Programming Language“Speed and flexibility of development are critical.Dynamic languages let you get more done with less linesof code (which means less bugs)” Object orientedlanguages Clean and simplesyntax Strong Typed Dynamic Typed32

Python Programming Language Is there someone that usespython in professionalprojects? IBM, Google, Sun, HP, IndustrialLight and Magic, NASA, Microsoft Goggle it: site:microsoft.com python You'll get more than 9 thousandsresults33

Python:Language of the year 201034Programming language Python has become programminglanguage of 2010. This award is given to the programminglanguage that gained most market share in 2010.Python grew 1.81% since January 2010. This is a bit morethan runner up Objective-C ( 1.63%).Objective-C was favorite for the title for a long time thanksto the popularity of Apple's iPhone and iPad platforms.However, it lost too much popularity the last couples ofmonths.Python has become the "de facto" standard in systemscripting (being a successor of Perl in this), but it is used formuch more different types of application areas nowadays.Python is for instance very popular among web developers,especially in combination with the Django framework.Since Python is easy to learn, more and more universities areusing Python to teach programming languages.Source: tiobe.com

TIOBE: Programming Languagesrankinghttp://www.tiobe.com35

Python Dynamic Typing“Duck Typing”Walks like a duck?36def half (n):return n/2.0Quacks like a duck? Q: What is the type ofvariable n?It's a duck!

Django web frameworkDesign characteristics Model-View-Controller for the Web Written in Python Explicit instead of implicit Loose Coupling Don't repeat yourself37

Django Architecture Model38 Django is based on a slightly different version of MVC a.k.a. MVT: Model View Template Model: Domain Objects Python Classes View: contains business logic for the pages Callback as python functions Templates: describes the design of the page Template Language HTML based

Django Stack Database wrapper (ORM) URL dispatcher Template system Admin Framework I18n & l10n Authentication RSS .39

Projects and Applications Projects: Composed by different applications Glued together by unique configuration file Applications: Set of portable functionalities Code is more reusable Django Plugables (djangoplugables.com)40

URL Dispatcher Loose coupling principle between URLs andViews Based on regular expressions41

Template Language Very restrictive specific-language Allows only presentation operations No logic and/or processing allowed Less Pythonic Oriented to web designers HTML based Templates Inheritance Mechanism Code Reuse42

Template Language (2) Template Inheritance Templates are composed by Blocks43

Template Language (3) Variables: {{ Tags: {%variable name }}template tag %} Board definition: Tags tell the framework to dosomething Filters: {{variable filter }} Alters the formatting of variables44

Django Admin Framework45 So called Killer-application Compliant with Active record Pattern

Django Included Apps django.contrib.auth An authentication system. django.contrib.contenttypes A framework for content types. django.contrib.sessions A session framework. django.contrib.sites A framework for managing multiple sites with one Djangoinstallation. django.contrib.messages A messaging framework.46

Google App Engine dynamic web serving (built on top of Django) e.g. supports Django Templating Language persistent storage automatic scaling and load balancing APIs for authenticating using Google Accounts a fully featured local development environment scheduled tasks for triggering events at specifiedtimes and regular intervals47

References: Google App Engine http://code.google.com/appengine/48

References: Django49 http://www.djangoproject.com/ Sito del Progetto https://groups.google.com/forum/#!forum/django-it Google group Italiano di Django

References: Python http://www.python.org Sito ufficiale di Python http://www.python.it Sito ufficiale Python Italia ng.python Google group Italiano di Python http://forum.python-it.org Forum ( )official Python Italia http://www.pycon.it/ Python Italian Conference EuroPython 2011 – Florence, IT – across spring50

References: Titles51 The definitive guide toDjangoA. Holovaty and J.K.Moss, Apress

References: Titles52 Sviluppareapplicazioni web conDjango,Marco Beri,APOGEO

References: Titles53 Python,Marco Beri, APOGEOSerie Pocket

References: Titles54 Programming GoogleApp Engine,D. Sanderson,O'Reilly

And last. Want to get some actions? Let's do together a workingexample55

Django Included Apps django.contrib.auth An authentication system. django.contrib.contenttypes A framework for content types. django.contrib.sessions A session framework. django.contrib.sites A framework for managing multiple sites with one Django installation. django

Related Documents:

LM - “Biotecnologie Molecolari e Industriali” Classe LM-8 MSc - “Molecular and Industrial Biotechnology” Master group LM-8 www.biotecnologieindustriali.unina.it/it/ www.biotecnologieindustriali.unina.it/en/ May 2020 1 Biotecnologie

turn-key approach to tire digital twin multi-physical modelling: a journey from road data to XiL Flavio Farroni, PhD CEO & co-founder @ MegaRide Vehicle Dynamics researcher @ UniNa 2021 VI-grade ZERO PROTOTYPES SUMMIT - MAY 20th/21st, 2021. UniNa Vehicle Dynamics research group

Over the years, Microsoft has introduced new ASP.NET-based web frameworks to address web development trends. Some such web frameworks include ASP.NET MVC, ASP.NET Web Pages, and more recently ASP.NET Core. With each new framework, some have predicted the imminent decline of ASP.NET Web Forms and criticized it as an outdated, outmoded web framework.

patterns during design phase Frameworks Data Entry Frameworks, Business Rules Frameworks, etc. Design Patterns: Elements of Reuseable Object-Oriented Software By Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides COTS Best Practice I.e, Documentum, Crystal Enterprise, Oracle Security, SQL Server, etc. Focus on Frameworks

Frameworks Okay to start out with standard frameworks HOWEVER it is advisable to use case specific frameworks as you become more experienced DO NOT memorize and regurgitate frameworks; it shows on interviews Your framework should be unique and have depth (MECE) for the specific business problem (issue tree) It is okay to ask for some extra time; BCG

Web Services (As Per the New Syllabus 2018-19 of Mumbai University for Computer Science, Semester V) Prof. Kiran Gurbani . Java Tools and Frameworks for Building RESTful Web Services, JSON Message Format and Tools and Frameworks around JSON, Build RESTful Web Services with JAX-RS APIs, The Description and Discovery of RESTful Web Services .

Common Microsoft FrontPage tasks Work with and manage Web pages F8 Run the accessibility checker. CTRL N Create a new Web page. CTRL O Open a Web page. CTRL F4 Close a Web page. CTRL S Save a Web page. CTRL P Print a Web page. F5 Refresh a Web page; refresh the Folder List. CTRL TAB Switch between open Web pages. CTRL SHIFT B Preview a Web page .

This book is meant to provide a thorough introduction to Description Logics, equently,thebookisdividedintothreeparts: Part I introduces the theoretical foundations of Description Logics, addressing some of