22
Smalltalk Web frameworks Comparison of Aida/Web and Seaside Janko Mivšek [email protected]

Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek [email protected]. Vsebina Definition

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Smalltalk Web frameworks

Comparison of Aida/Web and Seaside

Janko Mivš[email protected]

Page 2: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Vsebina

Definition of Web App serverAida’s ideas and architectureComparison to SeasideExamplesConclusion

Page 3: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Web application server

Web + application serverFor web applications

Dynamic, on­the­fly built web pagesWeb pages instead of GUI appsThin clients instead of fat clientsExamples: business apps, portals, ...

Page 4: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Swazoo vs. Aida & Seaside

Swazoo

Seaside AIDA SmallWiki

Page 5: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Methods of building web pages

Embedded tags into HTMLjsp, asp, phpCincom Web Toolkit

ProgrammingJava ServletsStrutsAIDA/Web, Seaside

Page 6: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Embedded tags – SSP example

<html><head><title>Toyz Employees</title></head><body><table border=1><%

employees := (Toyz new) getEmployees.employees do: [:each |

response write: ‘<tr>’.response write: (‘<td>’, each number’, ‘</td>’).response write: (‘<td>’, each name, ‘ ‘, each surname, ‘</td>’).response write: ‘</tr>’].

%></table></body></html>

Page 7: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Enbedded commands 

ProsSimple for web designers

ConsFunctional logic get lost among presentation logic (HTML)“spaghetti” code – hard to maintain and extend

Page 8: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Programming – two examples

Aida:element := WebElement new.element table width: 500;

cell color: (self navigatorColor); cell colspan: 3; addText: self title header: 3; newRow; cell colspan: 3; addRulerSize: 1; newRow; cell addText: 'uptime: '; newCell align: #right; addText: (self printSeconds: self session site uptime); newRow.^self pageFrameWith: element title: self title .

Seaside:renderContentOn: htmlhtml form: [ html table: [

html tableRowWithLabel: 'Username‘ column: username.html tableRowWithLabel: 'Password' column: [html passwordInputWithCallback: [:v | password := v]].html tableRowWithLabel: 'Confirm Password' column: [html passwordInputWithCallback: [:v | confirmation := v]].html spacerRow.html tableRowWith: [ html submitButtonOn: #changePassword of: self. html space. html submitButtonOn: #cancel of: self ] span: 2] ]

Page 9: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Programming

ProsNo HTML, just one programming languageSeparation of presentation from modelComonents, reusability

ConsDifficult for web designersDifficult to move design into code

Solution: CSS !

Page 10: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Aida’s basic ideas

Object system = web of objects... connected with object references

World Wide Web = web of pages... connected with Url links

Page 11: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Aida’s basic ideas

Every object should present itself as web pageObject references should map to Url links and vice­versa – automatically!

Page 12: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

REST arhitectural principle

REpresentational State TransferWeb comprised of resources, addressed with Uniform Resource Locators (Url).

Example: http://www.eranova.si/aida

As answer to request: presentation of resourceOnly GET, PUT, POST etc

W3C Architecture of the World Wide Webhttp://www.w3.org/TR/2004/WD­webarch­20040705/

Building Web Services the REST Wayhttp://www.xfront.com/REST­Web­Services.html

Page 13: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

MVC on Web

Model­View­ControlerStrict separation of presentation from domain logicEvery domain object  has its presentation counterpart

domain objecta WebApp

domainobject

observee

Page 14: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Aida web application

Web

 ser

ver (

Sw

azoo

)

Urlmappings

Security

Sessions

Statistics

Admin

Model

Presentation

Sup

port 

serv

ices

Presentation framework

Page 15: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Web request path

O b j e c tW e b P a g eH T M L P a g e W e b A p p

W e b W i d g e t

W e b E l e m e n t W e b E l e m e n t W e b E l e m e n t

W e b S e r v e r

p r i n t W e b P a g e

Page 16: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Seaside concepts

ContinuationsControl flow easily definedSession like process/threadComponents: UI state and logicSubroutine­like calls of another components with results returned

Page 17: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Example – counter with Urls

Seaside:WACounter renderContentOn: html

html heading: count. html anchorWithAction: [self increase] text: '++'. html space. html anchorWithAction: [self decrease] text: '—'.

Aida:CounterApp viewMainself addTextH1: self observee count printString; addLinkTo: self observee text: '++' view: #increase; addSpace; addLinkTo: self observee text: '--' view: #decrease.

CounterApp viewIncreaseself observee increase.self viewMain

CounterApp viewDecreaseself observee decrease.self viewMain

 

Page 18: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Example – counter with buttons

Seaside:WACounter renderContentOn: html

html form: [ html heading: count. html submitButtonWithAction: [self increment] text: '++'. html space. html submitButtonWithAction: [self decrease] text: '--'].

Aida:CounterApp viewMainself addTextH1: self observee count printString; addButtonText: '++' action: #increase; addSpace; addButtonText: '--' action: #decrease.

CounterApp actionMainIncreaseself observee increase

CounterApp actionMainDecreaseself observee decrease

 

Page 19: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Example – counter with dialog

Seaside:

WACounter decrease count = 0 ifFalse: [count := count - 1]

ifTrue: [(self confirm: 'Do you want to go negative?') ifTrue: [self inform: 'Ok, let''s go negative!'. count := -100]].

 

Page 20: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Seaside programming

ProsFlow control in one placeEasy “subroutine pages” with results returnedBack button supported (really needed?)

ConsNot much OO, more procedural programmingUrl’s not REST­likeCross­linking pages difficult

Page 21: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Aida programming

ProsEvery domain object has persistent UrlAutomatic cross­linking of pagesREST principle fully supported

ConsGOTO like programming for more complex appscontrol flow not shown in one placeBack button not fully supported

Page 22: Comparison of Aida/Web and Seaside - Eranovaftp.eranova.si/aida/aida-vs-seaside-esug04.pdf · Comparison of Aida/Web and Seaside Janko Mivšek janko.mivsek@eranova.si. Vsebina Definition

Conclusion

Aida/webhttp://www.eranova.si/[email protected]

Seasidehttp://www.beta4.com/seaside2/Avi Briant [email protected]