SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Practical Thin Server
Architecture with Dojo

 Peter Svensson, Nethouse AB
    psvensson@gmail.com
But first..


Some theory
What is this all about?
Reducing complexity
Server-Centric Frameworks


  Client                                      Server

           Browser      New Web Page             Web-page        Business Logic
                                                building logic        and
                                                                   Database

                          User Action




                        Gazillion framework-specific XML configuration files.
                     Possibly hairy dependencies between presentation and logic.
Problems with server-centric
frameworks
•   Poor distribution of processing
•   High user response latency
•   Difficult programming model
•   Heavy state management on the servers
•   Offline Difficulties
•   Reduced opportunity for interoperability
Poor distribution of processing

With a large number of clients, doing all the processing on the
server is inefficient.




                                      Client UI
                                      generation for
                                      each client
High user response latency

Traditional web applications are not responsive enough. High
quality user interaction is very sensitive to latency, and very
fast response is essential.
Difficult programming model

• Client interface is 'canned' in pieces on the server.
• JavaScript logic is hidden and/or mapped to server-
  side logic.
• C/S interaction is made into a faux single machine
  model.
• What you see is not what you coded.
• Additional complexity in mapping debugging.
• HTML needs massage to become server-side
  template.
Difficult programming model - contd.

• Risk of high coupling between view logic and
  business logic.
• Even if view and business logic is cleanly
  separated on server, the server is not the
  client.
• View logic / Interface need to undergo
  transformation when leaving server.
Heavy state management on the
servers
• Client user interface state is maintained by the
  server.
• This requires a significant increase in resource
  utilization as server side sessions must be
  maintained with potentially large object structures
  within them.
• Usually these resources can’t be released until a
  session times out, which is often 30 minutes after
  a user actually leaves the web site.
Offline Difficulties

• Adding offline capabilities to a web application can
  be a tremendous project when user interface code
  is predominantly on the server.
• The user interface code must be ported to run on
  the client in offline situations.
Reduced opportunity for interoperability

• Client/server communication is hidden by framework.
• Server 'endpoints' is hard or impossible to isolate.
• Integration (SOA, vendor/customer system) projects must
  start from scratch.
• Risk of reinventing wheel.
• Changes in web application code might not match changes
  in integration code.
A modest proposal: Thin Server
Architecture
Thin Server Architecture is about moving UI code from the server
to the client, any way you like (more or less).
Similar ideas

SOFEA - Service Oriented Front-End Architecture;
http://www.theserverside.com/news/thread.tss?thread_id=47213

Mário Valente's blogs on the future of web applications;
http://mv.asterisco.pt/


Products based on the idea of 'thin servers';

•   TIBCO GI
•   SmartClient
•   WaveMaker (uses Dojo! :     )
•   Appcelerator
•   Probably lots of others..
Thin Server Architecture
1. All functionality that possibly can be implemented on the client side
should be implemented on the client side.

2. All communication with the application server should be using
services (REST, SOAP, domain-specific).

3. No part of the client should be evoked, generated or templated from
the server-side. This rules out in-line conditional HTML in JSP, ASP,
PHP, et.c.

4. The logic in the server will only implement the following functionality;
a) Security, b) Business logic, c) Proxying
Thin Server Architecture


  Client                                    Server

                     Original client load
           Browser                                   Business Logic
                                                          and
                                                       Database

                     Only raw data
Benefits of Thin Server Architecture

•   Scalability
•   Immediate user response
•   Organized programming model
•   Client side state management
•   Offline applications
•   Interoperability
Scalability


• The more clients that use an application, the more client
  machines that are available (d0h).
• Any presentation logic that can be moved to the client
  scales 1:1 with the number of clients.
Immediate User Response

• Client side code can immediately react to user input, rather
  than waiting for network transfers.
• If you need data on the server, you need data on the server.
  There's no way around that.
• At least we don't have to load THE WHOLE PAGE again,
  just to get an updated list of cheese.
Organized Programming Model

• Client and server are explicitly modeled and no 'mapping' is
  required.
• Neither side needs to be 'pretended' on the other side.
• Each side implement its own logic, completely separated from
  the other, leading to less risk of entanglement.
• When debugging, the messages and object being inspected
  are 'real'.
• Less complexity.
• Asynchronous development.
Client Side State Management

• Transient session state information on the client reduces the
  memory load on the server.
• The client decides what to show, cache and request from the
  server.
• The server manages security, not widget state.
Offline Applications
• Having a clean separation between client and server makes
  it simpler to implement offline modes.
• Certain toolkits have client-side data abstractions which can
  switch to offline stores transparently, when needed.
Interoperability

• Using structured data with minimal APIs for interaction,
  makes it easier to connect additional consumers and
  producers to interact with existing systems.
• By exposing explicit and secure data-interchange interfaces
  on the server, we get interoperability for free.
But what about GWT and stuff like that?

• The code generated does indeed follow separation of
  concerns, with a clearly defined client.
• However, the development environment is even “better” at
  hiding what goes on 'under the hood'.
• Debugging is convoluted, trying (and succeeding) in using a
  single Java abstraction to hide the dual layers of client and
  server.
• A wonderful but complex solution for a problem that is already
  solved more simply.
Psychology of not wanting to code on
the client
• The hard, steep climb of language mastery : Not again!
• The 'knowledge' gained anno 2003: JS sucks (== browser
  incompatibilities sucks)
• The world stopped at that date.
• Wanting to search for the keys where the light is, rather than
  were they were dropped.
• Wanting to make coding web apps less complex!
Some new things that has happened
since 2003
Ajax toolkits provide consistent APIs and hide cross-browser
differences for the following stuff;

