mtnwestruby: Review of a Rails App

mtnwestruby: Review of a Rails App by Marcello and Jamis of
17 March 2007

Almost everyone in the audience has used Rails. A little less than have write Rails apps for a living. I haven’t used Rails, and even if I had, it would be difficult to take notes on this presentation. I recommend viewing the video when it becomes available.

Marcello and Jamis recommend Kent Beck’s book on Smalltalk best practices and how to decide what code belongs where. They also recommend Domain Driven Design.

Why do you prefer the operator ‘&&’ over ‘and’? The use of ‘&&’ leads to fewer bugs. Consider the following code:

  • return foo and bar # will not return what you expect
  • return (foo and bar) # this will work
  • return foo && bar # use ‘&&’ and ‘||’ because they’re more predictable in behavior than ‘and’ and ‘or’

Convention: A bad smell in code is seeing a chain of if..elsif
statements to check for error conditions. In this case, you probably want to
handle error cases with exceptions. For example, in Rails,! will
validate data, and raise an exception when there’s a problem, whereas will not raise an exception.