Categories
Uncategorized

Notes from Ruby on Rails Project Night

It’s Back!

Bruce Lee, brandishing "Rails" nunchucksLast Friday marked the return of Ruby on Rails Project Night, a Toronto-based event where developers who worked on Ruby and Rails projects could do in-depth presentations on their current projects or ideas. It was on hiatus for the past couple of months (you can see this entry for the definition of “on hiatus”), but thanks to the efforts of Corina Newby, who helped put together the event at its old venue, it’s back, and judging from the attendance, it was missed. Thanks, Corina, for all your work!

James Robertson

The first speaker was also the special guest (and the reason the event was held on a Friday, as opposed to the typical Monday or Tuesday): James Robertson, whom you may know from his blog Smalltalk Tidbits, Industry Rants. He was on a “Canadian tour”, during which he was talking about the Smalltalk-based web app framework Seaside as well as Webvelocity, which puts the Smalltalk development experience within the browser.

Here’s the abstract for his presentation (from this entry from Corina’s blog):

WebVelocity is a new Smalltalk Development Environment that is oriented around Seaside for Web Development and Glorp for Object/Relatonal Mapping. Come and see how WebVelocity re-targets the Smalltalk development experience into the Web Browser and simplifies the challenge of learning a new environment for newcomers. We’ll even build an entire application using Active Record and Scaffolding during the presentation, with minimal programming. If you’re a fan of Ruby on Rails, you need to come out and see this presentation!

Here are my notes from his presentation:

- Seaside is open source, but Smalltalk ain't
- Seaside is maintained in Squeak, which you could call "the open source Smalltalk"
    
- Ruby on Rails is opinionated
- "Seaside is also opinated; it just has different opinions"
- When building Seaside, Avi Bryant asked "What if I took all the assumptions about web apps...
  and ignored them?"
- Some of what I show you is what happens when you blow those assumptions

- The canonical Seaside example -- the number increment/decrement button
  (now we know where that disastrous DemoCamp Seaside presentation came from!)
- Seaside uses continuations to remember state
- They enable "proper" support for the backbutton
- Session state info is keyed via a cryptographically secure key in the URL
    
- With Rails, you're dealing with two different worlds: templates and code
- Seaside is just one world: You don't write any HTML at all, you write all Smalltalk
- It's all in one place
- Support for debugger -- you can debug web apps as if they were desktop apps, with breakpoints and resumes
- In Seaside, the "html" argument is a "brush" that knows how to "paint" HTML
- You can debug in the middle of a page hit
    
- In beta: Seaside totally within the browser
- Editing code within a webpage, including tooltips and color hinting
- Every time a method is entered and it is syntactically correct, it is auto-saved -- no need to manual save!
- [Shows a Smalltalk debugger with an Ajax front end]
- "In some ways, it's even more productive than the real Smalltalk environment is"
- [Smalltalk console within the browser]
- [Auto-indenting within the browser]
- [Auto-generates a scaffolding-like page]
- The "call" method lets you write web app code very much like writing GUI stuff

Paul Doerwald

The second speaker was Paul Doerwald, who changed his topic from the more Ruby/Rails-specific “insights gained from working with ActiveRecord validation” to a more general (but still interesting) topic: Agile Documentation. He figured that it might be a better fit with James’ presentation, and it was — it was also quite interesting.

Here’s the abstract for his presentation:

“Programmers generally hate writing documentation. That’s because most documentation is kept separate from the code and becomes hard to keep up-to-date. Besides violating the DRY principle… it can lead to misleading documentation, which is generally worse than none at all.” [Subramaniam/Hunt ’06]. Why do developers hate writing documentation, and why do stakeholders and managers keep requiring it? Is there agile documentation beyond inline API documentation (JavaDoc, RDoc, etc.) and comments in the code? What parts of a project deserve separate-from-code documentation? How do we identify them, capture them, and keep them relevant?

Tonight’s Toronto Ruby on Rails Project Night presentation discusses the problem of documentation, explores some key aspects to consider when writing effective documentation, and dreams of a future of testable, executable documentation, where non-code knowledge could be integrated into your code.“

And here are my notes from his talk:

- My original presentation was going to be about insights gained from ActiveRecord validation
- But I've decided to change it -- it's now on Agile Documentation
- It's my M.Sc. Thesis!
- "You'll find this talk a bit heavy on problem and not so heavy on solution"
- Think of this as an introduction -- I want to frame things and ask:
  what is Agile Documentation?

- By "documentation", I mean by the kind that's by programmers for programmers
    
- It's not a particularly sexy area
- Frameworks are sexy:
    - Rails is sexy
    - Django is sexy
    - CakePHP is sexy...(for PHP)
- Languages are sexy
    - Ruby is sexy
    - Objective-C is..."strangely alluring"