•   Browser events
•   Styling
•   DOM positioning and Box-models
•   Ajax communication
•   2D graphics (Dojo wraps SVG, VML, Canvas and more)
•   Pseudo class-based OO
•   And more
Do what's best for each team (and the
project)
• Don't force UI logic onto server-side developers.
• Don't force front-end developers to get entwined in server
  internals
What does thin-server architecture
mean for the team?
• The Designers: Normal files makes for simpler mockups
  and simpler changes. Just ordinary HTML/CSS/Images
• The Front-end developers: Normal files makes for simpler
  mockups and simpler changes. Just ordinary HTML/JS
• The Back-end developers: No UI logic makes a simpler
  server. Can focus on _only_ business logic/database stuff
• More Front-End goodness: Mock servers/services:
  Creating the contract and developing asynchronously
Scenario 1

We need to change the styling of the web site.

Now: Does not affect back-end developers.

Before: The HTML and CSS needed to be 'templatized'
according to the mad doctor scheme du jour.
Scenario 2

We need to add a tab that shows the same data as in the list
tab, but as a bar chart - oh, and you must be able to switch
dates dynamically.

Now: Does not affect back-end developers. Charts are
rendered to the whim of the user with cached data.

Before: Each date change generates a new page reload.
Server is bogged down by the generation of gazillion static
images .
Scenario 3

We need to scrap a lot of the code that generates data for the
list of car models.

Now: Will not affect Designers or Front-End developers. The
web endpoint API is conserved.

