Más contenido relacionado
La actualidad más candente (7)
Similar a Web Frameworks (20)
Web Frameworks
- 1. Together. Free your energies
Together. Free your
energies
Web Frameworks
Nicolas Bonamy
Cliquez pour modifier le style des sous-titres du masque
Alexandre Muzet
Samuel Massot
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 2. Agenda
• Introduction
• Framework requirements
• Existing frameworks
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 4. Framework (FW)
Facilitate software development by
allowing designers and programmers
to spend more time on meeting
software requirements rather than
dealing with the more standard low-
level details of providing a working
system.
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 5. FW’s B’s & C’s
• Benefits
Provides ready-to-use services to the development team
Promotes a standard way of doing things
New developers can get onboard more easily
• Concerns
Reduces freedom
Steep learning curve depending on the complexity of the FW
Should evolve as fast as the technology
• A good FW is a loosely coupled one where a component can easily be
replaced by another one providing the same service
• Dependency injection
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 6. Agenda
• Introduction
• Framework requirements
MVC
ORM
REST
Ajax
…
• Existing frameworks
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 7. Requirements
• Model-View-Controller (MVC) • Pluggable architecture
• Object-Relational Mapping • i18n and L10n support
(ORM) • Security
• Web Service support, REST • Steady performance
• Intuitive URLs (Routing) • Unit and non-regression testing
• Scaffolding (in model) • Agile development:
• Templating system (in views) KISS, CoC, DRY
• Ajax integration • Good documentation
• W3C Standards compliance • Active community
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 8. Integrated vs. Custom
Integrated Framework “Custom” Framework
SOAP
MVC ORM
ORM
SOAP Ajax MVC
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 9. MVC
• Architectural pattern that:
Isolates business logic from user interface
Enables TDD
Model
Manages application state
Exposes application functionality
View Controller
Renders the model Defines application behavior
Collects user inputs Maps user inputs to model updates
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 10. HMVC
Model
Controller
M
V C
M
V C
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 11. ORM
• Mapping from data stored in relational databases to
objects (as in OOP)
• Often a separated library integrated in a framework
SELECT * FROM user WHERE id=1
UPDATE user SET firstname='Nicolas' WHERE id=1
DELETE FROM user WHERE id=1
User user = GetItem(1);
user.Firstname = quot;Nicolasquot;;
SaveItem(user);
DeleteItem(user);
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 12. ORM – Features and Benefits
• Features
RDBMS independence through adapters
Proprietary object-oriented query language (HQL, DQL…)
Object caching (more or less advanced)
• Benefits
Much less code to write
Easy to work with relations (one-to-one, one-to-many, many-to-
one and many-to-many)
Really, MUCH LESS code to write
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 13. ORM – Concerns and solutions
• Concerns
Learning curve
Hit on performance (constructing trees of objects can be very
expensive in terms of CPU and I/O)
Hides SQL requests and hardens the optimization task
• Solutions
Lazy-loading of related objects
“Projections” allow to retrieve only selected parts of objects
Raw SQL and stored procedure calling have been implemented
on most ORMs
Only load objects when you need objects
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 14. Web service support
• Standards compliance:
XML-RPC
SOAP
WSDL
WS-*
• Code generation based on WSDL
• Automatic WSDL generation
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 15. REST
• REpresentational State Transfer
• Architecture style, not a standard
• Applies to web applications and web service
• Use of all HTTP verbs: GET, POST, PUT, DELETE
• URIs are meaningful and self sufficient
• Responses contain information to transfer to another
state (URIs of other resources):
http://www.acme.com/parts/list returns a list of parts with the
URI for each part
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 16. Intuitive URLs (routing, permalink)
http://www.myblog.com/post.php?id=123456
“URLs as part of the interface”
http://www.myblog.com/activity-breadown.html
• Rules for automatic matching and helpers to generate
user-friendly URLs easily
/controller/action/params
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 17. REST vs WS-*
• REST is a “lightweight” web service architecture
Not asynchronous
No transactions
No security profiles
• REST being enhanced to support more complex scenarios
Will probably get as tedious as WS-*
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 18. Scaffolding
• Automatic generation of all the code needed to perform
basic CRUD operations on entities
Model (SQL or ORM requests)
• Can be extended to generate
View (automatically generated pages and forms)
Controller (basic link between Model and View)
• Useful for back-office part of a solution
• Can be used as a starting point for the front-office but
will generally require lot of rework
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 19. Templating system
• Reusable pieces of codes to generate user interface
elements
• Better separation between design code and logic code
• Allows designer to easily work on HTML and CSS code
• Ensures consistency of appearance
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 20. Ajax Integration
• Asynchronous JavaScript and XML
XMLHttpRequest, XML, JSON
HTML, CSS, DOM and JavaScript
• Requirements
Helpers to generate Ajax code
Methods to serialize (list of) objects to XML or JSON
Compatible with popular Ajax frameworks
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 21. Ajax Frameworks
• Cross-browser XMLHttpRequest encapsulation
• DOM features
Selecting and traversing
Create, insert, remove
Attributes manipulation
Events handling
CSS Styling
• Widgets: window, dialog, tabs, carousel, accordion…
• Interactions: drag’n’drop, sorting…
• Effects and animations
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 23. Pluggable architecture
• Not all needs can be covered by the framework
• Leverage users community and open-source
development
• Example of plug-ins that can be found
Authentication system
Full-featured file upload module
Charts integration
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 24. i18N and L10n
• UTF-8 support at all levels
Database
MVC framework
XHTML
Ajax
• Hand-made or supports standards
gettext
XLIFF (XML Localization Interchange File Format)
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 25. Security
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 26. Performance
Performance
Features
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 27. Caching
• Browser caching (HTTP)
Expires, Last-modified, Cache-Control
Etag
• Response caching
Full pages
Fragments
• Database caching
Parsed queries
Results sets
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 28. Agenda
• Introduction
• Framework requirements
• Existing frameworks
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 29. Ruby on Rails (Rails, RoR)
• Built over the Ruby language
• First framework really built for Web 2.0
development
• Pushed the envelope of what a Web 2.0
development framework should be
• ORM: ActiveRecord (reused pattern)
• AJAX: prototype
• RESTful
• Agile
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 31. • Reference MVC Framework
• Released February 2007
• Struts 2 is the fusion of Struts 1 and Webwork
• Struts 2 actions are POJO
• Ajax taglibs Integration and widget customization
• Interceptors stack over HTTP request for pre/post
treatments
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 32. • Reference lightweight development container
• Layer separation (used in all layers)
• Enables POJO programming
• Transaction management
• Object lifeCycle management (dependency injection)
• Common frameworks integration (Hibernate, Struts)
• Very active community
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 33. • Reference ORM Framework
• Database independence
• POJO Programming
• Automated database model generation
• Advanced cache management
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 35. • Has recently entered the MVC/ORM framework world
• Use of PHP framework requires setup of a PHP code
cache mechanism (APC, eAccelerator…)
• Frameworks
Zend CakePHP
Symfony CodeIgniter
• ORM
Propel
Doctrine
ADOdb
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 36. • Zend: main commercial actor of PHP world
• PHP5 only (PHP4 object model too weak)
• Usage is “open source” but not contribution
• Very loosely coupled framework: “Use-at-will”
• Own ORM: “Table gateway”
• XLIFF based i18n and L10n
• Integrated in Zend Studio IDE
• Numerous references (M6, Nokia…)
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 37. • Initially built and now sponsored by Sensio Labs
• PHP5 only (PHP4 object model too weak)
• Open source framework (MIT license)
• Loosely coupled architecture (going forward):
Easy ORM switch (Propel or Doctrine)
Easy JavaScript toolkit switch (1.2)
• XLIFF based i18n and L10n
• References
Yahoo! Answers (130M users), Yahoo! Bookmarks (20M users)
Dailymotion
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 39. • .NET is not a framework !
• ASP.NET is a framework
Not MVC compliant
Very hard to test ASPX pages
No scaffolding
No ORM equivalent technology
• ADO.NET’s DataSet
• LINQ (query language)
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 40. Data access
• Microsoft Entity Framework
Available since .NET 3.5 SP1
Real ORM ?
• NHibernate
.NET port of Java Hibernate
Lagging behind but still very functional
LINQ support
• Subsonic
developer hired by Microsoft
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 41. Solutions
• Castle Project
Inspired by RoR
MVC Framework : MonoRail
• Supports routing
• AJAX via prototype
ORM : ActiveRecord built on top of NHibernate
Aspect oriented programming and Inversion of Control
• ASP.NET MVC Framework
Microsoft stuff, beta stage
ASP.NET AJAX
Routing
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 42. Tentative framework
• ASP.NET MVC
• NHibernate, optionally coupled with
Castle ActiveRecord: use .NET’s [Attributes] instead of XML
mapping files
• ASP.NET Ajax
Official integration of jQuery announced recently
• Industrialization
Visual Studio Team System 2010
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved
- 43. References
Resource URL
MVC, ORM, SOAP, REST… http://en.wikipedia.org
Struts2 http://struts.apache.org/
Spring Framework http://www.springframework.org/
ASP.NET MVC http://www.asp.net/mvc/, http://weblogs.asp.net/scottgu/
Hibernate, NHibernate http://www.hibernate.org, http://www.hibernate.org/343.html
Livre blanc sur les frameworks PHP http://tinyurl.com/php-frameworks
Zend Framework http://framework.zend.com/
Symfony http://www.symfony-project.org
TS, Web 2.0
Together. Free your energies Nicolas Bonamy
© 2008 Capgemini. All rights reserved