- Even databases are sexy! Consider CouchDB and AWS
- What's not sexy?
    - Documentation
    - Backup -- at least not until Apple's Time Machine
    - Both are viewed as a waste of time
    
- We're developers. We may grudgingly accept the presence of non-developer things,
  but we don't want to do them
- Documentation is hard to write
- It seems so much easier to program rather than write
- Writing -- the non code-type -- is not our core competency
- We say "Our code is the authoritative documentation!"
- Consider what DHH said in a "Signal vs. Noise" blog entry in February 2006
    - When asked "How do you document your projects?", he replied "We don't."
    - He also said:
        - "Never worked consistently or successfully"
        - "Not necessary for our work"
        - "Most Rails developers can walk in and find out"
        - "We use Ruby"
        - "Method docs only for non-obvious behaviour"
        - "Docs mean BDUF"
        - "Appropriate only for onerous enviroments with complex policies"
        - "Focus on code quality instead"
    
- Like backups, docs are important
- We're not the only people who'll be working on a project, especially if it's a success
- We don't want to feel like we're wasting time when we're working
- Running a documentation tool and taking its output and pasting it into a Word doc is not DRY
- Why are we writing highly-coupled docs?
    
- Is there such a thing as agile documentation? I'm going to say yes
- Look at the Agile Manifesto
    - "We value working software over comprehensive documentation"
    - But it doesn't say that comprehensive documentation isn't valued!
        
- What's the state of the Art
    - For API Documentation, it's JavaDoc
    - In Rails, the outer classes are well documented, but not the inner ones
    - The JDK is extremely well-documented
    - You could say that RSpec is a form of agile documentation
    - It's a stretch, but Domain-Specific Languages could also be agile documentation
    - After all these, I can only think of process
    - When do we do docs? At the beginning of the process? At the end?
            
- What could agile documentation look like? What does it feel like?
- I borrowed principle from Alastair Cockburn's "Agile Software Development:
  The Cooperative Game, 2nd ed."
- The goals set out in the book:
    - Finish the game (i.e. finish development and launch the product)
    - Set up the game for the next team
    - Think of pool: maybe you take the hard shot first to set yourself up later for the easy shot
    - Coburn calls this "residue": the stuff that one team leaves behind for the next team
    - Residue includes:
        - Code
        - Process in place
        - Documentation

- I would argue that DHH/37signals has an oral form of documentation
- It works if the company doesn't grow too quickly
- What are we really asking for when we ask for the documentation: Tacit Knowledge
    - "That which is seen but not noticed"
    - It is information that is understood and implied but not stated
    - If you've ever brought someone else onto a team, you spend a lot of time
      explaining things that are obvious to you
    - You might not explain that stuff if you're doing it on paper
    - You don't want to end up in a situtation where there's too much documentation
        
- What can we borrow from software engineering principles?
    - Orthogonality
        - A good thing in software development
        - Intersect at a clear and obvious point and do not influence each other at any other point
    - Cohesion
        - All attributes and methods are related to the essence of the class
        - Don't have people look in 5 different places to get the answer to a single question
    - Coupling
        - The extent to which one thing is dependent on each other
    
- To the future
    - 5 years ago, unit testing was unheard of in the web development world
    - Rails and similar projects have helped popularize unit testing
    - We've moved from the point to where we say "testing is awesome"
    - Testing is now a core value
    - Can we make documentation a core value?
    
- Agile documentation processes
    - Large companies are good at this; open source people not so good
    - Looking to Rails:
        - Documentaton conventions?
        - What if we had 5 steps for writing documentation that did 70% of the work?        
    - Can we integrate documentation with code?
        - In many cases, the docs exist as a Word document
        - A step up is to use a Wiki -- support for multiple authors, versioning, linking
        - Can we put docs right in the codebase?
        - Every Rails app has a doc directory -- can we use that?
        - We test code -- is there a way to make testable documentation?
        - What if we could tag a method and class with a keyword and make that keyword appear in the docs?
          -- We could generate an alert when changes happen

Checking Out the Rich Media Institute

After the presentation, which was held in the Rich Media Institute’s basement-level lecture room, a number of us headed upstairs to check out its main floor. If you’re a techie with a creative bent, this place is like a candy store. The front part is a store full of books, t-shirts, music and other goodies that new media creators and aficionados would love, while the back is a gallery for local interactive artists’ works.

I took some photos of the place and posted them in the gallery below. Click on any of the thumbnails to see a larger version of the picture:

Categories
Uncategorized

Ruby on Rails Project Night Tonight!

Rails to Victory

There are a few slots still open at tonight’s Ruby on Rails Project Night, which takes place in Accordion City’s Kensington Market Area. It’s happening tonight at 6 p.m. at the Rich Media Institute (156 Augusta Avenue). If you want to attend let organizer Corina Newby know at corecorina@hotmail.com.


