mwrc: Saturday evening Lightning Talks

Binary Lottery code — how he wrote the app.

Mhong – Event Machine. require ‘eventmachine’ module. ` { block }` takes
over your ruby, and nothing after that block will be run.

There’s EM::PeriodicTimer and single-fire timers: `EM.add_timer(2) { block }`
To use EM in your web-app, `require ‘thin’` or spin up a new thread and use
``. ` … EM.system () … { if status.exitstatus == 0
… end }`. Message queues, etc. Looks cool.

Dana Gray – regular expressions. “it’s been two days since my last regular
expression”. She went over the basics of regular expression string matches. How
to match word chars, positional anchors, capturing and non-capturing
parenthesis, grouping, character classes. Don’t fear regex, embrace regex.

Jake Cahoon from the Utah Valley Ruby Users Group. He used a slightly
monkey-patched ‘feedzirra’ module to pull tweets using Ruby code. Finshed
writing the code at 2 A.M. this morning. Now it pulls tweets and puts them into
IRC. His code is on

MerbCamp videos from last year are online. How to do Rack testing. with require
‘rackbox/spec’. He wrote three apps that echo text in three different
frameworks (sinatra, merb, rails), and showed the tests running against each.
All in five minutes.

Sockets and Ruby.
`require ‘socket’; client =”, 6789); client.write(“Hello!”);`

`server =‘’, 6789); client = server.accept; client.recv(500);`

MongoDB – a document oriented data store. Supports native Ruby objects. Has
full index support. Uses memory mapped files for speed. Has a file storage API.
Will support sharding soon. Best use cases: Most web apps, caching (memcachedb
+ indexes), when you need high scaleability. Worst case use cases:
Transactional systems, data warehouses. Why should you use it? Fast! No
migrations, ever. Replaces memcached & tokyo. Has great Ruby support, and it’s
not mySQL.

It’s easy to contribute RSpecs to Rubiniess. One presenter showed how.

Brian Marick: How to learn from the screw-ups of the past. He’s been involved
in three movements in computer programming in the past 20 years. First, it was
lisp, which was going to take over the world, but died when it failed in the
commercial world. Second was ???, and third is Ruby. He thinks “agile” is in
trouble like lisp was in trouble. Agile was founded by people who like to
program. The key thing that was missing from agile is solidarity of action. He
ran out of time to complete his thoughts.

Coby R. announced the LA Ruby Conf – April 4th, 2009

Justin Graham showed a working example of Adhearsion (the Ruby telephone
framework for Asterik).

Pat Eyler – Ruby Brigades. You should participate in your local Ruby Brigade so that you can strengthen the community. It’s a chance to grow and learn. The best way to learn is to teach others. Simply show up. It’s discouraging when someone organizes a group and no one shows up. Get on the mailing list. Don’t just subscribe. Ask questions. Answer questions. Be involved. Give a lightning talk at the meeting.

There are two types of meetings: Ones that are a launchpad, and ones that are a destination. Don’t let your meetings become a destination. Make the world a better place.

mwrc: Jim Weirich: The Building Blocks of Modularity

Jim Weirich: The Building Blocks of Modularity

Interview questions:

– What tech books have you read lately? To guage their interest in continued
– How do you recognize a good design?

Someone said they’d come and listen to him talk about oatmeal. So guess what?
He’s going to talk about oatmeal.

At one time, the thought was that matter was like a bowl of oatmeal, that it
was fairly consistent all the way through with maybe a few lumps. Someone shot
a particle emitter at a thin strip of gold, and found out that that wasn’t
true. Matter is like a bowl of oatmeal with rasins and apples in it. That’s
when scientists started developing their atomic theory. Several forces in the
universe: Gravity, Electromagnetism, Strong Nuclear, Weak Nuclear. Why should
there be so many different forces? They tried to come up with Grand Unified
Field Theory, and they’re still working on it.

In computers, we have some principles we use to write software:

– Law of Demeter
– Small Methods
– Design by Contract
– etc.

Is there a grand unified theory of software development? That’s what he wants
to think about and discuss today.

Everyone should have a mentor when they get started in their careers. He did.

Coupling & Cohesion. The connection between modules, and how well a module
itself fits together. Less coupling is good. Too much coupling is bad. Seven
different types of coupling, according to Meyers:

– None
– Data
– Stamp
– Control – when you have do describe the func with the word “or” or “otherwise”
– External
– Common
– Content

Which boil down to local data and global data, and whether it’s simple or
structured data.

