Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Final commits on technical debt doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Harris committed Apr 18, 2016
1 parent e22d096 commit aa49cfa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -27,9 +27,9 @@ We are following a variant of the standard [git flow](http://nvie.com/posts/a-su

Unlike git flow, there is no requirement to prefix any of your branches with type strings like `feature/` or `hotfix/`, but you **must** submit any pull request against the `develop` branch. Pull requests against `master` will be rejected.

### Presenters and Models
### Preventing Technical Debt

One drawback to Rails' standard model-view-controller paradigm is that model objects tend to get cluttered over time with many different presenter methods for displaying attributes in specific formats, etc. Rails already has a notion of `helpers`, but those can only be called from within views and live in a global namespace. Instead, we have defined separate Presenter classes for each model located in `app/models/presenter` and this is where most new functionality should be added. Model classes should contain only basic methods that operate with ActiveRecord.
One drawback to Rails' standard model-view-controller paradigm is that model objects tend to get cluttered over time with many different methods for all sorts of different reasons. We want to prevent this as much as we can. Read our [document on technical debt](TECHNICAL_DEBT.md) to understand how things are organized.

## Public domain

Expand Down
13 changes: 11 additions & 2 deletions TECHNICAL_DEBT.md
Expand Up @@ -212,9 +212,14 @@ This isn't really worth it for a little repetition in two methods, but
it can be very convenient if you find yourself repeating the same
conditionals in many methods.

Similarly, we have a few places where we branch depending on the
auction type. This will likely make a good candidate for similar
refactoring in the future.

# Null Objects

Polymorphism is also useful for reducing the logic of null responses. Too often, we have code like this
Polymorphism is also useful for reducing the logic of null
responses. Too often, we have code like this

``` ruby
user_bid = auction.user_bid
Expand Down Expand Up @@ -260,4 +265,8 @@ Much cleaner. There are a few places where we define `Null`
equivalents to the `Presenter::Bid` and `Presenter::User` object for
instance.

# What's Next?
# Further Reading

* [Practical Object-Oriented Design in Ruby](http://www.sandimetz.com/products)
* [Objects on Rails](http://objectsonrails.com/)
* [Nothing is Something](https://www.youtube.com/watch?v=OMPfEXIlTVE)

0 comments on commit aa49cfa

Please sign in to comment.