Before: Since the old base template that we used to generate
the hand-coded rules which drives the XSLT engine which
generates the PHP code which contains most of the HTML and
CSS for the final page (half are in Barry's module), we need
you to split the page into three-line stripes with separate but
identical CSS files for each, with all images inlined as binary
XML.
Protocol ensures separation of
concerns
Client (Browser)              Server


 Data store+       Protocol   /service
 cache
Enough theory already


Let's see some code
Dojo Example (warming up)
<html>
  <head>
     <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dojo/resources/dojo.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot;/>
     <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dijit/themes/dijit.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot;/>
     <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dijit/themes/tundra/tundra.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot; /
>
     <title>Dojo Test</title>
     <script type=quot;text/javascriptquot;>
      djConfig= {       parseOnLoad: true }
     </script>
     <script src=quot;http://o.aolcdn.com/dojo/1.2.0/dojo/dojo.xd.jsquot; type=quot;text/javascriptquot;></script>
     <script type=quot;text/javascriptquot;>
        dojo.require(quot;dojo.parserquot;);
        dojo.require(quot;dijit.form.Buttonquot;);
        dojo.require(quot;dijit.form.SimpleTextareaquot;);
     </script>
  </head>
 <body class=quot;tundraquot;>
  <button id=quot;mybuttonquot; dojoType=quot;dijit.form.Buttonquot; onClick='dijit.byId(quot;q1quot;).attr(quot;valuequot;, quot;fooquot;)'>Click
Me</button>
  <textarea id=quot;q1quot; dojoType=quot;dijit.form.SimpleTextareaquot; name=quot;ta1quot; rows=5 cols=50 ></textarea>
 </body>
</html>
Dojo loader

The dojo loader looks where dojo.js is loaded from, and use that
as a base url to look for requirements.

Given           http://o.aolcdn.com/dojo/1.2.0/dojo/dojo.xd.js

The line        dojo.require(quot;dijit.form.buttonquot;);

Tries to load   ../dijit/form/button.js

Which becomes http://o.aolcdn.com/dojo/1.2.0/dijit/form/button.js
Dojo Custom Widgets
• Use a folder hierarchy to leverage the loader
• Use client-side templates for widgets
• Create nested widgets

Example:
 dojo-1.2.0                   --- root folder for Dojo
   dojo
   dijit
   dojox
   mycorp                     --- your custom folder
       scaffold
         main.js
         templates
            main.html
Steps to load a Dojo widget

1. The Dojo parser parses the page (or part of the page)
2. The parser finds elements with the 'dojoType=quot;x.y.zquot; ' property
3. Is the Dojo class x.y.z loaded already (by dojo.require,
perhaps)?
4. If no, resolve where from, and load it.
5. Create a new instance of class x.y.z
6. Find and populate template (if any) for x.y.z
7. Call magic functions (as defined) for lifecycle management of
x.y.z
A custom widget class
dojo.provide(quot;scaffold.mainquot;);
//...dojo.requires...

dojo.declare(quot;scaffold.mainquot;, [ dijit._Widget, dijit._Templated ],
{
  templatePath         : dojo.moduleUrl(quot;scaffoldquot;,quot;templates/main.htmlquot;),
  widgetsInTemplate : true,
  content              : {}, // name - url pairs for menu building
  name                  : quot;quot;,

  postCreate: function()
  {
    console.log(quot;postCreate for scaffold.main calledquot;);
     ...
  }
...
});
A custom widget template (main.html)

<div>
 <div dojoAttachPoint=quot;mymenuquot; class=quot;scaffold_menuquot;>
     ${name}
 </div>
 <div dojoType=quot;dijit.layout.StackContainerquot;
dojoAttachPoint=quot;mystackquot; class=quot;scaffold_mainquot;>
 </div>
</div>

An 'attachPoint=quot;xquot; ' element or widget gets mapped to a 'this.x'
property in the Widget class. ${y} inserts the value of 'this.y' .
Using the custom widget
   ...
     <script type=quot;text/javascriptquot;>
        dojo.require(quot;dojo.parserquot;);
        dojo.require(quot;mycorp.scaffold.mainquot;);
     </script>
  </head>
 <body class=quot;tundraquot;>
  <div dojoType=quot;mycorp.scaffold.mainquot; name=quot;foobarquot;
  content=quot;{'news': 'scaffold/content/news.html', 'products':
  'scaffold/content/products.html', 'partners':
  'scaffold/content/partners.html', 'people' :
  'scaffold/content/people.html'}quot;>
  </div>
 </body>
</html>
What the widget might look like
Dojo.data
Client-side data model that separates consumers of data
(widgets, for example) from the producers (server, services,
files, offline)
Dojo.data stores
• AndOrReadStore - Based on ItemFileReadStore, but support complex
  queries.
• AndOrWriteStore - Based on ItemFileWriteStore as above
• AtomReadStore - RO store for Atom XML based feeds
• CouchDbRestStore - Based on JsonRestStore for r/w couchDb
  operations.
• CsvStore - A simple store that read CSV-files
• FileStore - A RO store for filesystem traversal and file read.
• FlickrStore - A simple store for explicit Flickr feeds without wildcards.
• FlickrRestStore - Based on FlickStore using Flickr's REST services
  instead.
• GoogleSearchStore - RO store for Google web searches.
• GoogleFeedStore - RO store that uses Google's RSS/Atom feed
  services.
• HtmlStore - RO store that reads hierarchical DOM nodes as data.
• HtmlTableStore - Based on HtmlStore but specifically made for tables.
• JsonPathStore - Takes an arbitrary JS object and uses as store data.
Dojo.data stores contd.
•   JsonRestStore - RW store using REST access to RESTful services.
•   KeyValueStore - Read store for key-value JS objects
•   OpmlStore - Read store for the OPML XML data format
•   PersevereStore - Read and Write store for the server-side JavaScript
    data repository system Persevere – based on JsonRestStore.
•   PicasaStore - Read store for Picasa web albums
•   QueyReadStore - Read store which can pass queries to the server for
    generating data, which can then be queried differently in the client.
•   S3Store - RW store for Amazon S3 storage service.
•   ServiceStore - RW store that uses dojox.rpc clients to access server,
    using either urls or SMD files.
•   SnapLogicStore - RO for the SnapLogic open source data integreation
    framework.
•   WikipediaStore - Read access to wikipedia searches
•   XmlStore - Read and Write store for XML data.
Read, Write, Identity, Notification APIs
A dojo.data store implements one or more of the following APIs:

• Read - Reading items, getting values of attributes of items.
• Write - Manages writing to in-memory storage. Can be
  extended for customized writebacks to services.
• Identity - For stores whose items have unique identifiers
• Notification - Defines a number of callbacks for store events.
Example: Widget which reads from a
FileItemWriteStore

<span dojoType=quot;dojo.data.ItemFileWriteStorequot;
   jsId=quot;jsonStorequot;
   url=quot;../../../dijit/tests/_data/countries.jsonquot;>
</span>
<table dojoType=quot;dojox.grid.DataGridquot; jsid=quot;gridquot; id=quot;gridquot;
      store=quot;jsonStorequot; query=quot;{ name: '*' }quot; rowsPerPage=quot;20quot; >
   <thead>
      <tr>
         <th field=quot;namequot; width=quot;300pxquot;>Country</th>
         <th field=quot;typequot; width=quot;autoquot;>Type</th>
      </tr>
   </thead>
</table>
FileItemWriteStore contd.

First a store is defined. Then the widget is connected to the
store, optionally using a specific query, like query=quot;{ name: '*' }quot;.
JsonRestStore: The full monty
Example: JsonRestStore
var rs = new dojox.data.JsonRestStore({target:quot;/recipeStorequot;});

OR

var s = dojox.rpc.Service(quot;/mySMDquot;);
var rs = new dojox.data.JsonRestStore({service:s.myRestService});

THEN
 
var item = rs.getValue(item,quot;fooquot;);
rs.setValue(item,quot;fooquot;,quot;barquot;);
rs.save();
Pluggable services: SMD
Service Mapping Description: 'WSDL done right'
http://groups.google.com/group/json-schema/web/service-mapping-description-proposal
{
    quot;transportquot;: quot;POSTquot;,
    quot;envelopequot;: quot;URLquot;
    quot;targetquot;: quot;/service/quot;,
    quot;additionalParametersquot;: true,
    quot;parametersquot;: [
       {
          quot;namequot;:quot;outputTypequot;:,
          quot;defaultquot;: quot;jsonquot;
       }
    ],
    quot;servicesquot;: {
       quot;fooquot;: {
          quot;transportquot;: quot;GETquot;,
          quot;targetquot;: quot;executeFoo.phpquot;,
          quot;parametersquot;: [
             {quot;namequot;:quot;paramOnequot;, quot;typequot;: quot;stringquot;},
             {quot;namequot;:quot;paramTwoquot;, quot;typequot;: quot;integerquot;, quot;defaultquot;: 5},
             {quot;namequot;:quot;paramThreequot;, quot;typequot;: quot;integerquot;, quot;optionalquot;: true}
          ]
       }
    }
}
SMD Service Types
• REST
  – JSONP
  – Plain GET
  – Full Read/Write (POST, PUT, DELETE)
• RPC
  – JSON-RPC
• Different URL forms
  – /path/id
  – ?name=value
Dojo includes SMDs for major
                 services
•   Wikipedia
•   Yahoo
•   Google
•   Geonames.org
JSON-Schema

quot;JSON Schema provides a contract for what JSON data is required for a given
application and how it can be modified, much like what XML Schema provides for
XML. JSON Schema is intended to provide validation, documentation, and
interaction control of JSON data.quot;
http://www.json.com/category/json-schema/

Example object:

{
    quot;namequot; : quot;John Doequot;,
    quot;bornquot; : quot;quot;,
    quot;genderquot; : quot;malequot;,
    quot;addressquot; :
     {quot;streetquot;:quot;123 S Main Stquot;,
      quot;cityquot;:quot;Springfieldquot;,
      quot;statequot;:quot;CAquot;}
}
JSON-Schema contd.
{
quot;descriptionquot;:quot;A personquot;,
 quot;typequot;:quot;objectquot;,
 quot;propertiesquot;: {
    quot;namequot;: {quot;typequot;:quot;stringquot;},
    quot;bornquot; : {quot;typequot;:[quot;integerquot;,quot;stringquot;], allow for a numeric year, or a full date
        quot;minimumquot;:1900, min/max for when a numberic value is used
        quot;maximumquot;:2010,
        quot;formatquot;:quot;date-timequot;, format when a string value is used
        quot;optionalquot;:true}
    ],
    quot;genderquot; : {quot;typequot;:quot;stringquot;,
            quot;optionsquot;:[
               {quot;value:quot;malequot;,quot;labelquot;:quot;Guyquot;},
               {quot;valuequot;:quot;femalequot;,quot;labelquot;:quot;Galquot;}]},
    quot;addressquot; : {quot;typequot;:quot;objectquot;,
             quot;propertiesquot;:{
                quot;streetquot;:{quot;typequot;:quot;stringquot;},
                quot;cityquot;:{quot;typequot;:quot;stringquot;},
                quot;statequot;:{quot;typequot;:quot;stringquot;}
               }
             }
  }
}
JSON-Schema contd.
• JSON Referencing
  – Cyclic/Circular
  – Multiple references
  – Cross-Message references
  – Cross-Site references


