1
Web ¡Applica+on ¡Frameworks ¡
¡ Jay ¡Urbain, ¡Ph.D. ¡
Credits: ¡ ¡ www ¡ h6p://en.wikipedia.org/ ¡ Ma5 ¡Raible: ¡h6p://raibledesigns.com ¡ h6p://www.techempower.com/benchmarks ¡ ¡ ¡
Web Applica+on Frameworks Jay Urbain, Ph.D. Credits: - - PowerPoint PPT Presentation
Web Applica+on Frameworks Jay Urbain, Ph.D. Credits: www h6p://en.wikipedia.org/ Ma5 Raible: h6p://raibledesigns.com h6p://www.techempower.com/benchmarks 1 2
1
Credits: ¡ ¡ www ¡ h6p://en.wikipedia.org/ ¡ Ma5 ¡Raible: ¡h6p://raibledesigns.com ¡ h6p://www.techempower.com/benchmarks ¡ ¡ ¡
2
3
4
the ¡OPENSTEP ¡framework ¡developed ¡at ¡NeXT. ¡
GNOME, ¡KDE, ¡NetBeans, ¡and ¡Eclipse ¡projects. ¡
Macintosh, ¡and ¡Windows ¡from ¡the ¡same ¡source ¡code: ¡Qt, ¡the ¡widget ¡ toolkits ¡wxWidgets, ¡FOX ¡toolkit, ¡or ¡Eclipse ¡RCP. ¡
producing ¡Java-‑oriented ¡systems. ¡
5
6
hand-‑coded ¡HTML ¡that ¡was ¡published ¡on ¡web ¡servers. ¡ ¡ ¡ – Any ¡modificaEons ¡to ¡published ¡pages ¡needed ¡to ¡be ¡performed ¡by ¡the ¡ pages' ¡author. ¡ ¡
Gateway ¡Interface ¡(CGI) ¡standard ¡was ¡introduced ¡for ¡interfacing ¡external ¡ applicaEons ¡with ¡web ¡servers. ¡ – CGI ¡could ¡adversely ¡affect ¡server ¡load, ¡though, ¡since ¡each ¡request ¡had ¡ to ¡start ¡a ¡separate ¡process. ¡
7
high ¡traffic ¡web ¡applicaEons. ¡ ¡ – The ¡Apache ¡HTTP ¡Server ¡supports ¡modules ¡that ¡can ¡extend ¡the ¡web ¡ server ¡with ¡arbitrary ¡code ¡execuEons ¡(e.g., ¡as ¡Mod ¡Perl). ¡ – Some ¡web ¡servers ¡(e.g., ¡Apache ¡Tomcat) ¡were ¡specifically ¡designed ¡to ¡ handle ¡dynamic ¡content ¡by ¡execuEng ¡code ¡wri6en ¡in ¡some ¡languages ¡ (e.g., ¡Java). ¡ – Around ¡the ¡same ¡Eme, ¡new ¡languages ¡were ¡being ¡developed ¡ specifically ¡for ¡use ¡on ¡the ¡web ¡such ¡as ¡ColdFusion, ¡PHP ¡and ¡AcEve ¡ Server ¡Pages. ¡
8
have ¡libraries ¡to ¡help ¡with ¡common ¡tasks. ¡
aggregated ¡libraries ¡and ¡provide ¡a ¡structure ¡(architectural ¡approach) ¡ useful ¡for ¡web ¡development. ¡ ¡
– ASP.NET, ¡Java ¡EE ¡(Servlets), ¡WebObjects, ¡web2py, ¡OpenACS, ¡Catalyst, ¡ Mojolicious, ¡Ruby ¡on ¡Rails, ¡Django, ¡Zend ¡Framework, ¡Yii, ¡CakePHP ¡and ¡ Symfony, ¡etc. ¡
9
Model–view–controller ¡(MVC) ¡ ¡
the ¡data ¡model ¡with ¡business ¡rules ¡from ¡the ¡user ¡interface. ¡ ¡
and ¡allows ¡mulEple ¡interfaces ¡to ¡be ¡applied. ¡ ¡
as ¡web ¡pages ¡for ¡humans, ¡and ¡web ¡service ¡interfaces ¡for ¡mobile ¡and ¡other ¡ remote ¡applicaEons. ¡
10
based." ¡ ¡
and ¡then ¡"push" ¡the ¡data ¡to ¡the ¡view ¡layer ¡to ¡render ¡the ¡results. ¡
implementa&on. ¡
Play, ¡CodeIgniter, ¡and ¡Struts2. ¡
11
SomeEmes ¡called ¡"component-‑based." ¡
from ¡mulEple ¡controllers/sources ¡as ¡needed. ¡In ¡this ¡architecture, ¡mulEple ¡ controllers ¡can ¡be ¡involved ¡with ¡a ¡single ¡view. ¡ ¡
12
– PresentaEon ¡can ¡be ¡generated ¡server-‑ ¡or ¡client ¡slide. ¡
– Business ¡logic ¡ – Data ¡
– Client ¡interacEon, ¡separates ¡Model ¡from ¡View ¡
13
– Code ¡that ¡generates ¡the ¡HTML ¡can ¡do ¡this ¡based ¡on ¡variables ¡in ¡a ¡ template, ¡or ¡on ¡code. ¡
– Reduce ¡bandwidth, ¡server ¡load, ¡and ¡latency. ¡ ¡ – A ¡web ¡cache ¡stores ¡copies ¡of ¡documents ¡passing ¡through ¡it. ¡ ¡ – Subsequent ¡requests ¡may ¡be ¡saEsfied ¡from ¡the ¡cache ¡if ¡certain ¡ condiEons ¡are ¡met. ¡ ¡
– ¡AuthenEcaEon ¡and ¡authorizaEon ¡frameworks ¡that ¡enable ¡the ¡web ¡ server ¡to ¡idenEfy ¡the ¡users ¡of ¡the ¡applicaEon, ¡and ¡restrict ¡access ¡to ¡ funcEons ¡based ¡on ¡some ¡defined ¡criteria ¡respecEvely. ¡
14
– Unified ¡API ¡to ¡a ¡database ¡backend, ¡enabling ¡web ¡applicaEons ¡to ¡work ¡ with ¡a ¡variety ¡of ¡databases. ¡ – Object ¡to ¡relaEonal ¡mapping. ¡
– Generate ¡code ¡from ¡specificaEon, ¡e.g., ¡XML. ¡
– Mechanism ¡by ¡which ¡the ¡framework ¡interprets ¡URLs. ¡ ¡
15
– Due ¡to ¡the ¡complexity ¡of ¡Ajax ¡programming ¡in ¡JavaScript, ¡there ¡are ¡ numerous ¡Ajax ¡frameworks ¡that ¡exclusively ¡deal ¡with ¡Ajax ¡support. ¡ ¡ – Some ¡Ajax ¡frameworks ¡are ¡embedded ¡as ¡a ¡part ¡of ¡larger ¡frameworks. ¡ E.g., ¡ ¡jQuery ¡JavaScript ¡library ¡is ¡included ¡in ¡Ruby ¡on ¡Rails. ¡ – Compiler ¡technology ¡has ¡been ¡developed ¡to ¡allow ¡developers ¡to ¡code ¡ in ¡high-‑level ¡languages ¡such ¡as ¡Java, ¡Python ¡and ¡Ruby. ¡ ¡ – One ¡of ¡the ¡first ¡of ¡these ¡compilers ¡was ¡Morfik, ¡followed ¡by ¡Google ¡ Web ¡Toolkit, ¡with ¡ports ¡to ¡Python ¡and ¡Ruby ¡in ¡the ¡form ¡of ¡Pyjamas ¡ and ¡RubyJS ¡following ¡some ¡Eme ¡aHer. ¡ ¡
16
– Provide ¡tools ¡for ¡creaEng ¡and ¡providing ¡web ¡services. ¡ ¡ – These ¡uEliEes ¡may ¡offer ¡similar ¡tools ¡as ¡the ¡rest ¡of ¡the ¡web ¡
– A ¡number ¡of ¡newer ¡Web ¡2.0 ¡RESTful ¡frameworks ¡are ¡now ¡providing ¡ resource-‑oriented ¡architecture ¡(ROA) ¡infrastructure ¡for ¡building ¡ collecEons ¡of ¡resources ¡in ¡a ¡SemanEc ¡Web ¡ontology, ¡based ¡on ¡ concepts ¡from ¡Resource ¡DescripEon ¡Framework ¡(RDF). ¡
17
18
19
20
21
22
23
24
25
– How ¡long ¡the ¡framework ¡has ¡been ¡around ¡and ¡how ¡likely ¡it ¡is ¡to ¡evolve ¡are ¡key ¡ consideraEons ¡when ¡comparing ¡web ¡frameworks. ¡ ¡
– AJAX ¡is ¡complex ¡technology. ¡
– The ¡ability ¡to ¡adapt ¡to ¡mulEple ¡languages ¡is ¡a ¡common ¡component ¡of ¡most ¡frameworks. ¡ ¡
– DeclaraEve ¡authorizaEon ¡and ¡authenEcaEon, ¡form ¡validaEon. ¡
– Templates, ¡theme ¡availability ¡or ¡support ¡for ¡CSS ¡are ¡a ¡must ¡if ¡the ¡user ¡experience ¡and ¡
– The ¡Model-‑View-‑Controller ¡(MVC) ¡determines ¡how ¡the ¡end-‑user ¡interacts ¡with ¡the ¡ framework, ¡how ¡event ¡calls ¡are ¡handled ¡and ¡if ¡it ¡supports ¡dynamics ¡such ¡as ¡updaEng ¡a ¡ post ¡or ¡shopping ¡cart. ¡ ¡ – Object-‑relaEonal ¡Mapping ¡(ORM) ¡support ¡enables ¡you ¡to ¡update ¡the ¡API ¡or ¡key ¡ components ¡of ¡your ¡site ¡without ¡impacEng ¡the ¡front-‑end. ¡
26
– How ¡long ¡the ¡framework ¡has ¡been ¡around ¡and ¡how ¡likely ¡it ¡is ¡to ¡evolve ¡are ¡key ¡ consideraEons ¡when ¡comparing ¡web ¡frameworks. ¡ ¡
– AJAX ¡is ¡complex ¡technology. ¡
– The ¡ability ¡to ¡adapt ¡to ¡mulEple ¡languages ¡is ¡a ¡common ¡component ¡of ¡most ¡frameworks. ¡ ¡
server-‑side ¡validaEon. ¡
– DeclaraEve ¡authorizaEon ¡and ¡authenEcaEon, ¡form ¡validaEon. ¡
– Templates, ¡theme ¡availability ¡or ¡support ¡for ¡CSS ¡are ¡a ¡must ¡if ¡the ¡user ¡experience ¡and ¡
– The ¡Model-‑View-‑Controller ¡(MVC) ¡determines ¡how ¡the ¡end-‑user ¡interacts ¡with ¡the ¡ framework, ¡how ¡event ¡calls ¡are ¡handled ¡and ¡if ¡it ¡supports ¡dynamics ¡such ¡as ¡updaEng ¡a ¡ post ¡or ¡shopping ¡cart. ¡ ¡ – Object-‑relaEonal ¡Mapping ¡(ORM) ¡support ¡enables ¡you ¡to ¡update ¡the ¡API ¡or ¡key ¡ components ¡of ¡your ¡site ¡without ¡impacEng ¡the ¡front-‑end. ¡
27
28
29
30
31
32
33
34
chosen ¡framework. ¡
Rails ¡and ¡similar ¡frameworks, ¡the ¡applicaEon ¡will ¡be ¡about ¡40 ¡&mes ¡slower ¡than ¡ selecEng ¡a ¡faster ¡framework. ¡And ¡if ¡you ¡choose ¡Cake ¡PHP, ¡the ¡difference ¡increases ¡by ¡ an ¡order ¡of ¡magnitude. ¡
frameworks ¡and ¡plauorms ¡for ¡web ¡development, ¡configuring ¡their ¡best, ¡but ¡without ¡ the ¡use ¡of ¡caching, ¡placing ¡the ¡applicaEon ¡on ¡Amazon ¡EC2 ¡(Core ¡i7, ¡Ubuntu ¡12.04) ¡ and ¡run ¡a ¡program ¡for ¡stress ¡tests ¡WeigHTTP. ¡Then ¡repeated ¡the ¡tests ¡on ¡a ¡dedicated ¡
published ¡on ¡Github. ¡ ¡
35
36
37
programming ¡language. ¡ ¡ – Ruby ¡is ¡a ¡general-‑purpose ¡object-‑oriented ¡programming ¡dynamic ¡ (scripEng) ¡language ¡that ¡combines ¡syntax ¡inspired ¡by ¡Perl ¡with ¡ Smalltalk-‑like ¡features. ¡ ¡ ¡ – A ¡scripEng ¡language ¡that ¡is ¡considered ¡more ¡powerful ¡than ¡Perl, ¡and ¡ more ¡object-‑oriented ¡than ¡Python. ¡ ¡
– Allows ¡creaEng ¡pages ¡and ¡applicaEons ¡that ¡gather ¡informaEon ¡from ¡ the ¡web ¡server, ¡talk ¡to ¡or ¡query ¡the ¡database, ¡and ¡render ¡templates ¡
– As ¡a ¡result, ¡Rails ¡features ¡a ¡rouEng ¡system ¡that ¡is ¡independent ¡of ¡the ¡ web ¡server. ¡
pa6ern, ¡convenEon ¡over ¡configuraEon, ¡don't ¡repeat ¡yourself, ¡and ¡model-‑ view-‑controller. ¡
38
– Example: ¡a ¡model ¡class ¡User ¡will ¡usually ¡be ¡defined ¡in ¡the ¡file ¡user.rb ¡in ¡the ¡app/models ¡ directory, ¡and ¡is ¡linked ¡to ¡the ¡table ¡users ¡in ¡the ¡database. ¡ ¡
applicaEon ¡by ¡determining ¡which ¡view ¡file ¡to ¡render. ¡ ¡
– Controller ¡may ¡also ¡have ¡to ¡query ¡one ¡or ¡more ¡models ¡directly ¡for ¡informaEon ¡and ¡pass ¡ these ¡on ¡to ¡the ¡view. ¡ ¡ – Controller ¡may ¡provide ¡one ¡or ¡more ¡acEons. ¡An ¡acEon ¡is ¡a ¡basic ¡unit ¡that ¡describes ¡how ¡to ¡ respond ¡to ¡a ¡specific ¡external ¡web-‑browser ¡request. ¡ ¡
run-‑Eme ¡(template ¡pa6ern). ¡
box", ¡such ¡as ¡scaffolding ¡that ¡can ¡automaEcally ¡construct ¡some ¡of ¡the ¡ models ¡and ¡views ¡needed ¡for ¡a ¡basic ¡website. ¡
39
popular ¡in ¡the ¡Java ¡community ¡as ¡an ¡alternaEve ¡to, ¡replacement ¡for, ¡or ¡ even ¡addiEon ¡to ¡the ¡Enterprise ¡JavaBean ¡(EJB) ¡model. ¡
40
and ¡via ¡dependency ¡injecEon ¡(object ¡coupling ¡is ¡bound ¡at ¡run ¡Eme ¡– ¡think ¡ Observer). ¡
JDBC ¡and ¡object-‑relaEonal ¡mapping ¡tools ¡and ¡with ¡NoSQL ¡databases ¡
and ¡coordinates ¡transacEons ¡for ¡Java ¡objects ¡
hooks ¡for ¡extension ¡and ¡customizaEon ¡for ¡web ¡applicaEons ¡and ¡RESTful ¡ web ¡services. ¡
41
networks ¡supporEng ¡RMI, ¡CORBA ¡and ¡HTTP-‑based ¡protocols ¡including ¡ web ¡services ¡(SOAP) ¡
decrease ¡the ¡number ¡of ¡decisions ¡that ¡developers ¡need ¡to ¡make) ¡for ¡
transparent ¡message-‑consumpEon ¡from ¡message ¡queues ¡via ¡JMS, ¡ improvement ¡of ¡message ¡sending ¡over ¡standard ¡JMS ¡APIs ¡
42
Django ¡
development, ¡and ¡the ¡principle ¡of ¡don't ¡repeat ¡yourself. ¡ ¡
delete ¡interface ¡that ¡is ¡generated ¡dynamically ¡through ¡introspecEon ¡and ¡ configured ¡via ¡admin ¡models. ¡ Many ¡others ¡
43
44
45
produce ¡dynamic ¡Web ¡pages, ¡applicaEons ¡and ¡services.. ¡ ¡
dynamic ¡web ¡sites, ¡web ¡applicaEons ¡and ¡web ¡services. ¡ ¡
programmers ¡to ¡write ¡ASP.NET ¡code ¡using ¡any ¡supported ¡.NET ¡language ¡
blocks ¡for ¡applicaEon ¡development. ¡
46
47