Notes for Rubyconf.new(2003)
- Eric Hodel - Working in the Garden: Web Apps with Borges
- Seaside - web app framework in Smalltalk with continuations
- Borges - port of Seaside to Ruby using a code porting tool
- class methods -> constructor
- no default args in smalltalk
- Dispatcher - register Application with dispatcher
- Application - manages sessions and handlers
- Session - manages user's state
- Session#respond (magic)
- save continuation for backtracking
- build action key for saved continuation
- build page and send it back to the user (using Filter)
- Filter - allows redirection
- can be used to disable backtracking
- Controller - building blocks of apps
- #call - passes control to a component
- #render
- Sample controller: Batched List
- Task
- Renderer
- uses methods and blocks
- supports css
- Documentation for Borges - none :(
- Drawbacks
- high overhead
- not designed for simple dynamic content
- Benefits
- makes writing web apps easy
- Demo: sushiNet (port of smalltalk demo)
- Restarting the server - lose history (backtracking info), but session data can be stored in a database
- Bookmarking - it is possible to add a special field for bookmarking (session id would go away, see wiki as an example)
- Save in session - stored globally; save in component - stored in history
- James Britt - The state of XML processing in Ruby
- (an overview of XML processing with Ruby; A survey of applications, libraries, and tools)
- James Britt - Rimport, Blogtari, ruby-doc.org, rubyxml.com
- Assumptions:
- you use the best tools for the task
- you know what XML is
- Environment: Ruby 1.8 on RH Linux 9
- Standard in 1.8:
- Rexml - "Ruby Way" API
- not a W3C DOM (which is not a nice API)
- XML-RPC
- SOAP - Remote calls using XML to marshal requests
- WSDL - service discovery
- General parsers
- Rexml
- XMLparser - an interface for expat (which is a fast non-validating parser)
- XMLscan - possibly the fastest pure ruby parser
- NQXML - pure Ruby, non-validating XML parser
- SAX-style streaming, DOM-style tree parser
- context-sensitive callback mechanism
- libxml - Ruby bindings to libxml2 (part of Gnome)
- SAX and Stream parsers (use callbacks; useful for large docs)
- Xmldigester - based on Digester from Apache project
- RubyDigester - latest version of Xmldigester?
- Rexml - has stream parser in addition to DOM API (but not SAX)
- Pull parsers
- Xampl-pp - pure Ruby, non-validating pull parser
- does not use DOCTYPE
- sparse documentation
- W3C DOM Parsers - standard, but not Rubyish
- libgdome-ruby
- MWDOM - pure ruby (?) DOM-level 2 module
- RSS parsers
- RSS
- a content syndication format
- many different versions, not all compatible with each otehr
- RSS-Ruby / Ruby-RSS
- Chad's version - handles RSS 0.9x
- Austin's version - handles RSS 2.x (and doesn't handle "messy" RSS)
- Ruby-RSS (Kouhei Sutou)
- Supports RSS 1.0 with validation but also works with 0.9x and 2.0
- RcRSS
- tries to parse feeds regardless of type
- doesn't parse broken feeds
- RDF parsers (RDF == model for representing named properties and their values)
- Redland RDF Application Framework - C
- Ruby RDF
- pure ruby; uses expat or Rexmpl
- storage is via Postgresql or Mysql
- manipulation and query via Squish2SQL
- not "production grade"?
- James would like to see:
- Serialization
- clxmlserial - marshals Ruby objects to/from XML
- Xmarshal - XML version of marshal
- Configuration files
- Xml-config
- Xml-smple (port of Perl's XML::Simple)
- provides nested hash/array object with Configuration data
- Transformation
- XSLT - the "W3C way"
- libxslt - ruby bindings for Gnome libxslt library
- Sablot - wrapper around Sablotron
- xslt4r - pure ruby XSLT parser (requires and old version of xmlscan)
- Graphcs
- SVG - XML syntax for describing pictures
- Ruby-SVG - SVG generator
- Ruby WebStat - creates SVG from Apache logs
- (James began to run out of time here)
- Schemas - tells you if a document meets certain constraints
- C-based libraries best
- Ruby-NG support may be added to Rexml
- RPC (both of the following come with Ruby 1.8):
- Jabber
- Databases
- BDB
- RQDS - command-line queries to various sources; results in XML
- Not-quite databases
- SIE - simple interface engine?
- OOo extract - for Open Office docs
- Templating - may not produce 100% correct XML
- Xmlification
- Misen - text generation using hashes (can produce LaTeX)
- Ruby-tmpl
- Xtemplate
- Utilities
- Icqlite-history - lightweight ICQ chat
- Qant - Ant preprocessor
- rd2rexml
- rdoc - can create XML output
- rimport - rdoc XML output to ri format
- ruby-htmltools
- Special Libraries (?)
- ruby-ice
- Ruby BEEP Core
- myopx
- Francis Hwang - Object-relational mapping with Lafcadio
- Ruby interface to MySQL
- Side effect: makes unit testing really easy
- Status: "production-ready"
- (notes here reference the handout)
- p.1
- 1 - fields have names and classes
- need class to know what SQL type to use
- in Ruby, class should inherit from DomainObject
- 2 - Lafcadio needs an integer primary key for all tables
- 3 - pass native Ruby types to constructor
- objId will be nil until object is committed
- 4 - ObjectStore is a singleton
- 5 - delete by setting the delete flag to trace and them committing
- 6 - methods can be implemented in pure Ruby
- p.3
- 1 - would be nice to not have to create an empty class if there are no Ruby methods to add
- Lafcadio will only count object if in a link
- p.4
- Overriding table defaults
- Selecting collections
- Assumption: most selections involve finding 1 or 2 rows, changing them, then committing
- p.5
- Test-Driven Design
- Lafcadio allows us to pull the database out of the unit test
- inheriting from LafcatioTestCase gives us a "mock ObjectStore"
- Two bad approaches to abstracting away SQL:
- Vapor (like Lafcadio, but works wtih PostgreSQL) example
- forces the user to build the query as a string
- Lafcadio example
- much too verbose, but lets us run unit tests on the query
- Better example using block-driven querying (not implemented)
- problem: how to convert between block and SQL
- see "criteria" library from Ryan Pavlik
- Future
- support more flavors of SQL
- add more documentation
- Steve Tuckner: Ruby World: [Not] Implemented
- ((Uisng Ruby for commercial application development)
- Questions:
- How do I convince my boss? - Don't tell him
- How do I convince my co-workers? - Give them no choice
- How do I convince my myself? - Just do it
- Problem: "Fax server in a box"
- need windows app for outbound faxes
- select cover pages, view faxes, etc.
- Solution: Use Ruby
- VRuby/SWin (to get native look and feel)
- Win32OLE
- Exerb
- Win32 library (for accessing registry, etc.)
- Ran into some problems:
- VRuby + threads --> 100% CPU
- Work-around: use a timer
- Suggestion from Rich Kilmer: user drb or tcp/ip to talk b/t multiple processes
- Should have used test-first (didn't know how or have a library for writing unit-testing gui)
- Didn't have a good debugger on windows (eclips did not work)
- exerb GPF'd on some machines (seems to be fixed on 1.8)
- VRuby/SWin
- Amazing
- but... lacks depth (e.g. ugly default font for windows, tabbing between fields does not work)
- no adequate GUI builder (formdes was not good enough)
- no layout functionality (had to code exect position of widgets)
- GUI objects not created in "normal" Ruby style
- Win32OLE GPF on 1.8 - build options?
- didn't work on 1.8 for Steve
- Cover page completely uncustomizable - problem with fax library they used
- exerb - by default only works with 1.6.8
- generates exec with ruby icon
- TIFF viewer was flaky - again, problem with the fax lib
- Lessons
- Do more research up front to mitigate panics
- Take more time to build scaffolding for testing
- Don't choose Ruby just because it is fun
- VRTools - adds onto VRuby:
- semi-normal construction of objects
- tabbing
- list/tree context popup menu
- layout controls
- test scaffolding
- Demo of test application
- Demo: test-first for a GUI
- App: Username/Password entry; OK/Cancel buttons
- Setup method: create the dialog (use mock classes via "require" magic)
- Simple test: test_caption - assert that the caption is what was expected
- Control of app is lost when GUI loop is entered
- Solution: pass scaffolding a block that runs when the dialog comes up
- Another test: test_simple_login
- Jack Herrington - Generating code with Ruby
- (Code Generation with Ruby / A tale of two problems)
- Two problems:
- Your project needs a lot of code (and a lot of it is redundant)
- You want to use Ruby
- Code generation range
- Small generators/one-liners
- Tier generators
- Application generators
- Good wizard: Active generation
- maintains a model of what you want to build (so you can make modifications in "safe zones")
- Bad wizard: leaves you stranded (passive generation)
- Code munger
- source --> code munger --> output
- Some code mungers include:
- XDoclet
- RDoc
- RPC Layer Generation
- Inline code expansion (possible an antiform of code generation?)
- Pseudo source --> inline code expander --> source
- Makes debugging difficult
- Mixed code generation
- Source --> Generator --> Source
- Commented block gets turned into code; commented block remains in the generated output
- Mixed code generation examples:
- MFC class wizard - problem: comments and code get out of sync
- Snippets
- Codify (C#)
- Model-Driven Generation
- Concept/Model --> Generator --> Code
- Tier Generation
- Partial Class Generation
- instead of building ALL our code, only build the core
- Advantages to code generation
- Quality - not perfect, but consistent quality
- Consistency
- change code in ONE place
- API's are consistent because they all come from the same source
- Productivity
- small loss of productivity first time around
- much improved productivity in later passes
- Abstraction
- one more layer of indirection
- makes porting code easier in some ways
- Model-driven architecture
- Standard from the OMG
- UML --> Platform-Independant Model --> Platform-Specific Model --> Code
- Big players like Compuware
- Loosely defined
- Still in development
- See the "Andromeda" project
- Well-written generators
- Multi-layered (like a web app or GUI)
- Keep system-specifics to a minimum
- Separates deployment and model specifics
- Use templates
- Creates output that can be used to feed other downstream generators
- What to look out for
- Whiteboard hell (too much talk about how to build the generator)
- Solution: use partial class generator (only build the parts we understand today)
- Write the code before you generate
- Generate what you understand (don't depend on wizards)
- Maintain the generator (never store the output of the generator in CVS)
- Model Generation Targets
- SQL Physical Schemes
- Database Access Layers
- User Interface (not popular, because you need to know what lies beneath the GUI)
- Remote Procedure Layers
- Data conversion
- What about Ruby?
- Why Ruby
- Why not C/C++/Java
- too hard, lots of code
- too confusing when the code being generated is in the same language as the code generator (which part is the code and which part is the generator?)
- XSLT?
- poor syntax, spawn of satan, but worth using
- Where to go from here
- Read: _Code Generation in Action_ and _Pragmatic Programmer_
- Check out the Code Generation Network
- Samples from CGIA website
- Tools: Rexml, ERB
- Get started!
- Roundtable with Matz
- Q: (James Britt) optional typing in Ruby 2.0
- (Matz) based on "signature" ("strong duck typing")
- (Matz) no static typing based on class or module
- Q: (Chad Fowler) packaging - can we more dictatorship from our benevelolent dictator on this issue?
- (Matz) Matz will not write the requirements, but will pick an implementation
- Q: (David Alan Black) Proc.new vs proc { } - they are different; why?
- (Matz) Proc.new - works like "objectified block"
- (Matz) proc - works like function call
- (Matz) proc function will be made obsolete (!?!)
- (Matz) David will henceforth never mention the proc function
- Q: Ruby language specification
- If we have a definitive lexer/parser (de-coupled from the Ruby runtime), could that serve as a spec?
- Could test code be part of the spec?
- (Matz) Matz does not think Ruby can be represented in EBNF
- Is the C API part of Ruby (as a spec)?
- (Matz) Rite will have a compatibility layer
- Q: (Hal Fulton) Can we get more of the Japanese documentation translated?
- pay someone, perhaps?
- translate Ruby Hacker Guide
- Q: (Paul Brannan) backward-compatibility; how will it be dealt with in Ruby 1.9/2.0?
- (Matz) 1.8 will stay 1.8 forever
- (Matz) 1.9 is the testbed for 2.0/Rite
- (Matz) 2.0 will be stable for a long time (but different from 1.8)
- Perl is going through changes in Perl 6
- Could FreeRIDE's refactoring do automatic updates for 1.8 -> 2.0 code?
- No; too hard to determine programmer's intent
- (Matz) Ruby's changes should look not like this: [hand moving up in a smooth slope] but like this: [hand moving up in staircase pattern]
- we should get warnings about things that might/will change
- code defensively; Ruby's ability to evolve is a good thing
- Q: Win32 - when will forking model be implemented cleanly?
- (Matz) Throw away stdio/Berkley layer
- (Matz) Matz is open to patches that convert stdio to Win32 calls
- select vs. WFMO
- Q: (David McCorkhill) Ruby regexes are close to Perl's; Perl6's regexes are changing; will Ruby move toward Perl6-style regexes?
- (Matz) no plans to adopt perl6 regex features
- (Matz) open to adding some perl6 regex fetures if someone asks for them
- (Matz) Onigurama will be adopted in Ruby 1.9
- Q: (Ryan Davis) Ruby is happy being a "slow" language; what optimizations could be done, however?
- Q: (Shashank Date) Local parameters in a block/scope
- (Matz) In Ruby 2.0, all block parameters will be local
- (Matz) In Ruby 2.0, no other local vars in a block
- (Matz) In Ruby 2.0, new variables inside a block will still exist when the block exits
- Q: (Gennady Bystritsky) How do people in Japan cope with compatibility problems in Ruby?
- (Matz) feeling is not different from people in US
- (Matz) Changes make Ruby better, but may break code (feels good and bad at the same time)
- (Matz) 1.8 has improvements in performance, so they cope with the changes
- Q: 1.9 will be what kind of release? (stable/devel)
- (Matz) 1.9.0 will be devel; 1.9.1 will be stable, but testbed for 2.0
- Q: (Kurt Dresner) Is Ruby more popular than Python in Japan
- (Matz) More popular than Python but not Perl
- Q: (Joey Gibson) What led Matz to give the # sign dual life (comments and interpolation)?
- (Matz) "It just popped into my mind"
- Q: (Steve Tuckner) Why is Ruby better than perl?
- Someone said "sounds like the beginning of a really bad flame war..."
- (Matz) not right person to answer, never been perl programmer
- (Matz) Ruby came after perl, so if it is worse it is not useful
- (Matz) Poeople come to conference because they like Ruby
- (Matz) One more note about changes
- (Matz) We don't want to limit changes; we want to maximize # of changes at point of 2.0 so it will be around a long time
- Shashank Date - Programming LEGO MINDSTORMS with Ruby
- Standard disclaimer
- Introduction to Mindstorms (what is RIS, RCX, etc.)
- Memory layout: 16K OS "firmware", 10K data structures, 6K user
- Lego software environment - generates Mindstorms bytecode
- RCX virtual machine: two execution modes
- program/download - robot can move, but is limited
- direct/interactive - robot is stationary, but can be more complex
- Demo (by Rutvik, age 11)
- Robot program built with Mindstorms software
- event handler for touch sensor
- repeat { go forward 1 sec } until light sensor activated
- event handler for light sensor
- repeat { go forward 1 sec } until touch sensor activated
- main block
- repeat { go forward 1 sec }
- sofware compiles program to bytecode, then uploads it to RCX
- Writing software without RIS
- Four options:
- Design your own VM
- Design new language but use existing VM (e.g. NotQuite C)
- Replace existing VM with your favorite (e.g. legOS, etc.)
- Use your favorite language to interface with the brick -- we will use Ruby
- Scenarios for students using Mindstorms in a lab
- Dedicated scenario: an IR interface per developer machine
- Networked scenario:
- drb server on a machine with many IR interfaces
- drb client on developer machine
- Server pseudocode and real drb server code
- Real drb client code
- Byte code commands - Message structure and reply structure
- Future directions
- more features
- porting to Linux
- GUI
- web enabling
- assembler/disassembler for LASM (Lego ASM)
- write the VM
- Lego books/resources
- Finally, the demo
- David Alan Black - (...aside)
- (comments on and implications of a quasi-framework)
- Questions:
- Who's going to use this ad hoc program?
- Am I just throwing it away if I don't share it?
- Goals
- Allow students to give anonymous feedback to professors
- Allow professors to respond without knowing who the student is
- Supply arbitrarily long exchanges in "one-way mirror" fashion
- Give David something to code
- Design
- Based on concept of "scenarios" (e.g. if user not logged in and user does xyz, then...)
- If scenario passes the test, a callback is made
- Implementation
- Rublog::Template
- YAML storage of data
- Program or framework?
- (reinventing the wheel vs. just writing code)
- How much to encapsulate and abstract?
- Can the costs and benefits of code reuse be weighed up front?
- Discussion on these questions followed...
- Repository for web framework ideas? (half-baked for ruby)
- How do you throw code out there that someone might be able to use
- More intelligent than a wiki (it should know something about the code it holds)
- Michael Granger - Building Environments for MUES
- MUES = Multi-User Environment Server
- Purpose: server framework for FaerieMUD -OR- any kind of interactive network environment
- Why another MUD?
- most others are too restrictive
- none of them use Ruby
- Design Goals
- provide an environment for multi-user gamers
- make no assumptions about what an environment is
- too general is better than too specific
- Engine
- Event subsystem
- two event queues in two different $SAFE levels
- thread pool
- combination of asynchronous / publish+subscribe
- worker threads dequeue and dispatch events
- manager thread creates and kills worker threads
- IO Subsystem
- reactor+thread to drive sockets
- "bucket brigade" to filter, insert, and extract events
- telnet w/ full RFC-complient transport
- two simple filters:
- Questionnaire (e.g. login)
- ParticipantProxy (more later...)
- Environments
- defines 3 things:
- interaction context (e.g. "what room?")
- participant
- roles (e.g. for chess, black side/white side)
- Defining a context
- Criteria
- long-running, stateful connections
- continuous interaction between users
- persistence of state between sessions
- Suggestion applications
- MORPG/MUD/MOO
- chat server
- collaboration environment
- virtual meetin' place
- Defining roles
- Can be category (mortal/guest/etc.) or a token (Foo the Great)
- Defining participant
- Instance of a role
- Representation of a user
- Translates input from user into an action
- Beginning a new environment
- .rb file in environments/ directory to contain environment class
- subclass of MUES::Environment
- Implement 5 methods
- start - immediately after environment is loaded
- stop - immediately before environment is unloaded
- getParticipantProxy - returns player object (adding plater to list of players)
- removeParticipantProxy - probably called by environment
- getAvailableRoles - called by engine; returns MUES::Role object for each role
- Defining participants
- Inherit from MUES::PartipantProxy
- Implementation
- Execution Models
- synchronous - single-threaded
- asynchronous - objects that have action have their own thread
- hybrid - asynchronous, but event-driven
- Persistence
- MUES provides ObjectStore that uses Berkley DB
- Game Rules
- physics - basic rules of context
- NPCs
- Valid moves
- Ambient events (e.g. weather, ecology, astronomy)
- Demo of sample environment
- Nathaniel Talbott - A clueless Ruby hacker explores security
- What is security?
- Who implements security? - users
- e.g. users must be taught not to write down passwords, etc.
- the system must not be so hard that users bypass it
- When should security be considered?
- all the time
- at the beginning
- as we develop
- when we release
- in production
- Where should security be implemented?
- what are the potential vulnerabilities?
- start with the interfaces to the system
- How can Ruby help?
- Simpler code (easier to understand)
- Solves memory management issues (bounds checking, null pointers, etc.)
- $SAFE
- digests (md5, sha, etc.)
- openssl (extension, drbssl://, etc.)
- logging
- Case profile
- security != encryption
- What Nathaniel did
- limited drb - some hacks Nathaniel used to make drb more secure
- used openssl
- changed $SAFE to 1
- used a hash instead of a session - hash state so it doesn't have to be stored
- checked tainting on database query
- used a severely limited user account
- chroot'd the server
- eventually will want easy-to-read audit log
- Conculusion
- quote from Bruce Schneider
- Questions
- Unit tests for security? No -- need AI for good tests
- rubdo
- has encrypting drb affected performance? - not noticeably, but no benchmarks
- Brett Pettichord - Teaching Ruby to testers
- some programming is necessary for testing, but it shouldn't be hard
- Class overview
- In-class network
- wired and wireless network
- bring your own laptop
- Labs
- Getting started with Timeclock
- Manual testing (to see how hard it is and to get a feel for what needs to be tested)
- use irb to control IE via iec.rb (internet explorer controller)
- advantage of testing webpages this way is that the javascript gets tested in addition to the CGI
- Automated version of the above test
- Testing regexes vs. using DOM
- How to do this on Linux?
- Problem is doing this on Mozilla, not doing this on Linux
- (once it is on Mozilla-Win32, it can easily be ported)
- Chad poitned out that Konqueror can be scripted using XMLRPC
- Changes planned
- Don't use a network (due to Blaster problems)
- Use USB drives to share code
- Teach pair programming
- Improve IE controller
- Add names to Timeclock controls
- Move web services into a new class
- Add language comparison and overview
- Matz - Visions for the Future (Keynote)
- Ruby is good enough, but nothing is perfect
- "How Ruby Sucks"
- slow
- complex
- surprising
- inconsistent
- bad embedding
- no native threading, no M17N
- Ruby 2 / Rite
- Slightly incompatible with 1.8, but better syntax
- Rite - bytecode-based VM
- Path to Ruby 2
- After 1.8.1 released, start on 1.9.x
- 1.9.x: experiment with Ruby2 syntax, M17N features, Onigurama, generational GC
- then, move to Rite
- the hard way
- vaporware for a long time
- Matz needs to clarify syntax, be free from 1.8
- still waitong for "Son-Shi" (guru) to write VM :)
- Local variable scopes
- old behavior: variables created in the block are block-local
- new behavior:
- no block-local variables by assignment
- block parameters always local (even if vars with same name already exist)
- Instance variables
- @foo - can be accessed from subclass
- @_foo - local to class/module
- (or, maybe, other way around)
- Constant lookup
- Current: surrounding class, nesting class, base class, const_missing to raise error
- New: superclass, surrounding nesting class (1 level only), const_missing
- Class variables
- Current: surrounding class, superclass, error
- New: all class variables local to the class/module
- Statement and expression
- "foo" "bar" --> error
- (long_expression \n + another_long_expression) --> valid
- (abc; def) --> error
- Multiple values
- a,b,c = x (where x = [1, 2, 3])
- does it produce a=1, b=2, c=3 or a=[1, 2, 3], b=nil, c=nil?
- (source of confusion)
- could we raise an exception if arity on left and right don't match?
- div, mod = x.divmod(y) --> should this be an error?
- Solution
- separate arrsys and multiple values strictly in syntax -OR-
- represent multiple values by subclass of Array
- both have drawbacks, but are better than current behavior (which is yield handles multiple values, but return does not)
- Matz has no concrete idea yet, but says something must be done
- Ryan Davis believes that consistency is important ("don't mess with my objects!"; divmost should return multiple values instead of an array)
- long discussion followed here...
- Method visibility
- Now: private/public/protected all in one namespace
- Perhaps put private into separate namespace (maybe, just an idea)
- (currently creating method "print" messes up namespace for subclasses)
- Huge incompatibility
- Range in condition
- print line if f.lineno == 1 .. f.lineno == 2
- .. works like awk
- ... works like sed
- should be removed or changed; ideas wanted
- Keyword argument
- def foo(a, b : 42, **keys); p [a, b, keys]; end
- a is a positional argument
- b is a keyword argument (only need colon, not 42)
- foo(1) #=> [1, 42, {}]
- foo(2, b:5) #=> [2, 5, {}]
- foo(3, b:4, c:6) #=> [3, 4, {:c=>6}]
- foo(1, 2, 3) #=> error? (Matz is undecided)
- foo(:foo=>1, :bar=>2, b:3) #=> [{:foo=>1, :bar=>2}, 3, {}]
- New hash literal
- { a:45, b:55, c:65 } will be equivalent to { a=>45, b=>55, c=>65 }
- Method combination
- Hooks can be added to arbitrary methods
- def foo:pre
- def foo:post
- cannot affect return value
- def foo:wrap
- calling super in this method calls the original method
- args and return value can be affected
- more than one wrap method results in calls being stacked in order of definition
- will def return an object? - Matz is undecided
- foo:pre but no foo --> error
- can I call foo:pre directly? - NO!
- can I wrap all methods in a class? - no.
- discussion about AOP followed here.
- does defining foo:pre invoke method_added? - no (maybe call pre_added?)
- Selector namespace
- define String#to_i ONLY IN THE NAMESPACE
- reason: global changes to existing classes are evil!
- Problems
- hard to implement efficiently
- hard to understand for traditional OO users
- may not be needed where RubyBehavior and scope-in-state will do
- will namespaces be objects? - Matz does not know
- namespaces will be statically scoped
- Optional type
- StrongTyping and types.rb are based on class/module, which hinders duct typing
- need type system based on signature (method signature)
- needs to be built-in to be efficient
- no concrete idea yet
- Request for RCR
- we need to progress to live
- big step at once to reduce tragedy
- proposal: free to make drastic RCR for a while (until March 2004?)
- following information required: abstract, motivation, proposal, rationale
- these conditions should be met:
- incompatibility OK, but should not break the "Ruby way"
- Matz gave sample RCR - obsoleting "proc" (RCR#1)
- "Designing lang is very fun"
- Most of these RCRs will be rejected
- Thinking about making ruby better by many brains is good
- Things we've already been told
- bytecode (CISC > RISC for soft VM, indirect branch using GCC henhancement; if GCC is available, Ruby runs faster)
- generational GC - mostly generational, mostly thread-safe
- M17N
- handle multiple character codeset at once
- code-set independent (no code conversion unless explicitly specified)
- handles unicode as well
- semi-automatic code conversion by IO class
- Plans for near future
- 1.9.x
- RCR - still need time to consider
- Rite - will remain vapourware for a while
- "Coding in ruby is a joy, and coding in C is like a puzzle. I like puzzles."
- http://www.rubyist.net/~matz/slides/rc2003
- Jim Weirich - Building with Rake
- Why Rake?
- it was entirely an accident (started with a rant about make)
- If make were written in Ruby, it would look like...
- Example build process
- building this presentation
- create directories
- run presentation through WPB
- copy images
- we could write a Ruby script to do this, -OR-
- we can represent this as a graph of dependencies
- use task command:
- task :build => [:generate_html, :copy_images]
- task :generate_html => [:create_directories] do
- system %{ ./runwp rake.wbp }
- end
- tasks are like functions but explicitly named, order is implicit, run only once
- warning: use do/end instead of {} (due to precedence)
- build only what is needed - "file task"
- file "filename" => ["filename2"] do
- # rule to create file
- end
- file tasks should depend only on file tasks (because regular tasks always get built)
- directory task
- rules
- does pattern matching for building certain kinds of files
- rule '.o' => ['.c'] do |t|
- sh %{cc #{t.source} -c -o #{t.name} }
- end
- fancy rules
- regular expressions can be used as a target/source
- a proc can be used as a target/source
- could use code generation to generate tasks (comment from Jack?)
- rule limitations
- rule will only do one level of inference (looking for a way around this)
- documenting tasks
- use desc command
- then rake -T will list all targets that have descriptions
- file lists
- arrays plus
- sub and sub! supported
- add(pattern) will add all files that match the given glob
- FileUtils (in Ruby 1.8)
- unix-like commands available from within ruby
- Extended FileUtils
- can globally set verbose/nowrite for all commands
- sh command - like system, but obeys verbose/nowrite flags
- ruby command - obeys verbose/nowrite flags; runs ruby interpreter
- Task libraries
- This just in...
- rules to build package, tar, zip, and gem files
- Standard task libs
- clean/clobber
- test
- package/repackage
- rdoc
- task libs being modified all the time (core rake very stable, but not task libs)
- Advanced ideas
- Future directions
- Parallel rake/distributed rake
- Non-time based file dependencies (e.g. when working with NFS) - use md5?
- better support for specific build tasks (e.g. Task libraries for Java)
- Hal Fulton - Toward a refactoring framework for FreeRIDE
- What is recfactoring?
- See book by Martin Fowler
- (Hal) "an improvement in program structure that generally [refactoring could affect performance, e.g.] does not affect the behavior of the program"
- good refactoring editor: vi (refactoring is something that the programmer does)
- Challenges for automatic refactoring in Ruby
- can't even determine from source what method is being called
- def, undef, then redef method
- alias
- open classes - class definition can be scattered throughout source
- attr_* methods
- no variable declarations
- One possible vision
- "refactorings" can be spread throughout the Ruby community
- build scripting system into FreeRIDE
- Disclaimers...
- The big picture
- Refactoring and more...
- Code assist - (e.g. automatically add end when do is typed)
- Code transformation - (e.g. foo if bar -> if bar then foo end)
- Macros - recording keystrokes
- Scripts of any kind - & add them too your FreeRIDE toolbar
- Editing: the go method
- separate scintilla operations wrapped in one method
- Other methods
- insert str
- line() - current line
- extend_selection - ensure that you are only selecting whole lines
- select(x..y)
- selection should be an object in its own right
- The Parser API
- "reflection" approach - high-level API on top of an AST (would like to see)
- currently - mix of regexes and black magic
- context() - [class,meth] at cursor
- class_range(c)
- meth_range(c, m)
- The GUI API
- notify msg (like MessageBox?)
- get_string()
- yes_no()
- splash()
- The Present Structure
- Freeform - "umbrella" class
- editor object is the important one
- parser object
- GUI methods mixed in
- Demo - hacked version of FxScintillaTest that demonstrates the refactoring functions Hal wrote
- Rich Kilmer - Ruby Java Debug Wire Protocol
- ("what were we thinking?")
- DARPA UltraLog project
- integration project for DARPA
- independant contractor developing support infrastructure
- 300 machines controlled by Ruby
- single script controlling 100 Java VM's
- integration limited to:
- log4J push events
- servlet pull events
- servlet-based reporting
- Summer 2003 - Rich meets Chad (ha ha ha)
- decided on idea to use ruby to debug java apps (debugging could be scripted)
- Java Platform Debug Architecture (JPDA)
- JVMDI
- JDWP
- JDI
- Java 1.4 - full-speed debugging!
- What to implement
- JVMDI - for JVM writers
- JDWP (Rich)
- JDI (Chad) - blocks over the wire, etc.
- How to implement JDWP
- has detailed HTML spec with documentation in the SPEC
- spec --> Ruby "metadata" (not automated, 1 day of work)
- Metadata structures
- command sets, commands, documentation, repeat structures, case/when structures, data elements, error data elements
- metadata (320 lines) + jdwp_spec.rb (1300 lines) --> spec2ruby 9600 lines) --> packets.rb (5600 lines)
- The spec2ruby generator
- Generator output --> packets.rb
- 5600 lines of fully rdoc'd code
- one class per packet type
- ClassesBySignature example
- require 'jdwp'
- packets.rb
- constants.rb
- packet.rb
- session.rb - actually talks to the JVM
- socket_transport.rb - TCP/IP-based transport, could be replaced with something else
- Simple TDWP example
- session.send(Packets::VirtualMachine::Suspend.new) session.stop
- JDI overview
- high-level API to represent Java debug structures
- e.g. Thread, ThreadGroup, Class, Method, Variable, etc.
- ability to set breakpoints to trace execution of Java app from Ruby
- Simple JDI example
- Demo
- Demo of Rubygems
- GUI (using Alph) to:
- suspend/resume individual threads,
- suspend/resume the whole VM
- "kill java"
- Alph
- Ruby blocks can be callbacks for flash events (works by using sockets talking to flash itself).