http://www.sitepen.com/blog/2008/06/17/json-
  referencing-in-dojo/
What does TSA lead to
• Single-page applications
• This means the same URL during all states
• Impossible to bookmark
• An application as a collection of hyperlinks ->
  Web 1.0
• SEO issues
• Google will save us :) (Flash spidering etc.)
Helpful tools?
 WaveMaker 4

Contenu connexe

Tendances

Introduction to NServiceBus
Introduction to NServiceBusIntroduction to NServiceBus
Introduction to NServiceBusAdam Fyles
 
Unit 5-jdbc2
Unit 5-jdbc2Unit 5-jdbc2
Unit 5-jdbc2msafad
 
Beyond Breakpoints: Improving Performance for Responsive Sites
Beyond Breakpoints: Improving Performance for Responsive SitesBeyond Breakpoints: Improving Performance for Responsive Sites
Beyond Breakpoints: Improving Performance for Responsive SitesRakuten Group, Inc.
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applicationsSC5.io
 
CMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTCMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTSandyarathi Das
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classQUONTRASOLUTIONS
 
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Joonas Lehtinen
 

Tendances (7)

Introduction to NServiceBus
Introduction to NServiceBusIntroduction to NServiceBus
Introduction to NServiceBus
 
Unit 5-jdbc2
Unit 5-jdbc2Unit 5-jdbc2
Unit 5-jdbc2
 
Beyond Breakpoints: Improving Performance for Responsive Sites
Beyond Breakpoints: Improving Performance for Responsive SitesBeyond Breakpoints: Improving Performance for Responsive Sites
Beyond Breakpoints: Improving Performance for Responsive Sites
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
CMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORTCMPE282_009994036_PROJECT_REPORT
CMPE282_009994036_PROJECT_REPORT
 
Introduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training classIntroduction to j2 ee patterns online training class
Introduction to j2 ee patterns online training class
 
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
Vaadin - Rich Web Applications in Server-side Java without Plug-ins or JavaSc...
 

En vedette

Intro to Pattern Lab
Intro to Pattern LabIntro to Pattern Lab
Intro to Pattern LabPaul Stonier
 
CSS Architecture
CSS ArchitectureCSS Architecture
CSS ArchitectureGabriel
 
Decoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSDecoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSJulie Cameron
 
The New Design Workflow
The New Design WorkflowThe New Design Workflow
The New Design WorkflowPhase2
 
Redhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyRedhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyPhase2
 
Design Pattern Libraries
Design Pattern LibrariesDesign Pattern Libraries
Design Pattern LibrariesBrian Peppler
 
How to build the perfect pattern library
How to build the perfect pattern libraryHow to build the perfect pattern library
How to build the perfect pattern libraryWolf Brüning
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern librariesRuss Weakley
 

En vedette (9)

CSS Architecture 101
CSS Architecture 101CSS Architecture 101
CSS Architecture 101
 
Intro to Pattern Lab
Intro to Pattern LabIntro to Pattern Lab
Intro to Pattern Lab
 
CSS Architecture
CSS ArchitectureCSS Architecture
CSS Architecture
 
Decoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSSDecoupling the Front-end with Modular CSS
Decoupling the Front-end with Modular CSS
 
The New Design Workflow
The New Design WorkflowThe New Design Workflow
The New Design Workflow
 
Redhat.com: An Architectural Case Study
Redhat.com: An Architectural Case StudyRedhat.com: An Architectural Case Study
Redhat.com: An Architectural Case Study
 
Design Pattern Libraries
Design Pattern LibrariesDesign Pattern Libraries
Design Pattern Libraries
 
How to build the perfect pattern library
How to build the perfect pattern libraryHow to build the perfect pattern library
How to build the perfect pattern library
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
 

Similaire à Practical Thin Server Architecture With Dojo Sapo Codebits 2008

Docebo: history of a journey from legacy to serverless
Docebo: history of a journey from legacy to serverlessDocebo: history of a journey from legacy to serverless
Docebo: history of a journey from legacy to serverlessAWS User Group Italy
 
Thin client SPAs? Stream UI using web standards (CodeNight)
Thin client SPAs? Stream UI using web standards (CodeNight)Thin client SPAs? Stream UI using web standards (CodeNight)
Thin client SPAs? Stream UI using web standards (CodeNight)Starcounter
 
