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
learning.
– 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:

– SOLID
– Law of Demeter
– DRY
– 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://github.com/jimweirich/presentation_connascence.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.

Monkeybars.org – 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

johnnylee.net/projects/wii – 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
`Date.from_string(“3/14/2009”)`.

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 [http://ph7spot.com](http://ph7spot.com)

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 geni.com or tumblr.com or pict.com. pict.com 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 ning.com. 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 laterthis.com 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.

[http://adhearsion.com](http://adhearsion.com)

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.

mwrc: Building Mobile Apps with Ruby by Adam Blum

Adam Blum: Rhodes — The Open Source Ruby Framework for Building Mobile Applications

This was one of the most interesting talks for me.

[Rhodes](http://www.github.com/rhomobile) lets you build “native” applications for all mobile phones.

The exciting new phones like iPhones don’t have a footprint in big
organizations. So what platform do you target for your mobile app? Rhodes.

Build the app quickly in HTML and Ruby. It’s a mobile optimized ruby
implementation. They port the ruby interpreter to Symbian, Blackberry, iPhone,
and Android, etc.

[http://www.github.com/rhomobile](http://www.github.com/rhomobile)

It’s a micro framework, and has RhoSync to sync the data with the remote
service. Wikipedia is implementing their mobile version with Rhodes.

Rhom is a tiny ORM. They have a mini web server that runs so that you can
write your UI in HTML + JavaScript. That way, they leverage the Web Browser
that exists on each platform. You as a developer get to assume that your data
is local at all times. The framework handles synchronizing the data for you —
if you wish — you can do your own network programming if you want.

Rhomobile provides sample apps:

* SugarCRM
* Siebel Field Services

Third-party Apps:

* TrailGuide
* Wikipedia
* Mobile Lighthouse (bug tracker)

How do you build your Rhodes App?

* Create a sync source so you can get your data.
* Generate scaffolding for your app.
* Develop your app.
* Build, test, deploy

Let’s do it:

$ gem install rhogen
$ rhogen # displays options
$ rhogen app
$ rhogen model Contact “” 1 name,phone

Then you generate your app for iPhone, and/or Symbian, etc.

They use stylesheets to make your app look “native” on the different
platforms. It’s in great shape for iPhone, Blackberry. The UI doesn’t look as
good on Android. They need someone to do the stylesheet work.

Feb release:

* GPS
* PIM
* Symbian

Future 1.0 release planned for March 24th:

* Android
* Camera support, photo sync to backend
* SMS

Future things:

* Audio
* Video
* Accelerometer
* Proximity detection (to enable voice when it gets close enough to the face)
— will happen faster if developers contribute the code

RhoHub is hosted app development environment. They prvoide user downloading
from a URL, a sync server. First 100 registrants get a private beta:
http://rhohub.com — they’re looking for feedback from developers.

They believe web programming is more productive than the traditional way of
developing native mobile apps.

Q: Can you do your own custom styling?

A: Absolutely, per app. You can even contribute styling libraries back to them for everyone to use.

Q: How is the ruby runtime stripped down?

A: They’re developing a framework, and so that determines what they do and
don’t include in the runtime. They will get around to publishing what the
interpreter has, at some point. They took out ‘eval’, because the Apple App
Store doesn’t allow apps to have dynamic, downloadable code.

Q: What kind of performance? Do people feel like it’s slow?

A: Once it starts up, it’s very fast. Start up time is 5 seconds on iPhone. 7
sec startup on Windows Mobile and Symbian. They’re still aiming at getting it
down to 5 seconds. Always less than 3 MB for each app. Google noticed that
they’re using sqlite for a “property bag”, so they’re looking at switching to
something more lightweight. On iPhone, sqlite comes with the OS.

Q: Any apps in the app store? Do you anticipate problems?

A: No, No. But wikipedia’s app is very close. Their name is riding on it, so
they want to test, test, test before they release.

It sounds like they’ve targeted iPhone primarily, and the other platforms are
secondary.