SlideShare ist ein Scribd-Unternehmen logo
1 von 55
Downloaden Sie, um offline zu lesen
Web Frameworks
              web development done right


Course of Web Technologies
A.A. 2010/2011
              Valerio Maggio, PhD Student
                     Prof.ssa Anna Corazza
Outline
                                         2


► Web technologies evolution

► Web frameworks
  ○ Design Principles

► Case Study
  ○ Django and GAE (Google App Engine)

► Working Example
Intruduction
                                               3


► Nowadays frameworks has become a
  buzzword
  ○ Software framework
  ○ Web framework
  ○ Development framework
  ○…


► So, what do you expect a web framework is?
1. Web Technologies
     Evolution



                      4
Web: Evolution Roadmap
            1                                5

       HTML Pages


 HTML 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 scalable
Web: Evolution Roadmap
       HTML Pages        2                         6

                    CGI Scripting

 CGI – 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 curve
CGI Perl Example
                                            7




► What are pros and cons of these two CGI
 examples ?
Web: Evolution Roadmap
                   CGI Scripting        3               8

      HTML Pages                   PHP like languages

 PHP like solutions
► (+) Learning curve extremely shallow
 ○ Code directly embedded into HTML


► (-) No security and/or protection mechanism
 provided

► (?) Bunch of HTML, (Business Logic) Code,
 (Data) SQL code all together
JSP Example: Pros and Cons ?
                               9
Web: Evolution Roadmap
                                 PHP, ASP, JSP, ...   4                         10

        HTML Pages   CGI Scripting             RIA 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 Frameworks
CMS: Content Management
System                                         11




► Aim to manage work-flows and contents in a
  collaborative environment

► Designed to simplify the publication of
  contents to web sites and mobile devices

► Examples: Joomla, Drupal, Wordpress, ….
Web frameworks
                                                     12




► Aim to alleviate the overhead associated with
  common Web development
  ○ Databases, templates, sessions, …

► Designed to support the development of dynamic
  websites, 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 the
 Content-type?
► Is this code reusable in multiple environments with different DB
 connection parameters?
►What happens when a web designer have to redesign the page?
Web Frameworks in a nutshell
                                               14


► These problems are exactly what a web
  frameworks tries to solve

► Web frameworks provides a programming
  infrastructure for applications

► Focus on developing code without having to
  reinvent the wheel
2. Web Frameworks Design
        Principles



                           15
CGI Architecture Model
                                          16




 Presentation and        Business Logic
 Visualization

                    Data and Models
CGI Architecture Model
                                                    17


► Task centric architecture (a.k.a. Model 1)
  ○ Difficult reusability and maintenance of code
  ○ Requires different skill-sets


  High coupling among:
► Presentation (View)
  ○ How to show data
► Processing (Controller)
  ○ What information to show
► Data Acquisition (Model)
  ○ What information to extract (from DB)
Model 1 Architecture (Java)
                                              18




 ► Processing delegates as JSP and Servlets

 ► Is there any difference between CGI and
   Servlet?
MVC Architecture Model
                                                                      19


                                          ► Model:
                                            ○ Manages domain and
                                              data acquisition


                                          ► View:
                                            ○ Manages the
                                              visualization of data


                                          ► Controller:
                                            ○ Manages domain and
                                              data processing



Q: Do you think this model is feasible to be used on the web as is?
Web-MVC Architecture Model
                                                                  20


                                      ► Model:
                                        ○ Manages domain and
                                          data acquisition


                                      ► View:
                                        ○ Manages the
                                          visualization of data


                                      ► Controller:
                                        ○ Manages domain and
                                          data processing



A: No (direct) relationship between the view and the model
Model 2 Architecture (Java)
                                             21


                         ► Model:
                              ○ EJB and
                                Javabeans

                         ► View:
                              ○ JSP and JFaces

                         ► Controller:
                              ○ Servlets
Fulll-stack web frameworks
                                                       22


► From Python.org wiki:

 [..] frameworks provide support for a number of
 activities such as interpreting requests, producing
 responses, storing data persistently, and so on.
 [..] those frameworks [..] are often known as full-
 stack frameworks in that they attempt to supply
 components for each layer in the stack.

► So, what are such components?
Web Frameworks Capabilities
                                           23


