Thursday, May 24, 2007

Practical Design for Developers

presented by David Verba

Resources (book):

The Non-Designer's Deisgn Book by Robin Williams (Contrast Repetition Alignment Proximity)
Information Acrhitecture for the World Wide Web by Rosenfeld and Morville
The Elements of User Experience book by Jesse James Garrett
Observing the User Experience (book)
About 2.0 - The Essentials of Interaction Design by Alan Cooper (book)

My Summary:

Looks matter! Make sure you present an attractive web site that is consistent in presentation of links and actions.

My Notes:

what are users context, motivators, challenges?

The Elements of User Experience book by Jesse James Garrett
  • surface
  • skeleton - discoverability (make finding things easy), recoverability (actions should be w/o cost), context (sense of time, place and meaning), feedback
  • structure
  • scope - functional spec
  • strategy - what are we getting out of the site? the users? look for the overlap by first getting to know your stakeholders. what are the objectives for the site? get to know the users and determine what their current application usage is.

think about things in modules

make sure you have consistency (one phrase for the 'about us' link, for example)

The Attractiveness Bias (Kennedy/ Nixon debate where radio listeners thought Nixon won and TV viewers thought Kennedy won) - first impressions are made in less than 1 second and have lasting impression on user's opinion of the site

personality in error messages and design helps

Slingshot

presented by Scott Burton and Scott Barron

Resources:

http://developer.joynet.com

My Summary:

Slingshot is potentially a useful tool if you need to be able to have users work on and off-line. I look forward to seeing some of the issues that are of concern right now (conflict resolution on syncing up, for one) addressed in their first release.

My Notes:

Connection agnostic Rails apps
works off and on-line - syncs up when you're connected
drag files onto desktop

Updates to Slingshot -
Downloads app
runs data migrations
all done by itself (not quite there yet)

How to use:
drop in a rails app (source code is deployed to users)
write activerecord transport layer
deploy

Options to protect source code - encryption (not a good one if you want to protect IP)

running on desktop, latency from internet is gone, much more responsive

recommend at least rail 1.2.1

synchronization is based on timestamps

conflict resolution - not addressed

will be open-sourced in June

commercial version will have support and possibly other features

Rails Support with Custom Daemons

presented by Tammer Saleh

Resources:

LDAP Server Code is available here:
http://thoughtbot.com/projects/ldap-ar-gateway

svn: http://svn.thoughtbot.com/ldap-activerecord-gateway

My Summary:

Whew! Don't be afraid to use daemon processes in Rails to do background tasks. Crib code from Tammer's site to do it!

My Notes:

Problem:

Rails app for recruiting company needed client-side integration (mail, address book, outlook)
They built LDAP to ActiveDirectory gateway (ruby-ldapserver gem)
returns results from the app db

daemon - btwn OS kernel and application, usually run in the background disconnected from a terminal

Logging:

Testing daemon processes:
use Mocking
set up the Kernel, etc. with a bunch of .expects and then daemonize
daemon will not actually run

daemonize as soon as possible in your code - anything you do before daemonizing is lost after daemonizing
rescue anything that could fail as you are cut off from the usual messaging
logger.debug with vigor

Interface with your data via
WebDAV file access
SNMP protocol for monitoring your network equipment
FTP
System Monitoring
ping other sites to see if they're running
long-running tasks (backgroundrb)
Interfacing with other apps through REST
FTP - Highrise
IRC - Campfire proxy

slides will be available on thoughtbot's main page

XUL for Rails

presented by Max Lansing

Resources:

XUL Hello World app at:
http://maxlansing.com/xul_helloworld.zip

My Summary:

XUL gives you a way to have sexy fat-client widgets but, you are restricted to Mozilla
browsers only and you have to hack prototype.js to use it with XUL. It is pretty simple
to use Rails as a back-end system with XUL since Rails just sends XUL XML documents.

My Notes:

pronounced Zool

Why not just use HTML?
It's nice to have a native-feeling app
and
not have document pages

Grid-based box model, not document (more trouble)

good for non-designers

localization is simple (use XML entities in place of ordinary strings with DTD activated for a particular context)

can always fallback on XHTML

thorough documentation, supportive community

Drawbacks:

Mozilla Only
slight learning curve
gotta hack prototype.js
builder xml render slow, can use erb instead
some bugs, niche technology means fixes may not get the same attention as other mozilla bugs


XBL defines XUL tags, can make your own
looking at XBL is a good way to learn how XUL is implemented

Deployment a Headache? yes

To use Rails as back-end:

