seaside portability

Post on 18-Oct-2014

2.342 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Seaside is a rare example of software that runs on all the major current Smalltalk platforms: Pharo, Gemstone, GNU Smalltalk, Squeak, VA Smalltalk, and VisualWorks. This presentation to the NYC Smalltalk users group looks at some of the tools and techniques the Seaside team uses to make life as easy as possible for the frameworks porters.

TRANSCRIPT

Portability in SeasideNYC Smalltalk

December 10, 2009

Julian Fitzell

Co-creator of Seaside

Independent consultant

694 classes

6844 methods

Platforms

© Copyright 2007 Instantiations, Inc. VA Smalltalk, VA Assist, WidgetKit, and WindowBuilder are trademarks of Instantiations. All other trademarks mentioned are the property of their respective owners.

www.instantiations.com 1-800-808-3737Build Quality Software

Development ToolsA rich set of development tools includes a debugger, browsers, inspectors, application builders, and a performance monitor.Packager (Dev Tool) creates a runtime image including only necessary classes resulting in a smaller footprint.AsyncCallout, an extension of the platform function API, allows developers to make a platform function call in a separate virtual machine thread.Reports feature enables the creation of hardcopy and/or screen reports on any object that can be used in the VA Smalltalk environment, including parts provided in the Database and Communications features.

Custom Controls Popular WidgetKit technologyColumnar List boxes, table widgets and hierarchical listsCustomizable image buttons, toggles and value setsVertical, horizontal and circular gaugesData aware spin buttonsWindows 95/98/NT/2000 Notebook widgetSplitbar widget

!

!

!

!

!

!

!

Communications A set of parts supports communication with other computers using MQ series transactions.A set of parts supports communication with other computers using TCP/IP protocols.Socket Communications Interface is an API providing full support for TCP/IP protocols, as well as secure communications using SSL. The API uses OpenSSL, an implementation of SSL/TLS.

Database High-performance, robust support for DB2Support for Oracle through v10Support for any database which supports the ODBC interface.

Server SmalltalkServer Smalltalk (SST) provides a client/server framework flexible enough to accommodate various distributed architectures.Server Workbench is a cross-development envi-ronment used in developing distributed process-ing, web hosting, and other server applications. Target deployment environments include all VA Smalltalk platforms and z/OS using IBM’s VisualAge Smalltalk Server for OS/390 and z/OS.

Web ServicesA self-contained, modular framework, capable of creating, deploying and hosting web services.

External Interface SupportXML Support enables XML–Smalltalk object mapping, includes a server interface via XML request handlers and reading of remote resources via TCP sockets using HTTP requestsOLE Support enables an application to use OLE clients and custom control services.Domino Connection allows an application to retrieve and work with Domino documents as well as access Notes mail system.

!

!

!

100% VisualAge compatibleVA Smalltalk is a modern software development environment that is 100% VisualAge compatible. VA Smalltalk enables developers to quickly construct applications that are portable, highly scalable, simple to maintain, and fit easily into existing infrastructures.

Other Software RequirementsDatabase

DB2 Universal Database (Windows, AIX, Linux, Solaris)ORACLE 8i (8.1.6), 9i or 10

DominoLotus Notes (Windows only) [Not supported on Linux, AIX, Solaris]

VA Smalltalk’s HTML DocumentationTCP/IP protocolMicrosoft Internet Explorer 5.0 or later (Windows)Netscape 4.51 or later (Win, Linux, Solaris, AIX)Firefox 2.0 or later (Win, Linux)Opera 9.02 or later (Windows)

!

!

!

!

!

!

!

!

!

EMSRV 7.1a Library ManagerNetware 4.2 or 5.1OS/2 Warp 4.0 + FP11OS/2 Warp Server for e-BusinessWindows ME - EMADMIN onlyWindows 2000, 2000 Server, Advanced ServerWindows XP ProfessionalWindows Server 2003Windows Vista Business, Enterprise, or UltimateSun Solaris Version 8 or 9HP-UX Version 11.0 or 11iAIX Version 5.1, 5.2 or 5.3Red Hat Linux 9 and Advance Server 2.1SuSE Enterprise 10

!

!

!

!

!

!

!

!

!

!

!

!

!

Supported ConfigurationsOperating System Hardware PlatformWindows ME, 2000, XP, Server 2003, Vista . . . . . . . . . . . . . . . 300MHz PC, 256MB RAM, 400MB diskRedHat Linux 9, Enterprise AS 2.1, SuSE Linux . . . . . . . . . . . Pentium 300MHz PC, 128MB RAM, 400MB diskSun Solaris 8, 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SPARC workstation or server, 64MB RAM, 200MB diskAIX 5.1, 5.2, 5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RISC System/6000, POWERStation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . or POWERServer, 128MB RAM, 400MB disk

For detailed system requirements visit www.instantiations.com/VAST

Download a risk-free trial copy:www.instantiations.com/VAST/download

Award-winning VA Assist™ technologyUniversal Drag/DropPowerful change propagation toolsCustomizable ToolbarsColor Code Syntax (Windows only)Dynamic & Batch-Oriented Spell CheckingAuto-Spell CorrectionVersion RenamingClass History/FindVersion TemplatesString SearchApplication Filtering

!

!

!

!

!

!

!

!

!

!

!

!

Enhanced DebuggerEnhanced InspectorsCode SynchronizationLocate ApplicationsLocate DependentsRevision NotesRelease All LatestAbbreviation ExpansionPopup Sender/ImplementorsBrowse Changes Including Required MapsEmbedded mode for seamless integration with the Composition Editor

!

!

!

!

!

!

!

!

!

!

!

Ergonomic Enhancements

Pho

to: A

lexi

a´s,

flic

kr.c

omPortability

Goals

Create consistent experience

Minimize platform changes

Isolate platform changes

Ease code updates (in both directions!)

Namespacing:

WAObject#seasideUrl

Syntax

Pho

to: p

ipp

, sxc

.hu

Underscore Assignments

a _ 1b ← 2

no

Brace Arrays

{ 1. 2. 1 + 2 }

no

Array Constructors

#[ ‘string’, 123, Object new ]

no

Byte Arrays

#[ 1 2 3 ]

no

Variable Bindings

{Smalltalk.Object}

no

Selection Blocks

{:i | i.is.permanent}

no

Pragma

<javascript: 1.5>

ok

ANSI

Pho

to: n

jd89

, sxc

.hu

ANSI ProtocolsObject, Character, Boolean, nil, etc.

Block

Exception

Numeric

Collection

Date and Time

Stream

Exceptions

Pho

to: i

ngyt

hew

ingy

, flic

kr.c

om

Exception Protocols

#signal, #signal:, ...

#on:do:, #ensure:, #ifCurtailed:

#defaultAction, #isResumable

#pass, #outer, #retry, #resume

Warning, Error, Notification, ZeroDivide, ...

[ ... ] on: Error do: [ ... ]

no

[ ... ] on: Error do: [ |err| ... ]

yes

#defaultAction+

non-resumable exceptions

no

“The exact behavior and result of this method is

implementation defined.”

Unless the exception is resumable, “the action taken upon completion

of the #defaultAction method is implementation defined”

MyException signal

no

Collections

Pho

to: i

jsen

doo

rn,s

xc.h

u

Collection Protocols

Array, Set, OrderedCollection, Interval, ...

#do:, #collect:, #select:, #reject:, #detect:, ...

#includes:, #isEmpty, anySatisfy:, ...

#asSet, #asOrderedCollection, ...

#at:put:, #at:ifAbsent:, #removeKey:, ...

Collection>>#=

no

#withIndexDo:

no

#keysAndValuesDo:

yes

#pairsDo:

no

1 to: aCollection size by: 2 do: [ :i | ... ]

yes

Strings

Pho

to: L

ynne

Lan

cast

er, s

xc.h

u

Symbol is a String

no

#match:

no

Object>>#asString

no

#displayString

no

Non-ASCII Strings

no

Streams

Pho

to: L

ynne

Lan

cast

er, s

xc.h

u

Stream Protocols

ReadStream, WriteStream, ReadWriteStream

#close, #isEmpty, #position, #reset, ...

#do:, #next, #peek, #upTo:, ...

#cr, #nextPut:, #nextPutAll:, ...

#next, at the endof a stream

no

Check #atEnd first

yes

#position#position:

no

Datesand

Times

Pho

to: i

nya,

sxc

.hu

DateAndTime+

Duration

yes

TimeStamp

no

Time

kinda

Date

sorta

Consistent

Missing

Conflicting

Cross-Platform Behaviour

UnitTests

GreaseSlime

Use it!(Test it!)

Add it!Avoid it!

Consistent MissingConflicting

Unit Tests

Pho

to: s

had

owki

ll, s

xc.h

u

Done?

0

150

300

450

600

750

900

1,050

1,200

Seaside 2.5 Seaside 2.6 Seaside 2.7 Seaside 2.8 Seaside 3.0

131

4444

20

Unit Tests

0

150

300

450

600

750

900

1,050

1,200

1,115

Unit Tests

SlimeLint Tests

for Seaside

Pho

to: A

Sye

d, s

xc.h

u

Rules to detectPortability Issues

a _ 1.

b := { a + 2. 3 }.

c pairsDo: [ :a :b | a raisedTo: b ]

a _ 1.

b := { a + 2. 3 }.

c pairsDo: [ :a :b | a raisedTo: b ]

a _ 1.

b := { a + 2. 3 }.

c pairsDo: [ :a :b | a raisedTo: b ]

a _ 1.

b := { a + 2. 3 }.

c pairsDo: [ :a :b | a raisedTo: b ]

Rules to detectSeaside Bugs

html div with: ‘Hello World’; id: ‘message’.

html updater id: ‘message’; callback: [ :r | html text: ‘Bye’ ]

html div with: ‘Hello World’; id: ‘message’.

html updater id: ‘message’; callback: [ :r | html text: ‘Bye’ ]

html div with: ‘Hello World’; id: ‘message’.

html updater id: ‘message’; callback: [ :r | html text: ‘Bye’ ]

GreasePlatform

CompatibilityLayer

Pho

to: D

arkS

ide,

sxc

.hu

Pragmatic

Minimal

Unit Tested

ANSI++

Grease Features

Consistent object initialization

Consistent exception signalling

Common convenience methods

Platform-dependent behaviour

Unit tests

GRObject class>>#new ^ self basicNew initialize

yes

GRError class>>#signal “VW implementation” ^ self raiseSignal

yes

Object>>#greaseString “Squeak implementation” ^ self asString

yes

#trimLeft#upToLast:

#ifNil:#isCollection

yes

GRPlatform current base64Decode: 'aGk='.GRPlatform current addToStartupList: SomeClass.GRPlatform current openDebuggerOn: anException.

yes

73 Packages

Common

Seaside-Core

Platform-Specific

Seaside-Pharo-Core

Test

Seaside-Tests-CoreSeaside-Tests-Pharo-Core

Find incorrect layer dependencies

BONUS!

Monticello

Monticello

Declarative modeling

Distributed repositories

Optimistic code merging

Vendor round-tripping

Monticello

☹ Slow with large repositories

☹ Inconvenient with many packages

☹ Awkward when renaming and moving between packages

Future?

Metacello

Declare and load package configurations

Express dependencies on other projects

Easily upgrade to newest versions

Mason

Automate build process

Run tests for each package + dependencies

Monticello2

Faster

Per-method version history

Better interface for projects with many packages

Easier to port? (uses Grease)

Summary

Write tests!

Avoid extended syntax

Use ANSI where possible

Package out platform-specific code

Slime/Lint for what you can’t use, Grease for what you can

top related