Here’s what presenter Paul Doerwald has to say about his topic tonight:

“Programmers generally hate writing documentation. That’s because most documentation is kept separate from the code and becomes hard to keep up-to-date. Besides violating the DRY principle… it can lead to misleading documentation, which is generally worse than none at all.” [Subramaniam/Hunt ’06]. Why do developers hate writing documentation, and why do stakeholders and managers keep requiring it? Is there agile documentation beyond inline API documentation (JavaDoc, RDoc, etc.) and comments in the code? What parts of a project deserve separate-from-code documentation? How do we identify them, capture them, and keep them relevant?

Tonight’s Toronto Ruby on Rails Project Night presentation discusses the problem of documentation, explores some key aspects to consider when writing effective documentation, and dreams of a future of testable, executable documentation, where non-code knowledge could be integrated into your code.”

And here’s what presenter James “Smalltalk Tidbits, Industry Rants” Robertson has to say about his presentation:

WebVelocity is a new Smalltalk Development Environment that is oriented around Seaside for Web Development and Glorp for Object/Relatonal Mapping. Come and see how WebVelocity re-targets the Smalltalk development experience into the Web Browser and simplifies the challenge of learning a new environment for newcomers. We’ll even build an entire application using Active Record and Scaffolding during the presentation, with minimal programming. If you’re a fan of Ruby on Rails, you need to come out and see this presentation!

Categories
Uncategorized

The New Microsoft Ads: Why Didn’t They Just Start With These?

“I’m a PC, and I’ve been turned into a stereotype,” says the John Hodgman lookalike at the start of Microsoft’s new Seinfeld-free commercials. Then they jump to all sorts of people saying “I’m a PC”.

The message is simple: PC users aren’t all nerdy puffy white guys in tweed suits — many different people use PCs and they leading interesting lives and do cool things with them. If the goal of Microsoft’s new ad campaign is to counter Apple’s “I’m a Mac/I’m a PC” ads and rehabilitate Microsoft’s and Windows’ sagging image, these ads are doing a much better job than the Seinfeld/Gates” ads (here’s the first ad, here’s the longer follow-up) about nothing.

Take a look:

What do you think?

Categories
Uncategorized

“Enumerating Enumerable” Will Return Soon!

Enumerating Enumerable

This is just a quick note to let you know that Enumerating Enumerable, the series of articles in which I try to one-up Ruby-doc.org’s documentation of Ruby’s Enumerable module, will return very soon. I’ve been busy, but I am working on the next installment, which covers the inject (a.k.a. reduce) method.

In the meantime, you can go check out the 18 previous installments, listed below, as well as my paper-assisted demonstration of what inject/reduce/fold means.

  1. all?
  2. any?
  3. collect / map
  4. count
  5. cycle
  6. detect / find
  7. drop
  8. drop_while
  9. each_cons
  10. each_slice
  11. each_with_index
  12. entries / to_a
  13. find_all / select
  14. find_index
  15. first
  16. grep
  17. group_by
  18. include?
Categories
Uncategorized

Zero Punctuation on “Spore”: NOOOOOOOOOOOOOOOOOOOO

Oh, how I enjoy Ben “Yahtzee” Croshaw’s game reviews in his video series Zero Punctuation. In this installment, he covers (and savages) Will Wright’s long-awaited game, Spore. Thankfully, he skips complaining about the DRM, which I heard plenty about already. After hearing his review, DRM sounds like the least of the game’s problems…

Categories
Uncategorized

The Return of Ruby on Rails Project Night

Rails to Victory

After “a much-needed summer hiatus” (which you can read as “the complete implosion of Toronto’s worst-run software development shop, which used to host the event”) Ruby on Rails Project Night makes its comeback this Friday, September 19th at its new home at the Rich Media Institute in Kensington Market.

Event organizer Corina Newby promises that it won’t normally be on Fridays, which should the minds of your significant others, party-going friends or World of Warcraft clans at ease. The event is being held on a Friday this time to accommodate the schedule of special guest James “Smalltalk Tidbits, Industry Rants” Robertson, who’ll be there to give us a presentation of the Smalltalk-based web application framework Seaside and the Seaside-based Smalltalk development environment WebVelocity.

Also scheduled is local Ruby on Rails developer Paul Doerwald, who’ll be doing a presentation on insights he gained from working with ActiveRecord validation.

As always, one of the greatest benefits of these gatherings is actually meeting local developers who work with or are interested in working with Ruby and Rails. It’s good for you, your software development career and the future of Accordion City as a hub for high-tech when gatherings like this take place, so be a part of it!

By the way, did I mention that the event is FREE?

Once again, the date is this Friday, September 19th at the Rich Media Institute (156 Augusta Avenue). The presentations will start at 6 p.m. and run until about 7:30. If you’re planning to attend, let Corina know at corecorina@hotmail.com.

Categories
Uncategorized