Service Virtualization - Next Gen Testing Conference Singapore 2013
Service Virtualization - Next Gen Testing Conference Singapore 2013Service Virtualization - Next Gen Testing Conference Singapore 2013
Service Virtualization - Next Gen Testing Conference Singapore 2013Min Fang
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cachecornelia davis
 
Internet applications unit1
Internet applications unit1Internet applications unit1
Internet applications unit1MSc CST
 
ArcReady - Scalable And Usable Web Applications
ArcReady - Scalable And Usable Web ApplicationsArcReady - Scalable And Usable Web Applications
ArcReady - Scalable And Usable Web ApplicationsMicrosoft ArcReady
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.jsratankadam
 
Refactoring to Microservices
Refactoring to MicroservicesRefactoring to Microservices
Refactoring to MicroservicesJacinto Limjap
 
Scalable And Usable Web Applications
Scalable And Usable Web ApplicationsScalable And Usable Web Applications
Scalable And Usable Web ApplicationsClint Edmonson
 
E g innovations overview
E g innovations overviewE g innovations overview
E g innovations overviewNuno Alves
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Bluegrass Digital
 
My Presentation On Ajax
My Presentation On AjaxMy Presentation On Ajax
My Presentation On AjaxGhaffar Khan
 
Will Web 2.0 applications break the cloud?
Will Web 2.0 applications break the cloud?Will Web 2.0 applications break the cloud?
Will Web 2.0 applications break the cloud?Flaskdata.io
 
Mdb dn 2017_14b_cloud_foundry
Mdb dn 2017_14b_cloud_foundryMdb dn 2017_14b_cloud_foundry
Mdb dn 2017_14b_cloud_foundryDaniel M. Farrell
 
On component interface
On component interfaceOn component interface
On component interfaceLaurence Chen
 

Similaire à Practical Thin Server Architecture With Dojo Sapo Codebits 2008 (20)

Docebo: history of a journey from legacy to serverless
Docebo: history of a journey from legacy to serverlessDocebo: history of a journey from legacy to serverless
Docebo: history of a journey from legacy to serverless
 
Thin client SPAs? Stream UI using web standards (CodeNight)
Thin client SPAs? Stream UI using web standards (CodeNight)Thin client SPAs? Stream UI using web standards (CodeNight)
Thin client SPAs? Stream UI using web standards (CodeNight)
 
NoSQL and ACID
NoSQL and ACIDNoSQL and ACID
NoSQL and ACID
 
Ajax World West
Ajax World WestAjax World West
Ajax World West
 
Signal R 2015
Signal R 2015Signal R 2015
Signal R 2015
 
Service Virtualization - Next Gen Testing Conference Singapore 2013
Service Virtualization - Next Gen Testing Conference Singapore 2013Service Virtualization - Next Gen Testing Conference Singapore 2013
Service Virtualization - Next Gen Testing Conference Singapore 2013
 
Build A Scalable Mobile App
Build A Scalable Mobile App Build A Scalable Mobile App
Build A Scalable Mobile App
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 
Internet applications unit1
Internet applications unit1Internet applications unit1
Internet applications unit1
 
ArcReady - Scalable And Usable Web Applications
ArcReady - Scalable And Usable Web ApplicationsArcReady - Scalable And Usable Web Applications
ArcReady - Scalable And Usable Web Applications
 
Scalability using Node.js
Scalability using Node.jsScalability using Node.js
Scalability using Node.js
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
Refactoring to Microservices
Refactoring to MicroservicesRefactoring to Microservices
Refactoring to Microservices
 
Scalable And Usable Web Applications
Scalable And Usable Web ApplicationsScalable And Usable Web Applications
Scalable And Usable Web Applications
 
E g innovations overview
E g innovations overviewE g innovations overview
E g innovations overview
 
Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015Best of Microsoft Dev Camp 2015
Best of Microsoft Dev Camp 2015
 
My Presentation On Ajax
My Presentation On AjaxMy Presentation On Ajax
My Presentation On Ajax
 
Will Web 2.0 applications break the cloud?
Will Web 2.0 applications break the cloud?Will Web 2.0 applications break the cloud?
Will Web 2.0 applications break the cloud?
 
Mdb dn 2017_14b_cloud_foundry
Mdb dn 2017_14b_cloud_foundryMdb dn 2017_14b_cloud_foundry
Mdb dn 2017_14b_cloud_foundry
 
On component interface
On component interfaceOn component interface
On component interface
 

Plus de codebits

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands Oncodebits
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meocodebits
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101codebits
 
Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based appscodebits
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-Oncodebits
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Webcodebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunnercodebits
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...codebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunnercodebits
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPPcodebits
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-Oncodebits
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencercodebits
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumbycodebits
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossárioscodebits
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduçõescodebits
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Javacodebits
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-Oncodebits
 
Optimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de FormigasOptimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de Formigascodebits
 

Plus de codebits (20)

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands On
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
 
Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based apps
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-On
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Web
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
 
CouchDB
CouchDBCouchDB
CouchDB
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPP
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-On
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencer
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumby
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossários
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduções
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-On
 
Gis@sapo
Gis@sapoGis@sapo
Gis@sapo
 
Optimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de FormigasOptimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de Formigas
 