A simpler way to thing about coupling: Connascence – things that are born together and change together. If two pieces of software are tied together so that changing one requires changing the other. Rule: As the distance between software increases, the conanascence between the two should be weaker.

Connascence of Position (with parameters to methods) versus Connascence of Name
(using a hash to pass parameters). The latter is better when there’s a large
number of parameters.

Connascence of meaning. I.E. Don’t use magic numbers in your code.

Contra-nascence – when it doesn’t matter what magic number you assign to two
different constants, as long as they aren’t the same.

Connascence of Algorithm. If you change a checksum checking func, and you have
to also change the corresponding function that generates the checksum.

Connascence of timing, of value, etc. This entire talk is on github: git://

mwrc: Alan Whitaker on programming passion and Ruby

Alan Whitaker: La Dolce Vita Rubyista
of Lead Media Partners

Discovery – something that kids do. Something that many ruby programmers are
doing as they leave old jobs for new jobs where they can use Ruby.

“The real voyage of discovery consists not in seeking new lands, but in seeing
with new eyes.” — Marcel Proust.

Resistance – anything worth doing is likely to meet resistance. Resistance
stands between the life we live and the life we would like to live.

Cultivate passion while maintaining balance in life.

Flow. The book. By Mihaly Csikszentmihalhyi.

Enjoyment factors: Clear goals, no distractions, challenge, rapid feedback,
deep involvement, sense of control, loss of self-concern, timelessness.

The book “The Power of Full Engagement” says, “Energy, not time, is our most precious resource”.

mwrc: James Britt: Wii Ruby

James Britt: Wii Ruby

Wii Hardware: CPU, IR Sensor bar, Wiimote, nunchuck, balance board.

The nice thing about the hardware is that you can replace the Wii CPU with a
laptop, and still use the rest. Nice 3rd part sensor bar: PSE112 from Psyclone — runs on batteries

Why do we like Java? Because of JRuby and because of the really good libraries.

Java libraries:

– WiiRemoteJ: Closed source, jar only.
– WiiUseJ: Open source (GPL v3) on Java 1.6. Sits on a C library.

Ruby wrappers to these libs:

– WiiRemoteJRuby
– WiiUseJRuby

Your laptop needs bluetooth. The Wiimote has an IR camera that reads the IR
lights in the “sensor bar”. He used Linux to do his work. In theory, it should
work on other platforms as well. – wraps swing in a form of MVC for Ruby

– Controller handles events
– View maps UI to model
– Model holds data

He showed some basic apps he had written. One of them would make music
depending on how you waved the Wiimote.

What’s good?

– Mapping events is easy
– GUI is easy
– MIDI is okay

What’s bad?

– Precise control is HARD
– Project creation is tedious
– Many little annoyances persist – great wii hacks

Q: Did you look into the C libraries at all? He went straight to Java.

mwrc: Paul Sadauskas: Writing Adapters for DataMapper

Paul Sadauskas: Writing Adapters for DataMapper

What is DataMapper?

– A lightweight, modular Ruby ORM with
– lazy loading
– strategic eager loading
– plugins (types, migrations, validations, timestamps, sweatshop, is-list, is-searchable, is-versioned, etc.)
– adaptors (heap, YAML files, REST-ful web services, CouchDB, Sphinx, Netflix, etc.)
– and it’s better than ActiveRecord

The goal of the adapter API is to make it as easy as possible to write one. He
then showed how to do it. How do I know my adaptor works? Run the tests that
are provided.

Q: What about supporting “join”? That’s a good question. Currently, not all
adaptors support it.

mwrc: Learn from programming masters by Philippe Hanrigou

Philippe Hanrigou: What The Ruby Craftsman Can Learn From The Smalltalk Master

He talked about Picasso and how he studied the grand masters of classical art
for his entire life. He didn’t imitate them, but he used them for inspiration,
and he was considered a genius.

We, as programmers, can learn from the masters of previous generations. [I dislike Picasso’s art, but agree with the analogy].

– Naming is crucial.
– Use a role-suggesting name

Cognitive Scalability

As our software grows and becomes more complex, how do we maintain the ability
to change the software? It’s so easy for software to get “out of control”.

Look at Ruby’s String class and how many methods it has. It’s a mess.
Everything depends on String. If, every time we add a method to convert a
string to something else (to the String class), then we add a reverse
dependency on the other classes. Instead of `”3/14/2009″.to_s`, let’s do

Reduce code to the Essence. Let’s learn from Haiku, which values conciseness.

Symmetry. The Taj Mahal isn’t geometrically symmetrical, but is designed to look that way from one perspective. Symmetry will allow your code to be easier to read and understood. Kent Beck calls this “Reversing Method”.

