Live Coding with Ben @ YouTube

Ben Orenstein – Live Coding with Ben – Ancient City Ruby 2013

A nice talk from Ben Orenstein. It’s about “law of demeter” and “applying factory pattern”, with some funny branch offs (relative line-numbering on vim sounds interesting).

Identifying appropriate relationships among objects is a very important factor in object-oriented-design. Putting too much focus on dividing the roles of objects can cause the deeply nested relationships. Both roles (modularities) and relationships need to be balanced.

Notes

  • You can call a method of parameter. But you should not call a method of return value of a method.
  • One common heuristic is that “if the code is duplicated twice, refactor them”. However, it doesn’t occur in real life. The issue of this approach is you sometimes cannot recognize the code duplication by tracking only the changed part of the code.
  • Decent programmers have good habits. You need some disciplines to always follow.
  • Avoid “let” statement in tests because the object construction is separated from the text itself. Also, the object becomes fragile, which is difficult to change for a certain specific test scenario.

Reference

Some related information.

Advertisements

Posted on July 5, 2013, in Ruby, Software Design, Web. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: