seaside portability

95
Portability in Seaside NYC Smalltalk December 10, 2009

Post on 18-Oct-2014

2.342 views

Category:

Technology


1 download

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

Page 1: Seaside Portability

Portability in SeasideNYC Smalltalk

December 10, 2009

Page 2: Seaside Portability

Julian Fitzell

Co-creator of Seaside

Independent consultant

Page 3: Seaside Portability
Page 4: Seaside Portability

694 classes

Page 5: Seaside Portability

6844 methods

Page 6: Seaside Portability

Platforms

Page 7: Seaside Portability
Page 8: Seaside Portability

© 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

Page 9: Seaside Portability

Pho

to: A

lexi

a´s,

flic

kr.c

omPortability

Page 10: Seaside Portability

Goals

Create consistent experience

Minimize platform changes

Isolate platform changes

Ease code updates (in both directions!)

Page 11: Seaside Portability

Namespacing:

WAObject#seasideUrl

Page 12: Seaside Portability

Syntax

Pho

to: p

ipp

, sxc

.hu

Page 13: Seaside Portability

Underscore Assignments

a _ 1b ← 2

no

Page 14: Seaside Portability

Brace Arrays

{ 1. 2. 1 + 2 }

no

Page 15: Seaside Portability

Array Constructors

#[ ‘string’, 123, Object new ]

no

Page 16: Seaside Portability

Byte Arrays

#[ 1 2 3 ]

no

Page 17: Seaside Portability

Variable Bindings

{Smalltalk.Object}

no

Page 18: Seaside Portability

Selection Blocks

{:i | i.is.permanent}

no

Page 19: Seaside Portability

Pragma

<javascript: 1.5>

ok

Page 20: Seaside Portability

ANSI

Pho

to: n

jd89

, sxc

.hu

Page 21: Seaside Portability

ANSI ProtocolsObject, Character, Boolean, nil, etc.

Block

Exception

Numeric

Collection

Date and Time

Stream

Page 22: Seaside Portability

Exceptions

Pho

to: i

ngyt

hew

ingy

, flic

kr.c

om

Page 23: Seaside Portability

Exception Protocols

#signal, #signal:, ...

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

#defaultAction, #isResumable

#pass, #outer, #retry, #resume

Warning, Error, Notification, ZeroDivide, ...

Page 24: Seaside Portability

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

no

Page 25: Seaside Portability

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

yes

Page 26: Seaside Portability

#defaultAction+

non-resumable exceptions

no

Page 27: Seaside Portability

“The exact behavior and result of this method is

implementation defined.”

Page 28: Seaside Portability

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

of the #defaultAction method is implementation defined”

Page 29: Seaside Portability

MyException signal

no

Page 30: Seaside Portability

Collections

Pho

to: i

jsen

doo

rn,s

xc.h

u

Page 31: Seaside Portability

Collection Protocols

Array, Set, OrderedCollection, Interval, ...

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

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

#asSet, #asOrderedCollection, ...

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

Page 32: Seaside Portability

Collection>>#=

no

Page 33: Seaside Portability

#withIndexDo:

no

Page 34: Seaside Portability

#keysAndValuesDo:

yes

Page 35: Seaside Portability

#pairsDo:

no

Page 36: Seaside Portability

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

yes

Page 37: Seaside Portability

Strings

Pho

to: L

ynne

Lan

cast

er, s

xc.h

u

Page 38: Seaside Portability

Symbol is a String

no

Page 39: Seaside Portability

#match:

no

Page 40: Seaside Portability

Object>>#asString

no

Page 41: Seaside Portability

#displayString

no

Page 42: Seaside Portability

Non-ASCII Strings

no

Page 43: Seaside Portability

Streams

Pho

to: L

ynne

Lan

cast

er, s

xc.h

u

Page 44: Seaside Portability

Stream Protocols

ReadStream, WriteStream, ReadWriteStream

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

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

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

Page 45: Seaside Portability

#next, at the endof a stream

no

Page 46: Seaside Portability

Check #atEnd first

yes

Page 47: Seaside Portability

#position#position:

no

Page 48: Seaside Portability

Datesand

Times

Pho

to: i

nya,

sxc

.hu

Page 49: Seaside Portability

DateAndTime+

Duration

yes

Page 50: Seaside Portability

TimeStamp

no

Page 51: Seaside Portability

Time

kinda

Page 52: Seaside Portability

Date

sorta

Page 53: Seaside Portability

Consistent

Missing

Conflicting

Cross-Platform Behaviour

Page 54: Seaside Portability

UnitTests

GreaseSlime

Use it!(Test it!)

Add it!Avoid it!

Consistent MissingConflicting

Page 55: Seaside Portability

Unit Tests

Pho

to: s

had

owki

ll, s

xc.h

u

Page 56: Seaside Portability

Done?

Page 57: Seaside Portability

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

Page 58: Seaside Portability

0

150

300

450

600

750

900

1,050

1,200

1,115

Unit Tests

Page 59: Seaside Portability

SlimeLint Tests

for Seaside

Pho

to: A

Sye

d, s

xc.h

u

Page 60: Seaside Portability

Rules to detectPortability Issues

Page 61: Seaside Portability

a _ 1.

b := { a + 2. 3 }.

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

Page 62: Seaside Portability

a _ 1.

b := { a + 2. 3 }.

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

Page 63: Seaside Portability

a _ 1.

b := { a + 2. 3 }.

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

Page 64: Seaside Portability

a _ 1.

b := { a + 2. 3 }.

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

Page 65: Seaside Portability

Rules to detectSeaside Bugs

Page 66: Seaside Portability

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

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

Page 67: Seaside Portability

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

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

Page 68: Seaside Portability

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

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

Page 69: Seaside Portability

GreasePlatform

CompatibilityLayer

Pho

to: D

arkS

ide,

sxc

.hu

Page 70: Seaside Portability

Pragmatic

Page 71: Seaside Portability

Minimal

Page 72: Seaside Portability

Unit Tested

Page 73: Seaside Portability

ANSI++

Page 74: Seaside Portability

Grease Features

Consistent object initialization

Consistent exception signalling

Common convenience methods

Platform-dependent behaviour

Unit tests

Page 75: Seaside Portability

GRObject class>>#new ^ self basicNew initialize

yes

Page 76: Seaside Portability

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

yes

Page 77: Seaside Portability

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

yes

Page 78: Seaside Portability

#trimLeft#upToLast:

#ifNil:#isCollection

yes

Page 79: Seaside Portability

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

yes

Page 81: Seaside Portability

73 Packages

Page 82: Seaside Portability

Common

Seaside-Core

Page 83: Seaside Portability

Platform-Specific

Seaside-Pharo-Core

Page 84: Seaside Portability

Test

Seaside-Tests-CoreSeaside-Tests-Pharo-Core

Page 85: Seaside Portability

Find incorrect layer dependencies

BONUS!

Page 86: Seaside Portability

Monticello

Page 87: Seaside Portability

Monticello

Declarative modeling

Distributed repositories

Optimistic code merging

Vendor round-tripping

Page 88: Seaside Portability

Monticello

☹ Slow with large repositories

☹ Inconvenient with many packages

☹ Awkward when renaming and moving between packages

Page 89: Seaside Portability

Future?

Page 90: Seaside Portability

Metacello

Declare and load package configurations

Express dependencies on other projects

Easily upgrade to newest versions

Page 91: Seaside Portability

Mason

Automate build process

Run tests for each package + dependencies

Page 92: Seaside Portability

Monticello2

Faster

Per-method version history

Better interface for projects with many packages

Easier to port? (uses Grease)

Page 94: Seaside Portability

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