We should spend more time studying the software grand masters from the lisp
and the smalltalk communities. And read Kent Beck’s books on Smalltalk best
practice patterns and/or Implementation Patterns.

Give him feedback on his ideas at [](

mwrc: Ben Mabey: BDD with Cucumber

Ben Mabey: BDD with Cucumber

He highly recommends “The RSpec Book”. When someone gives you a feature request, the most important question to ask is “Why?”. He demo’d the use of Cucumber. Every test you add also adds maintenance cost.

mwrc: TourBus server load tester by David Brady

David Brady — TourBus

He can make your website 10x faster in a day’s work. Given two weeks, he can make it 100x faster.

Do you believe in refactoring? If you don’t believe he can do what he says he
can do, then you don’t believe in refactoring.

How do you optimize?

1. Measure
2. Find bottlenecks
3. Go up a level
4. Rearchitect, redesign to fix
5. Measure

TourBus helps you find the performance problems in web servers. It makes use of:

– WWW::Mechanize
– Threaded
– Unit Testing

He showed us an example. It’s easy to use.

I notice he uses Aquamacs (emacs for Mac), and sinatra

TourBus trips over itslef at 500 requests per second, since its written in
Ruby. They used the mySQL slow query analyzer, and it told them they needed
some indexes on some tables. The db CPU use dropped from 100% to 1%. Then the
app server was 90%-100%.

mwrc: Improving Usability of Rails Apps

Adam Dunford & Jason Edwards: Improving the Usability of Your Ruby on Rails Applications

Instead of trying to define “usability”, let’s talk about “user ability”.
Can a user accomplish their goal? Programmers and designers are not users.
“Use users to test usability” so you can verify that users can accomplish
their goal.

There are seven principles of usability.

1. Create structure. Organize content, prioritize content, group content, separate content, differentiate content. WordPress 2.5 has horrible admin organization. 2.7 restructured it. Content that’s similiar is together. Craigslist is the “gold standard” of structure. That doesn’t mean it’s usable, per se.

2. Use standards. Not web standards. Standards of what people are used to —
“follow conventions”.

3. Be predictable. You won’t know unless you test with users. Accomodate their
expectations. Predictability doesn’t mean consistency. Google apps are similar

4. Reduce barriers. See or or doesn’t
even require you to create an account until _after_ you’ve started uploading
pictures. Provide for progressive enhancement. Your website should work for people that don’t have JavaScript enabled, but it can work better with it enabled.

5. Add affordance. Make it easy for users to learn how to use your
application. Work around your users limitations. Provide an “undo” capability.
See You can’t miss what you need to click and fill-in. Phone number validation. Don’t make people put in their phone numbers as three separate fields.

6. Give feedback. Respond to users in a way that is clear and obvious to users. See sign up when you fail to enter a field. Make sure your users feel like they are in control. Rather than a 404 page error, provide a phone number for support. It will reduce stress.

7. Simplify. We don’t want to overwhelm users. SonicMood is an example of a
bad app, and it’s supposed to help users create users to relax. “Choices =
Headaches” — Joel Splosky.

Reduce. Replace. Hide (info until its needed). Remove. Remove the obvious, and
add the meaningful.

Final note: Read “User Interface Design for Programmers” by Joel Splosky

mwrc: Adhearsion by Jay Phillips

Jay Phillips: Adhearsion

Adhearsion is a modern telephony framework leveraging Ruby.


You could write code to play back the weather (text-to-speech).
One of his first apps was to write an app that let him call into his XBox
Media Center with a telephone, and press phone keys to move the cursor around on the screen.

Just recently, Skype allowed Asterik apps to tie into Skype to receive Skype
phone calls.

He showed how to build an app that lets you play a “Simon” memory game to see
how well you can remember sequences of numbers.

sandbox {
play “Hello world”

You can use ActiveRecord into your Adhearsion application. So you can extend a
rails app with telephony service.

Q: Can you make outbound calls? Yes

Q: Can you play pre-recorded voice clips? Yes

Q: Can you record voice from a phone call, then play it back? Yes

Q: What’s the support for things besides Asterik? Like Freeswitch. There isn’t any. He started with Freeswitch, then figured out that no one was using Freeswitch, so he switched to Asterik.

Q: Are there scaleability issues? Asterik is the limiting factor. It can get up to 150 simultaneous calls on a single box. You could have multiple asterik boxes, and one adhearsion server.

Q: Can Asterik run in the cloud (EC2)? People do it. There are some issues. Conference rooms don’t work so well.