Going Down Memory Lane with C

July 25, 1994 issue of Time magazine
The July 25, 1994 issue of Time magazine.

The computer science student phase of my academic career (the less said about the previous phase, in which I was an electrical engineering student, the better) ran from 1991 to a successful conclusion in 1994.

If you are like me, you strongly connect memories with the music of the time; you could say that my computer science student phase ran from the time of Nirvana’s Nevermind and Soundgarden’s Badmotorfinger to Green Day’s Dookie and The Offspring’s Smash. Let’s just say that I often showed up to my classes and labs in a flannel shirt.

Album covers: Nirvana's "Nevermind" and Green Day's "Dookie"

(If that last paragraph makes you think “Whoa, that was a long time ago!”, you’ll be blown away by the fact that the initial work on C ran from the time of the Beatles’ Abbey Road to Led Zeppelin’s Houses of the Holy. A fair number of you probably weren’t even born then.)

My Student Language of Choice

I don’t know what the situation was like at other schools, but at the time, computer science students at Crazy Go Nuts University were allowed to hand in programming assignments using the following languages:

(Remember, there was no Java back then. The Green Project, from which the language/platform sprang, was still ongoing at this time, and Java was still going by its “Oak” codename.)

The general recommendation that came from most of my professors was to use Turing. They told us that it was a kinder, gentler language than Pascal and even more so than C, which they implied was designed by dyslexic aliens. When some of us suggested that it might be better to use a language that saw actual use in the real world, many of them countered with the argument that learning principles of computing was more important than learning specific languages. We might’ve responded by pointing out that one of our professors was a co-creator of Turing and probably got a vig for every Turing installation (it was a commercial language), but that might have been an academic career-limiting move.

I ignored their recommendations and went with C. In the lab, I used good ol’ cc. At home, it was Turbo C at first, and later, when I got my first Mac (a Quadra 660AV bought with money from DJing), Think C.

I never used C in my professional career. My first job out of school took me away from a world where input and output was all printf() and scanf() to interactive CD-ROMs and Macromedia Director (now Adobe Director and 7 versions later), and after that, the languages remained pretty high level: Visual Basic, Python, Java, C#, NSBasic, PHP and Ruby, with only a slight detour through through Visual C++ and C++Builder.

My C Books Back Then

Cover of "The C Programming Language"

It’s almost impossible to talk about C without mentioning “K&R”, the nickname for what is considered to be the official bible of C, The C Programming Language, which was written by Brian Kernighan and Dennis Ritchie. The latest edition of the book — the second edition — is a bit long in the tooth as it was written in 1988, but for the most part, everything in this book should still apply to the current C99 standard.

I never owned a copy of the book in my student days. I signed it out when necessary from the electrical engineering/computer science library in Walter Light Hall. I did own a copy for a brief period in 2002 when my deadbeat ex-housemate left a lot of his stuff behind, but I sold it (along with most of his stuff) in order to recoup some of the money lost from his stiffing me on rent, utilities, groceries and the largest domestic phone bill I’ve ever grappled with.

Cover of "A Book on C"

The books I had while at Crazy Go Nuts University were the second edition of A Book on C and Understanding C Pointers (a book that seems to be no longer in print). I liked A Book on C enough to pick up the fourth edition on sale a couple of years ago, and someone out there has forgotten to give me back my copy of Understanding C Pointers (you know who you are!).

Back to C

I’ve decided to get back into C for a number of reasons.

"Internet Tough Guy" Magazine

I have to admit that one of those reasons is completely irrational: it’s ego. There’s certain geek cred that comes with having at least some proficiency in C. While I had those bragging rights back in school, I can’t honestly claim them now; I haven’t even written a file whose name ends in .c in over a decade. Luckily, I had a pretty good grasp of C back in school, and the noodling I’ve been doing with good old gcc suggests that I’ve still got it, which is pretty reassuring.

iPhone, Arduino 480 and the "Mac Guy"

I’ve also been meaning to do some development with things that are programmed in C or C dialects:

  • The Arduino electronics prototyping platform has its own programming language based on C. I’ve been meaning to try out hardware hacking with the folks at the local group HacklabTO.
  • I’ve also been thinking about putting together some Mac OS X and iPhone apps, which require Objective-C.
  • I’ve even been thinking about doing some GTK noodling, which is done in good ol’ C.

Homer Simpson's brain x-ray

Finally, there’s the matter of just making myself a better programmer by working in C by refreshing my knowledge of the low-level stuff that C requires you to work with, and also the “brain stretch” that comes with working with a language and environment (what with going back to strong typing, compiling and make) that I haven’t worked in for some time.

I’ll be doing some C coding in my spare time, as well as noodling with the Arduino programming languane and Objective-C, and I’ll be posting my notes, observations and experiences here. As I’m fond of saying on this blog, watch this space!