► View
  ○ JavaScript Library
  ○ Template Engine and View Composition
  ○ Development Server
► Controller
  ○ URL Routing
  ○ Controller-view Association
► Model
  ○ Database Abstraction
  ○ ORM (Object Relational Mapping)
Database Access
                                                 24




► Distributed Access
  Logic (JSP, Servlets)   ► Centralized Access
                            Logic
► Q: How easy is modify
  the db schema?
Active Record pattern                               25



                           ► An object
                             encapsulates both
                             data and behavior


                           ► Put data access logic
                             in the domain object
http://martinfowler.com/eaaCatalog/activeRecord.html
Heavy-weight vs Light-weight
Frameworks                                             26


► 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, Scala
H-W Java frameworks: Struts
                              27
H-W Java frameworks: Hibernate
                                 28
Design Principles
                                                                      29


► Convention over configuration
  ○ “Convention over Configuration is a programming design that favors
    following a certain set of programming conventions instead of
    configuring an application framework. [...]”


► DRY (Don't repeat yourself)

  ○ “DRY is a principle that focuses on reducing information duplication
    by keeping any piece of knowledge in a system in only one place.
3. Case Study:
   Django and
Google App Engine



                    30
Frameworks and Languages
                           31
Python Programming Language
                                                          32

“Speed and flexibility of development are critical.
Dynamic languages let you get more done with less lines
of code (which means less bugs)”

                                 ► Object oriented
                                   languages

                                 ► Clean and simple
                                   syntax
                                    ○ Strong Typed
                                    ○ Dynamic Typed
Python Programming Language
                                         33


► Is there someone that uses
  python in professional
  projects?
  ○ IBM, Google, Sun, HP, Industrial
    Light and Magic, NASA, Microsoft

► Goggle it:
    ● site:microsoft.com python
    ● You'll get more than 9 thousands
      results
Python:
Language of the year 2010                                                          34

Programming language Python has become programming
language of 2010. This award is given to the programming
language that gained most market share in 2010.
Python grew 1.81% since January 2010. This is a bit more
than runner up Objective-C (+1.63%).
Objective-C was favorite for the title for a long time thanks
to the popularity of Apple's iPhone and iPad platforms.
However, it lost too much popularity the last couples of
months.


Python has become the "de facto" standard in system
scripting (being a successor of Perl in this), but it is used for
much more different types of application areas nowadays.            Source: tiobe.com
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 are
using Python to teach programming languages.
TIOBE: Programming Languages
ranking                              35




              http://www.tiobe.com
Python Dynamic Typing
                                               36



 “Duck Typing”           def half (n):
                              return n/2.0
  Walks like a duck?

  Quacks like a duck? Q: What is the type of
                         variable n?
  It's a duck!
Django web framework                  37



Design characteristics

► Model-View-Controller for the Web

► Written in Python

► Explicit instead of implicit

► Loose Coupling

► Don't repeat yourself
Django Architecture Model
                                                      38


► 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               39


► Database wrapper (ORM)

► URL dispatcher

► Template system

► Admin Framework

► I18n & l10n

► Authentication

► RSS

► .....
Projects and Applications
                                                   40



► Projects:
   ○ Composed by different applications
   ○ Glued together by unique configuration file

► Applications:
  ○ Set of portable functionalities
  ○ Code is more reusable
  ○ Django Plugables
     ● (djangoplugables.com)
URL Dispatcher                                41



► Loose coupling principle between URLs and
 Views
 ○ Based on regular expressions
Template Language
                                          42


► 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 Reuse
Template Language (2)
► Template Inheritance                43
 ○ Templates are composed by Blocks
Template Language (3)
                                                      44


► Variables: {{    variable_name }}

► Tags: {%   template_tag %}

  ○ Board definition: Tags tell the framework to do
    something

► Filters: {{   variable|filter }}

  ○ Alters the formatting of variables
Django Admin Framework

                                        45




►So called Killer-application
►Compliant with Active record Pattern
Django Included Apps
                                                              46


► 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.contrib.messages
  ○ A messaging framework.
Google App Engine
                                                       47

► 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 specified
  times and regular intervals
References: Google App Engine
                                      48


► http://code.google.com/appengine/
References: Django
                                                  49


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


► http://www.python.org
   ○ Sito ufficiale di Python
► http://www.python.it
   ○ Sito ufficiale Python Italia
► https://groups.google.com/forum/#!forum/it.comp.lang.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 spring
References: Titles
                                            51




                     ► The definitive guide to
                       Django
                       A. Holovaty and J.K.
                       Moss, Apress
References: Titles
                                          52




                     ► Sviluppare
                       applicazioni web con
                       Django,
                       Marco Beri,APOGEO
References: Titles
                                        53




                     ► Python,
                       Marco Beri, APOGEO
                       Serie Pocket
References: Titles
                                           54




                     ► Programming Google
                       App Engine,
                       D. Sanderson,O'Reilly
And last...             55


►Want to get some actions?

►Let's do together a working
 example

Weitere ähnliche Inhalte

Ähnlich wie Here are some key reasons why Python was named programming language of the year in 2010:- Strong growth in market share of 1.81% during 2010, more than other languages like Objective-C. This indicated rising popularity and adoption.- Python is a versatile, easy to learn language suitable for both small scripts and large applications. This broadens its appeal and use cases. - Major tech companies like Google, IBM, Microsoft were increasingly using Python for projects, raising its profile. This led more developers to consider it.- The release of Python 3.0 in 2008 made it a modern language with improved features, driving more interest and standardization around the latest version.- Its simplicity, readability

WWW/Internet 2011 - A Framework for Web 2.0 Secure Widgets
WWW/Internet 2011 - A Framework for Web 2.0 Secure WidgetsWWW/Internet 2011 - A Framework for Web 2.0 Secure Widgets
WWW/Internet 2011 - A Framework for Web 2.0 Secure WidgetsVagner Santana
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsPiyush Katariya
 
Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Kwame Porter Robinson
 
Comparing Orchestration
Comparing OrchestrationComparing Orchestration
Comparing OrchestrationKnoldus Inc.
 
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...Ambassador Labs
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkAlive Kuo
 
NoSQL Data Modeling Foundations — Introducing Concepts & Principles
NoSQL Data Modeling Foundations — Introducing Concepts & PrinciplesNoSQL Data Modeling Foundations — Introducing Concepts & Principles
NoSQL Data Modeling Foundations — Introducing Concepts & PrinciplesScyllaDB
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studypeter_ibuildings
 
Netflix Container Scheduling and Execution - QCon New York 2016
Netflix Container Scheduling and Execution - QCon New York 2016Netflix Container Scheduling and Execution - QCon New York 2016
Netflix Container Scheduling and Execution - QCon New York 2016aspyker
 
Scheduling a fuller house - Talk at QCon NY 2016
Scheduling a fuller house - Talk at QCon NY 2016Scheduling a fuller house - Talk at QCon NY 2016
Scheduling a fuller house - Talk at QCon NY 2016Sharma Podila
 
Designing for operability and managability
Designing for operability and managabilityDesigning for operability and managability
Designing for operability and managabilityGaurav Bahrani
 
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB
 
Free GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOpsFree GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOpsWeaveworks
 
full stack interview questions.pdf
full stack interview questions.pdffull stack interview questions.pdf
full stack interview questions.pdfFull stack campus
 
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...NRB
 
OpenEBS hangout #4
OpenEBS hangout #4OpenEBS hangout #4
OpenEBS hangout #4OpenEBS
 
Automatic image moderation in classifieds
Automatic image moderation in classifiedsAutomatic image moderation in classifieds
Automatic image moderation in classifiedsJaroslaw Szymczak
 
Automatic image moderation in classifieds, Jarosław Szymczak
Automatic image moderation in classifieds, Jarosław SzymczakAutomatic image moderation in classifieds, Jarosław Szymczak
Automatic image moderation in classifieds, Jarosław SzymczakPôle Systematic Paris-Region
 
Nordics Edition - The Neo4j Graph Data Platform Today & Tomorrow
Nordics Edition - The Neo4j Graph Data Platform Today & TomorrowNordics Edition - The Neo4j Graph Data Platform Today & Tomorrow
Nordics Edition - The Neo4j Graph Data Platform Today & TomorrowNeo4j
 
Agile Modelling Architecture
Agile Modelling ArchitectureAgile Modelling Architecture
Agile Modelling Architecturepierino23
 

Ähnlich wie Here are some key reasons why Python was named programming language of the year in 2010:- Strong growth in market share of 1.81% during 2010, more than other languages like Objective-C. This indicated rising popularity and adoption.- Python is a versatile, easy to learn language suitable for both small scripts and large applications. This broadens its appeal and use cases. - Major tech companies like Google, IBM, Microsoft were increasingly using Python for projects, raising its profile. This led more developers to consider it.- The release of Python 3.0 in 2008 made it a modern language with improved features, driving more interest and standardization around the latest version.- Its simplicity, readability (20)

WWW/Internet 2011 - A Framework for Web 2.0 Secure Widgets
WWW/Internet 2011 - A Framework for Web 2.0 Secure WidgetsWWW/Internet 2011 - A Framework for Web 2.0 Secure Widgets
WWW/Internet 2011 - A Framework for Web 2.0 Secure Widgets
 
JavaScript for Enterprise Applications
JavaScript for Enterprise ApplicationsJavaScript for Enterprise Applications
JavaScript for Enterprise Applications
 
Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler
 
Comparing Orchestration
Comparing OrchestrationComparing Orchestration
Comparing Orchestration
 
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
Montreal Kubernetes Meetup: Developer-first workflows (for microservices) on ...
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
NoSQL Data Modeling Foundations — Introducing Concepts & Principles
NoSQL Data Modeling Foundations — Introducing Concepts & PrinciplesNoSQL Data Modeling Foundations — Introducing Concepts & Principles
NoSQL Data Modeling Foundations — Introducing Concepts & Principles
 
Surviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-studySurviving a Plane Crash, a NU.nl case-study
Surviving a Plane Crash, a NU.nl case-study
 
Netflix Container Scheduling and Execution - QCon New York 2016
Netflix Container Scheduling and Execution - QCon New York 2016Netflix Container Scheduling and Execution - QCon New York 2016
Netflix Container Scheduling and Execution - QCon New York 2016
 
Scheduling a fuller house - Talk at QCon NY 2016
Scheduling a fuller house - Talk at QCon NY 2016Scheduling a fuller house - Talk at QCon NY 2016
Scheduling a fuller house - Talk at QCon NY 2016
 
Designing for operability and managability
Designing for operability and managabilityDesigning for operability and managability
Designing for operability and managability
 
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB AtlasMongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
MongoDB World 2019: Packing Up Your Data and Moving to MongoDB Atlas
 
Free GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOpsFree GitOps Workshop + Intro to Kubernetes & GitOps
Free GitOps Workshop + Intro to Kubernetes & GitOps
 
full stack interview questions.pdf
full stack interview questions.pdffull stack interview questions.pdf
full stack interview questions.pdf
 
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
The NRB Group mainframe day 2021 - Containerisation on Z - Paul Pilotto - Seb...
 
OpenEBS hangout #4
OpenEBS hangout #4OpenEBS hangout #4
OpenEBS hangout #4
 
Automatic image moderation in classifieds
Automatic image moderation in classifiedsAutomatic image moderation in classifieds
Automatic image moderation in classifieds
 
Automatic image moderation in classifieds, Jarosław Szymczak
Automatic image moderation in classifieds, Jarosław SzymczakAutomatic image moderation in classifieds, Jarosław Szymczak
Automatic image moderation in classifieds, Jarosław Szymczak
 
Nordics Edition - The Neo4j Graph Data Platform Today & Tomorrow
Nordics Edition - The Neo4j Graph Data Platform Today & TomorrowNordics Edition - The Neo4j Graph Data Platform Today & Tomorrow
Nordics Edition - The Neo4j Graph Data Platform Today & Tomorrow
 
Agile Modelling Architecture
Agile Modelling ArchitectureAgile Modelling Architecture
Agile Modelling Architecture
 

Mehr von Valerio Maggio

Unsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detectionUnsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detectionValerio Maggio
 
Improving Software Maintenance using Unsupervised Machine Learning techniques
Improving Software Maintenance using Unsupervised Machine Learning techniquesImproving Software Maintenance using Unsupervised Machine Learning techniques
Improving Software Maintenance using Unsupervised Machine Learning techniquesValerio Maggio
 
Number Crunching in Python
Number Crunching in PythonNumber Crunching in Python
Number Crunching in PythonValerio Maggio
 
Clone detection in Python
Clone detection in PythonClone detection in Python
Clone detection in PythonValerio Maggio
 
Machine Learning for Software Maintainability
Machine Learning for Software MaintainabilityMachine Learning for Software Maintainability
Machine Learning for Software MaintainabilityValerio Maggio
 
LINSEN an efficient approach to split identifiers and expand abbreviations
LINSEN an efficient approach to split identifiers and expand abbreviationsLINSEN an efficient approach to split identifiers and expand abbreviations
LINSEN an efficient approach to split identifiers and expand abbreviationsValerio Maggio
 
A Tree Kernel based approach for clone detection
A Tree Kernel based approach for clone detectionA Tree Kernel based approach for clone detection
A Tree Kernel based approach for clone detectionValerio Maggio
 
Refactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeRefactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeValerio Maggio
 
Scaffolding with JMock
Scaffolding with JMockScaffolding with JMock
Scaffolding with JMockValerio Maggio
 
Unit testing with Junit
Unit testing with JunitUnit testing with Junit
Unit testing with JunitValerio Maggio
 
Design patterns and Refactoring
Design patterns and RefactoringDesign patterns and Refactoring
Design patterns and RefactoringValerio Maggio
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentValerio Maggio
 
Unit testing and scaffolding
Unit testing and scaffoldingUnit testing and scaffolding
Unit testing and scaffoldingValerio Maggio
 

Mehr von Valerio Maggio (14)

Unsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detectionUnsupervised Machine Learning for clone detection
Unsupervised Machine Learning for clone detection
 
Improving Software Maintenance using Unsupervised Machine Learning techniques
Improving Software Maintenance using Unsupervised Machine Learning techniquesImproving Software Maintenance using Unsupervised Machine Learning techniques
Improving Software Maintenance using Unsupervised Machine Learning techniques
 
Number Crunching in Python
Number Crunching in PythonNumber Crunching in Python
Number Crunching in Python
 
Clone detection in Python
Clone detection in PythonClone detection in Python
Clone detection in Python
 
Machine Learning for Software Maintainability
Machine Learning for Software MaintainabilityMachine Learning for Software Maintainability
Machine Learning for Software Maintainability
 
LINSEN an efficient approach to split identifiers and expand abbreviations
LINSEN an efficient approach to split identifiers and expand abbreviationsLINSEN an efficient approach to split identifiers and expand abbreviations
LINSEN an efficient approach to split identifiers and expand abbreviations
 
A Tree Kernel based approach for clone detection
A Tree Kernel based approach for clone detectionA Tree Kernel based approach for clone detection
A Tree Kernel based approach for clone detection
 
Refactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeRefactoring: Improve the design of existing code
Refactoring: Improve the design of existing code
 
Scaffolding with JMock
Scaffolding with JMockScaffolding with JMock
Scaffolding with JMock
 
Junit in action
Junit in actionJunit in action
Junit in action
 
Unit testing with Junit
Unit testing with JunitUnit testing with Junit
Unit testing with Junit
 
Design patterns and Refactoring
Design patterns and RefactoringDesign patterns and Refactoring
Design patterns and Refactoring
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Unit testing and scaffolding
Unit testing and scaffoldingUnit testing and scaffolding
Unit testing and scaffolding
 

Kürzlich hochgeladen

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Kürzlich hochgeladen (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Here are some key reasons why Python was named programming language of the year in 2010:- Strong growth in market share of 1.81% during 2010, more than other languages like Objective-C. This indicated rising popularity and adoption.- Python is a versatile, easy to learn language suitable for both small scripts and large applications. This broadens its appeal and use cases. - Major tech companies like Google, IBM, Microsoft were increasingly using Python for projects, raising its profile. This led more developers to consider it.- The release of Python 3.0 in 2008 made it a modern language with improved features, driving more interest and standardization around the latest version.- Its simplicity, readability

  • 1. Web Frameworks web development done right Course of Web Technologies A.A. 2010/2011 Valerio Maggio, PhD Student Prof.ssa Anna Corazza
  • 2. Outline 2 ► Web technologies evolution ► Web frameworks ○ Design Principles ► Case Study ○ Django and GAE (Google App Engine) ► Working Example
  • 3. Intruduction 3 ► Nowadays frameworks has become a buzzword ○ Software framework ○ Web framework ○ Development framework ○… ► So, what do you expect a web framework is?
  • 4. 1. Web Technologies Evolution 4
  • 5. Web: Evolution Roadmap 1 5 HTML Pages HTML 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 scalable
  • 6. Web: Evolution Roadmap HTML Pages 2 6 CGI Scripting CGI – 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 curve
  • 7. CGI Perl Example 7 ► What are pros and cons of these two CGI examples ?
  • 8. Web: Evolution Roadmap CGI Scripting 3 8 HTML Pages PHP like languages PHP like solutions ► (+) Learning curve extremely shallow ○ Code directly embedded into HTML ► (-) No security and/or protection mechanism provided ► (?) Bunch of HTML, (Business Logic) Code, (Data) SQL code all together
  • 9. JSP Example: Pros and Cons ? 9
  • 10. Web: Evolution Roadmap PHP, ASP, JSP, ... 4 10 HTML Pages CGI Scripting RIA 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 Frameworks
  • 11. CMS: Content Management System 11 ► Aim to manage work-flows and contents in a collaborative environment ► Designed to simplify the publication of contents to web sites and mobile devices ► Examples: Joomla, Drupal, Wordpress, ….
  • 12. Web frameworks 12 ► Aim to alleviate the overhead associated with common Web development ○ Databases, templates, sessions, … ► Designed to support the development of dynamic websites, web applications and web services ► Examples: Struts, Spring, Ruby on Rails, Django, Google App Engine, ...
  • 13. 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 the Content-type? ► Is this code reusable in multiple environments with different DB connection parameters? ►What happens when a web designer have to redesign the page?
  • 14. Web Frameworks in a nutshell 14 ► These problems are exactly what a web frameworks tries to solve ► Web frameworks provides a programming infrastructure for applications ► Focus on developing code without having to reinvent the wheel
  • 15. 2. Web Frameworks Design Principles 15
  • 16. CGI Architecture Model 16 Presentation and Business Logic Visualization Data and Models
  • 17. CGI Architecture Model 17 ► Task centric architecture (a.k.a. Model 1) ○ Difficult reusability and maintenance of code ○ Requires different skill-sets High coupling among: ► Presentation (View) ○ How to show data ► Processing (Controller) ○ What information to show ► Data Acquisition (Model) ○ What information to extract (from DB)
  • 18. Model 1 Architecture (Java) 18 ► Processing delegates as JSP and Servlets ► Is there any difference between CGI and Servlet?
  • 19. MVC Architecture Model 19 ► Model: ○ Manages domain and data acquisition ► View: ○ Manages the visualization of data ► Controller: ○ Manages domain and data processing Q: Do you think this model is feasible to be used on the web as is?
  • 20. Web-MVC Architecture Model 20 ► Model: ○ Manages domain and data acquisition ► View: ○ Manages the visualization of data ► Controller: ○ Manages domain and data processing A: No (direct) relationship between the view and the model
  • 21. Model 2 Architecture (Java) 21 ► Model: ○ EJB and Javabeans ► View: ○ JSP and JFaces ► Controller: ○ Servlets
  • 22. Fulll-stack web frameworks 22 ► From Python.org wiki: [..] frameworks provide support for a number of activities such as interpreting requests, producing responses, storing data persistently, and so on. [..] those frameworks [..] are often known as full- stack frameworks in that they attempt to supply components for each layer in the stack. ► So, what are such components?
  • 23. Web Frameworks Capabilities 23 ► View ○ JavaScript Library ○ Template Engine and View Composition ○ Development Server ► Controller ○ URL Routing ○ Controller-view Association ► Model ○ Database Abstraction ○ ORM (Object Relational Mapping)
  • 24. Database Access 24 ► Distributed Access Logic (JSP, Servlets) ► Centralized Access Logic ► Q: How easy is modify the db schema?
  • 25. Active Record pattern 25 ► An object encapsulates both data and behavior ► Put data access logic in the domain object http://martinfowler.com/eaaCatalog/activeRecord.html
  • 26. Heavy-weight vs Light-weight Frameworks 26 ► 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, Scala
  • 27. H-W Java frameworks: Struts 27
  • 28. H-W Java frameworks: Hibernate 28
  • 29. Design Principles 29 ► Convention over configuration ○ “Convention over Configuration is a programming design that favors following a certain set of programming conventions instead of configuring an application framework. [...]” ► DRY (Don't repeat yourself) ○ “DRY is a principle that focuses on reducing information duplication by keeping any piece of knowledge in a system in only one place.
  • 30. 3. Case Study: Django and Google App Engine 30
  • 32. Python Programming Language 32 “Speed and flexibility of development are critical. Dynamic languages let you get more done with less lines of code (which means less bugs)” ► Object oriented languages ► Clean and simple syntax ○ Strong Typed ○ Dynamic Typed
  • 33. Python Programming Language 33 ► Is there someone that uses python in professional projects? ○ IBM, Google, Sun, HP, Industrial Light and Magic, NASA, Microsoft ► Goggle it: ● site:microsoft.com python ● You'll get more than 9 thousands results
  • 34. Python: Language of the year 2010 34 Programming language Python has become programming language of 2010. This award is given to the programming language that gained most market share in 2010. Python grew 1.81% since January 2010. This is a bit more than runner up Objective-C (+1.63%). Objective-C was favorite for the title for a long time thanks to the popularity of Apple's iPhone and iPad platforms. However, it lost too much popularity the last couples of months. Python has become the "de facto" standard in system scripting (being a successor of Perl in this), but it is used for much more different types of application areas nowadays. Source: tiobe.com 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 are using Python to teach programming languages.
  • 35. TIOBE: Programming Languages ranking 35 http://www.tiobe.com
  • 36. Python Dynamic Typing 36 “Duck Typing” def half (n): return n/2.0 Walks like a duck? Quacks like a duck? Q: What is the type of variable n? It's a duck!
  • 37. Django web framework 37 Design characteristics ► Model-View-Controller for the Web ► Written in Python ► Explicit instead of implicit ► Loose Coupling ► Don't repeat yourself
  • 38. Django Architecture Model 38 ► 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
  • 39. Django Stack 39 ► Database wrapper (ORM) ► URL dispatcher ► Template system ► Admin Framework ► I18n & l10n ► Authentication ► RSS ► .....
  • 40. Projects and Applications 40 ► Projects: ○ Composed by different applications ○ Glued together by unique configuration file ► Applications: ○ Set of portable functionalities ○ Code is more reusable ○ Django Plugables ● (djangoplugables.com)
  • 41. URL Dispatcher 41 ► Loose coupling principle between URLs and Views ○ Based on regular expressions
  • 42. Template Language 42 ► 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 Reuse
  • 43. Template Language (2) ► Template Inheritance 43 ○ Templates are composed by Blocks
  • 44. Template Language (3) 44 ► Variables: {{ variable_name }} ► Tags: {% template_tag %} ○ Board definition: Tags tell the framework to do something ► Filters: {{ variable|filter }} ○ Alters the formatting of variables
  • 45. Django Admin Framework 45 ►So called Killer-application ►Compliant with Active record Pattern
  • 46. Django Included Apps 46 ► 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.contrib.messages ○ A messaging framework.
  • 47. Google App Engine 47 ► 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 specified times and regular intervals
  • 48. References: Google App Engine 48 ► http://code.google.com/appengine/
  • 49. References: Django 49 ► http://www.djangoproject.com/ ○ Sito del Progetto ► https://groups.google.com/forum/#!forum/django-it ○ Google group Italiano di Django
  • 50. References: Python 50 ► http://www.python.org ○ Sito ufficiale di Python ► http://www.python.it ○ Sito ufficiale Python Italia ► https://groups.google.com/forum/#!forum/it.comp.lang.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 spring
  • 51. References: Titles 51 ► The definitive guide to Django A. Holovaty and J.K. Moss, Apress
  • 52. References: Titles 52 ► Sviluppare applicazioni web con Django, Marco Beri,APOGEO
  • 53. References: Titles 53 ► Python, Marco Beri, APOGEO Serie Pocket
  • 54. References: Titles 54 ► Programming Google App Engine, D. Sanderson,O'Reilly
  • 55. And last... 55 ►Want to get some actions? ►Let's do together a working example