Io And one quirky object system... That turned out to be useful... (blame ubuntu and freeglut for no full-screen) Overview of Talk Who am I? Io's place in the world Differential Inheritance Questions Who am I? name: Jonathan Wright irc: quag in #io on freenode email: quaggy@gmail.com web: www.quag.geek.nz Number 2 Year and a half Steve's Vision Overview of Talk Who am I? ***Io's place in the world*** Differential Inheritance Questions Buzz words OO Prototype based Message based Dynamic Actors Coroutines Futures Opengl Interpreted Macros Other words Experiment Unification of concepts Small syntax Young Unstable Purpose Gui framework Experiment Fun Dynamic 4 years old, 6 years to go Overview of Talk Who am I? Io's place in the world ***Differential Inheritance*** Questions Differential Inheritance 'Traditional' Objects (fast I promise) Meta Classes (fast I promise) Prototypes Differential Inheritance Benefits / Disadvantages Examples 'Traditional' Objects C++, and friends Classes Objects Inheritance Dynamic Classes Ruby, Python, Smalltalk, CLOS, and friends Classes become Objects Classes have classes Changing an Object's class on the fly Generating classes Meta Classes ... Prototypes Unify Copying Add more stuff Simplifies More dynamic Harder to optimise Differential Inheritance Delegating Add more stuff A is like B except for Examples Elephants OHPs Not New AI, Frames, Slots, Elephants Newton Script What can they do? Factoring! Behaviour Data What can they do? Classes Multiple Inheritance Mix-ins Classic Prototypes Scopes Namespaces Dynamic type (State pattern) What do we gain? Object System which is: Simple Flexible Dynamic 'multi-paradigm' What do we lose? The usual suspects: Speed Memory usage Example Time! elephant := {legs = 4, trunk = 1, ears = "large", size="massive"} Non-standard syntax elephant := Object clone do(legs := 4; trunk := 1; ears := "large"; size := "massive") Code to do it... Object curlyBrackets := method( result := Object clone call message arguments foreach(i, arg, if (arg name == "updateSlot" or arg name == "setSlot" or arg name == "setSlotWithType", result newSlot(arg argAt(0) cachedResult, call sender doMessage(arg argAt(1), call sender)) , result newSlot(arg name) ) ) result ) Dumbo is like elephant zooElephantSeenAsKid := {legs = 4, tusks = 2, size="massive"} dumbo := zooElephantSeenAsKid clone Dumbo has more data elephant := {legs = 4, eyes = 2, ears = "large", nose = "trunk"} dumbo := elephant clone dumbo name := "Dumbo" dumbo jacket := "red" Dumbo overrides existing data elephant := {legs = 4, tusks = 2, size = "massive"} dumbo := elephant clone dumbo tusks = 1 dumbo size = "smallish" Learn more about elephants elephant := {legs = 4, tusks = 2, size = "massive"} dumbo := elephant clone elephant seesMouse := method(freakout; runAway; cry) elephant tail := 1 Case Study: Java App Configuration Java tool to test an 'Integration Engine' Configurable message processing & manipulation server Receives, 'processes' and sends messages Graphical programming Can communicate using: tcp, ssl, directories, database, jms, http, soap, serial, ftp, smtp... Test Plan 1. Send message 2. Receive message 3. Check received message 4. Record results 5. Repeat Configuration per test message name or id Interface to send with (protocol, ports, hosts, paths...) success / failure test message file expected message files for each expected message file: comparison technique receive interface Configuration Summary Lots of information needed per message 1000s messages -> duplication Solution Lexically scoped Named interfaces & comparators Example test "edi to three xml" send using tcp, localhost, 8889 receive using tcp, localhost, 9998 message file "a.edi" expect file "x.xml" expect file "y.xml" expect file "z.xml" comparator xml failing "Tim broke it last night" Example message file "a.edi" expect file "x.xml" comparator xml succeeding expect file "b.edi" comparator edi failing Example group send using tcp, localhost, 8889 failing "not implemented functionality yet" test test group send using directory "/var/spool/msgs" succeeding "implemented last night" test test Experience Differential inheritance objects useful Questions http://iolanguage.com http://www.quag.geek.nz (The www is needed) #io on freenode Jonathan Wright