Use .rxml or erb
need to specify global chrome skin
XUL response headers right
respond_to, :format, cannot use these (you get a 406)
that's it, rails is sending xml documents and doesn't care about anything else

Prototype woes:

Function.prototype.bind() doesn't work as XUL windows are precompiled and don't delegate to Function.prototype.bind()

Workarounds:

declare functions using new Function() - huge maintenance headache
or
patch prototype.js, rewriting Function.bind as freestanding function
or
patch prototype and scriptaculous dynamically (he's written one and will give it to us)

Element.replace() or Element.update() - doesn't work in XUL

Form.serialize() and Form.Element.serialize() - not available for XUL

XUL doesn't have forms, window and elements are your form

except for trickiness with javascript updates, you could write an app that has both a XUL and HTML front-end
XULrunner for offline apps

Standing on the Shoulders of Giants

presented by Adam Keys

Resources:

Web:
http://therealadam.com (personal web site)

Book:
Code Reading

Good Code:
xmlrpc4r - first code he found really readable
authenticated_system.rb
Beast (josh goebel and rick olson) great place to look for best, current idiom
rake (straight-up ruby code)
acts_as_versioned

My Summary:

We spend too much time reading code not to care about improving our code reading skills!

My Notes:

Control your destiny by reading other's code!

think of code reading as spelunking, put on a helmet with a light to get ready!

Navigating the Call Stack
start in routes for rails code

look at url, x-ref with route.rb

check out controller or go right to view

grok any controller filters

grok the controller action
grok the methods the controller calls
??

know what's in the lib and plugins folder
check for observers/validations/callbacks, etc. in models

Ruby Spelunking
-parliament/lib/my_funk
-parliament/lib/my_funk.rb

the magic page variable, how is it implemented?

the magic global variable

Friday, May 18, 2007

Renew Your Developer Vows Now!

Went to a very motivating talk on the importance of writing 'Clean Code' by Bob Martin today and wanted to get my notes to you guys ASAP.

"SmallTalk failed because it was too easy to make a mess."
Ward Cunningham
What can we do about bad code?

  • The Grand Redesign in the sky?
  • Incremental Improvement (of course, the right choice)

Check in a module just a little bit better than when you checked it out!
Never let the sun set on bad code.
Test first!

rspec has better feel and syntax than test unit (we need to start using rspec)

Open/Close principal - application should be open for extension but closed for modification!

Refactoring the way to go - the notion you can write the code correctly the first time is just ego.

Successful refactoring depends on tests. Make small change, test, and repeat until you're done.

eclipse refactorings are back with the rad rails replacement?

separation of concerns, keep things that change at a different rate separate from each other.

Was this worth it?

  • bad code gets harder and harder to clean as time goes by
  • if you want clean code, you have to clean it as soon as it gets messy
  • what about time to market? (the dinner parable) the fastest way to be done with dinner is to just get up and walk away: preparing the next dinner will take forever however

Nothing has a more profound and long-term degrading effect than bad code.

Professional write tests - first.
Professionals clean their code.
Professionals know the only way to go fast is to go well.

"It's about making things a little bit nicer" (DHH)

"Clean Code" project
www.objectmentor.com

DHH Opens RailsConf2007

Hey guys, hope you are all doing well. I haven't uploaded any lecture notes recently as we've been real busy and the internet connectivity is dicey at best here. I did want to update you guys with what DHH said this morning! The rest of my notes will just have to wait.

Rails 2.0 was the topic, although much of what DHH showed us is available in Rails now. These are the things he mentioned that I think we should look into using:
  • Atom
  • OpenID
  • Ruby_debugger (created by someone with the first name of Kent) Note: I think we need to look into using this now. We finally have a step-thru debugging tool!!!!!!!
  • HTTP Performance enhancements:
  1. query cache (used automatically, caches SQL so db trips are minimized)
  2. asset cache (we need to look into this one as soon as possible. By adding ':cache => true' to the javascript and stylesheet include tags, all .js and .css files get zipped into two files; all.js and all.css when being transmitted to clients. This may be the help we all need with slow page refreshes but, may most help Michael from feeling like he wants to jump off a bridge while he works on look and feel!)
  • ActiveResource (we need to start using this. we get active record goodness and, free for nothing, the ability to produce xml, txt, csv, files too)
  • Config/Initializers - this comes out of environment.rb and into it's own file structure
  • Sexy Migrations - instead of the redundancy of specifying column name and data type (where the same type is typically specified over and over), you now specify the data type and then a list of all the columns that are that type
  • HTTP Authentication - for feeds, do we need this for secure data feeds (should we develop any)?