Dernier

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Practical Thin Server Architecture With Dojo Sapo Codebits 2008

  • 1. Practical Thin Server Architecture with Dojo Peter Svensson, Nethouse AB psvensson@gmail.com
  • 3. What is this all about? Reducing complexity
  • 4. Server-Centric Frameworks Client Server Browser New Web Page Web-page Business Logic building logic and Database User Action Gazillion framework-specific XML configuration files. Possibly hairy dependencies between presentation and logic.
  • 5. Problems with server-centric frameworks • Poor distribution of processing • High user response latency • Difficult programming model • Heavy state management on the servers • Offline Difficulties • Reduced opportunity for interoperability
  • 6. Poor distribution of processing With a large number of clients, doing all the processing on the server is inefficient. Client UI generation for each client
  • 7. High user response latency Traditional web applications are not responsive enough. High quality user interaction is very sensitive to latency, and very fast response is essential.
  • 8. Difficult programming model • Client interface is 'canned' in pieces on the server. • JavaScript logic is hidden and/or mapped to server- side logic. • C/S interaction is made into a faux single machine model. • What you see is not what you coded. • Additional complexity in mapping debugging. • HTML needs massage to become server-side template.
  • 9. Difficult programming model - contd. • Risk of high coupling between view logic and business logic. • Even if view and business logic is cleanly separated on server, the server is not the client. • View logic / Interface need to undergo transformation when leaving server.
  • 10. Heavy state management on the servers • Client user interface state is maintained by the server. • This requires a significant increase in resource utilization as server side sessions must be maintained with potentially large object structures within them. • Usually these resources can’t be released until a session times out, which is often 30 minutes after a user actually leaves the web site.
  • 11. Offline Difficulties • Adding offline capabilities to a web application can be a tremendous project when user interface code is predominantly on the server. • The user interface code must be ported to run on the client in offline situations.
  • 12. Reduced opportunity for interoperability • Client/server communication is hidden by framework. • Server 'endpoints' is hard or impossible to isolate. • Integration (SOA, vendor/customer system) projects must start from scratch. • Risk of reinventing wheel. • Changes in web application code might not match changes in integration code.
  • 13. A modest proposal: Thin Server Architecture Thin Server Architecture is about moving UI code from the server to the client, any way you like (more or less).
  • 14. Similar ideas SOFEA - Service Oriented Front-End Architecture; http://www.theserverside.com/news/thread.tss?thread_id=47213 Mário Valente's blogs on the future of web applications; http://mv.asterisco.pt/ Products based on the idea of 'thin servers'; • TIBCO GI • SmartClient • WaveMaker (uses Dojo! : ) • Appcelerator • Probably lots of others..
  • 15. Thin Server Architecture 1. All functionality that possibly can be implemented on the client side should be implemented on the client side. 2. All communication with the application server should be using services (REST, SOAP, domain-specific). 3. No part of the client should be evoked, generated or templated from the server-side. This rules out in-line conditional HTML in JSP, ASP, PHP, et.c. 4. The logic in the server will only implement the following functionality; a) Security, b) Business logic, c) Proxying
  • 16. Thin Server Architecture Client Server Original client load Browser Business Logic and Database Only raw data
  • 17. Benefits of Thin Server Architecture • Scalability • Immediate user response • Organized programming model • Client side state management • Offline applications • Interoperability
  • 18. Scalability • The more clients that use an application, the more client machines that are available (d0h). • Any presentation logic that can be moved to the client scales 1:1 with the number of clients.
  • 19. Immediate User Response • Client side code can immediately react to user input, rather than waiting for network transfers. • If you need data on the server, you need data on the server. There's no way around that. • At least we don't have to load THE WHOLE PAGE again, just to get an updated list of cheese.
  • 20. Organized Programming Model • Client and server are explicitly modeled and no 'mapping' is required. • Neither side needs to be 'pretended' on the other side. • Each side implement its own logic, completely separated from the other, leading to less risk of entanglement. • When debugging, the messages and object being inspected are 'real'. • Less complexity. • Asynchronous development.
  • 21. Client Side State Management • Transient session state information on the client reduces the memory load on the server. • The client decides what to show, cache and request from the server. • The server manages security, not widget state.
  • 22. Offline Applications • Having a clean separation between client and server makes it simpler to implement offline modes. • Certain toolkits have client-side data abstractions which can switch to offline stores transparently, when needed.
  • 23. Interoperability • Using structured data with minimal APIs for interaction, makes it easier to connect additional consumers and producers to interact with existing systems. • By exposing explicit and secure data-interchange interfaces on the server, we get interoperability for free.
  • 24. But what about GWT and stuff like that? • The code generated does indeed follow separation of concerns, with a clearly defined client. • However, the development environment is even “better” at hiding what goes on 'under the hood'. • Debugging is convoluted, trying (and succeeding) in using a single Java abstraction to hide the dual layers of client and server. • A wonderful but complex solution for a problem that is already solved more simply.
  • 25. Psychology of not wanting to code on the client • The hard, steep climb of language mastery : Not again! • The 'knowledge' gained anno 2003: JS sucks (== browser incompatibilities sucks) • The world stopped at that date. • Wanting to search for the keys where the light is, rather than were they were dropped. • Wanting to make coding web apps less complex!
  • 26. Some new things that has happened since 2003 Ajax toolkits provide consistent APIs and hide cross-browser differences for the following stuff; • Browser events • Styling • DOM positioning and Box-models • Ajax communication • 2D graphics (Dojo wraps SVG, VML, Canvas and more) • Pseudo class-based OO • And more
  • 27. Do what's best for each team (and the project) • Don't force UI logic onto server-side developers. • Don't force front-end developers to get entwined in server internals
  • 28. What does thin-server architecture mean for the team? • The Designers: Normal files makes for simpler mockups and simpler changes. Just ordinary HTML/CSS/Images • The Front-end developers: Normal files makes for simpler mockups and simpler changes. Just ordinary HTML/JS • The Back-end developers: No UI logic makes a simpler server. Can focus on _only_ business logic/database stuff • More Front-End goodness: Mock servers/services: Creating the contract and developing asynchronously
  • 29. Scenario 1 We need to change the styling of the web site. Now: Does not affect back-end developers. Before: The HTML and CSS needed to be 'templatized' according to the mad doctor scheme du jour.
  • 30. Scenario 2 We need to add a tab that shows the same data as in the list tab, but as a bar chart - oh, and you must be able to switch dates dynamically. Now: Does not affect back-end developers. Charts are rendered to the whim of the user with cached data. Before: Each date change generates a new page reload. Server is bogged down by the generation of gazillion static images .
  • 31. Scenario 3 We need to scrap a lot of the code that generates data for the list of car models. Now: Will not affect Designers or Front-End developers. The web endpoint API is conserved. Before: Since the old base template that we used to generate the hand-coded rules which drives the XSLT engine which generates the PHP code which contains most of the HTML and CSS for the final page (half are in Barry's module), we need you to split the page into three-line stripes with separate but identical CSS files for each, with all images inlined as binary XML.
  • 32. Protocol ensures separation of concerns Client (Browser) Server Data store+ Protocol /service cache
  • 34. Dojo Example (warming up) <html> <head> <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dojo/resources/dojo.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot;/> <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dijit/themes/dijit.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot;/> <link href=quot;http://o.aolcdn.com/dojo/1.2.0/dijit/themes/tundra/tundra.cssquot; rel=quot;stylesheetquot; type=quot;text/cssquot; / > <title>Dojo Test</title> <script type=quot;text/javascriptquot;> djConfig= { parseOnLoad: true } </script> <script src=quot;http://o.aolcdn.com/dojo/1.2.0/dojo/dojo.xd.jsquot; type=quot;text/javascriptquot;></script> <script type=quot;text/javascriptquot;> dojo.require(quot;dojo.parserquot;); dojo.require(quot;dijit.form.Buttonquot;); dojo.require(quot;dijit.form.SimpleTextareaquot;); </script> </head> <body class=quot;tundraquot;> <button id=quot;mybuttonquot; dojoType=quot;dijit.form.Buttonquot; onClick='dijit.byId(quot;q1quot;).attr(quot;valuequot;, quot;fooquot;)'>Click Me</button> <textarea id=quot;q1quot; dojoType=quot;dijit.form.SimpleTextareaquot; name=quot;ta1quot; rows=5 cols=50 ></textarea> </body> </html>
  • 35. Dojo loader The dojo loader looks where dojo.js is loaded from, and use that as a base url to look for requirements. Given http://o.aolcdn.com/dojo/1.2.0/dojo/dojo.xd.js The line dojo.require(quot;dijit.form.buttonquot;); Tries to load ../dijit/form/button.js Which becomes http://o.aolcdn.com/dojo/1.2.0/dijit/form/button.js
  • 36. Dojo Custom Widgets • Use a folder hierarchy to leverage the loader • Use client-side templates for widgets • Create nested widgets Example: dojo-1.2.0 --- root folder for Dojo dojo dijit dojox mycorp --- your custom folder scaffold main.js templates main.html
  • 37. Steps to load a Dojo widget 1. The Dojo parser parses the page (or part of the page) 2. The parser finds elements with the 'dojoType=quot;x.y.zquot; ' property 3. Is the Dojo class x.y.z loaded already (by dojo.require, perhaps)? 4. If no, resolve where from, and load it. 5. Create a new instance of class x.y.z 6. Find and populate template (if any) for x.y.z 7. Call magic functions (as defined) for lifecycle management of x.y.z
  • 38. A custom widget class dojo.provide(quot;scaffold.mainquot;); //...dojo.requires... dojo.declare(quot;scaffold.mainquot;, [ dijit._Widget, dijit._Templated ], { templatePath : dojo.moduleUrl(quot;scaffoldquot;,quot;templates/main.htmlquot;), widgetsInTemplate : true, content : {}, // name - url pairs for menu building name : quot;quot;, postCreate: function() { console.log(quot;postCreate for scaffold.main calledquot;); ... } ... });
  • 39. A custom widget template (main.html) <div> <div dojoAttachPoint=quot;mymenuquot; class=quot;scaffold_menuquot;> ${name} </div> <div dojoType=quot;dijit.layout.StackContainerquot; dojoAttachPoint=quot;mystackquot; class=quot;scaffold_mainquot;> </div> </div> An 'attachPoint=quot;xquot; ' element or widget gets mapped to a 'this.x' property in the Widget class. ${y} inserts the value of 'this.y' .
  • 40. Using the custom widget ... <script type=quot;text/javascriptquot;> dojo.require(quot;dojo.parserquot;); dojo.require(quot;mycorp.scaffold.mainquot;); </script> </head> <body class=quot;tundraquot;> <div dojoType=quot;mycorp.scaffold.mainquot; name=quot;foobarquot; content=quot;{'news': 'scaffold/content/news.html', 'products': 'scaffold/content/products.html', 'partners': 'scaffold/content/partners.html', 'people' : 'scaffold/content/people.html'}quot;> </div> </body> </html>
  • 41. What the widget might look like
  • 42. Dojo.data Client-side data model that separates consumers of data (widgets, for example) from the producers (server, services, files, offline)
  • 43. Dojo.data stores • AndOrReadStore - Based on ItemFileReadStore, but support complex queries. • AndOrWriteStore - Based on ItemFileWriteStore as above • AtomReadStore - RO store for Atom XML based feeds • CouchDbRestStore - Based on JsonRestStore for r/w couchDb operations. • CsvStore - A simple store that read CSV-files • FileStore - A RO store for filesystem traversal and file read. • FlickrStore - A simple store for explicit Flickr feeds without wildcards. • FlickrRestStore - Based on FlickStore using Flickr's REST services instead. • GoogleSearchStore - RO store for Google web searches. • GoogleFeedStore - RO store that uses Google's RSS/Atom feed services. • HtmlStore - RO store that reads hierarchical DOM nodes as data. • HtmlTableStore - Based on HtmlStore but specifically made for tables. • JsonPathStore - Takes an arbitrary JS object and uses as store data.
  • 44. Dojo.data stores contd. • JsonRestStore - RW store using REST access to RESTful services. • KeyValueStore - Read store for key-value JS objects • OpmlStore - Read store for the OPML XML data format • PersevereStore - Read and Write store for the server-side JavaScript data repository system Persevere – based on JsonRestStore. • PicasaStore - Read store for Picasa web albums • QueyReadStore - Read store which can pass queries to the server for generating data, which can then be queried differently in the client. • S3Store - RW store for Amazon S3 storage service. • ServiceStore - RW store that uses dojox.rpc clients to access server, using either urls or SMD files. • SnapLogicStore - RO for the SnapLogic open source data integreation framework. • WikipediaStore - Read access to wikipedia searches • XmlStore - Read and Write store for XML data.
  • 45. Read, Write, Identity, Notification APIs A dojo.data store implements one or more of the following APIs: • Read - Reading items, getting values of attributes of items. • Write - Manages writing to in-memory storage. Can be extended for customized writebacks to services. • Identity - For stores whose items have unique identifiers • Notification - Defines a number of callbacks for store events.
  • 46. Example: Widget which reads from a FileItemWriteStore <span dojoType=quot;dojo.data.ItemFileWriteStorequot; jsId=quot;jsonStorequot; url=quot;../../../dijit/tests/_data/countries.jsonquot;> </span> <table dojoType=quot;dojox.grid.DataGridquot; jsid=quot;gridquot; id=quot;gridquot; store=quot;jsonStorequot; query=quot;{ name: '*' }quot; rowsPerPage=quot;20quot; > <thead> <tr> <th field=quot;namequot; width=quot;300pxquot;>Country</th> <th field=quot;typequot; width=quot;autoquot;>Type</th> </tr> </thead> </table>
  • 47. FileItemWriteStore contd. First a store is defined. Then the widget is connected to the store, optionally using a specific query, like query=quot;{ name: '*' }quot;.
  • 49. Example: JsonRestStore var rs = new dojox.data.JsonRestStore({target:quot;/recipeStorequot;}); OR var s = dojox.rpc.Service(quot;/mySMDquot;); var rs = new dojox.data.JsonRestStore({service:s.myRestService}); THEN   var item = rs.getValue(item,quot;fooquot;); rs.setValue(item,quot;fooquot;,quot;barquot;); rs.save();
  • 50. Pluggable services: SMD Service Mapping Description: 'WSDL done right' http://groups.google.com/group/json-schema/web/service-mapping-description-proposal { quot;transportquot;: quot;POSTquot;, quot;envelopequot;: quot;URLquot; quot;targetquot;: quot;/service/quot;, quot;additionalParametersquot;: true, quot;parametersquot;: [ { quot;namequot;:quot;outputTypequot;:, quot;defaultquot;: quot;jsonquot; } ], quot;servicesquot;: { quot;fooquot;: { quot;transportquot;: quot;GETquot;, quot;targetquot;: quot;executeFoo.phpquot;, quot;parametersquot;: [ {quot;namequot;:quot;paramOnequot;, quot;typequot;: quot;stringquot;}, {quot;namequot;:quot;paramTwoquot;, quot;typequot;: quot;integerquot;, quot;defaultquot;: 5}, {quot;namequot;:quot;paramThreequot;, quot;typequot;: quot;integerquot;, quot;optionalquot;: true} ] } } }
  • 51. SMD Service Types • REST – JSONP – Plain GET – Full Read/Write (POST, PUT, DELETE) • RPC – JSON-RPC • Different URL forms – /path/id – ?name=value
  • 52. Dojo includes SMDs for major services • Wikipedia • Yahoo • Google • Geonames.org
  • 53. JSON-Schema quot;JSON Schema provides a contract for what JSON data is required for a given application and how it can be modified, much like what XML Schema provides for XML. JSON Schema is intended to provide validation, documentation, and interaction control of JSON data.quot; http://www.json.com/category/json-schema/ Example object: { quot;namequot; : quot;John Doequot;, quot;bornquot; : quot;quot;, quot;genderquot; : quot;malequot;, quot;addressquot; : {quot;streetquot;:quot;123 S Main Stquot;, quot;cityquot;:quot;Springfieldquot;, quot;statequot;:quot;CAquot;} }
  • 54. JSON-Schema contd. { quot;descriptionquot;:quot;A personquot;, quot;typequot;:quot;objectquot;, quot;propertiesquot;: { quot;namequot;: {quot;typequot;:quot;stringquot;}, quot;bornquot; : {quot;typequot;:[quot;integerquot;,quot;stringquot;], allow for a numeric year, or a full date quot;minimumquot;:1900, min/max for when a numberic value is used quot;maximumquot;:2010, quot;formatquot;:quot;date-timequot;, format when a string value is used quot;optionalquot;:true} ], quot;genderquot; : {quot;typequot;:quot;stringquot;, quot;optionsquot;:[ {quot;value:quot;malequot;,quot;labelquot;:quot;Guyquot;}, {quot;valuequot;:quot;femalequot;,quot;labelquot;:quot;Galquot;}]}, quot;addressquot; : {quot;typequot;:quot;objectquot;, quot;propertiesquot;:{ quot;streetquot;:{quot;typequot;:quot;stringquot;}, quot;cityquot;:{quot;typequot;:quot;stringquot;}, quot;statequot;:{quot;typequot;:quot;stringquot;} } } } }
  • 55. JSON-Schema contd. • JSON Referencing – Cyclic/Circular – Multiple references – Cross-Message references – Cross-Site references http://www.sitepen.com/blog/2008/06/17/json- referencing-in-dojo/
  • 56. What does TSA lead to • Single-page applications • This means the same URL during all states • Impossible to bookmark • An application as a collection of hyperlinks -> Web 1.0 • SEO issues • Google will save us :) (Flash spidering etc.)