moneyadviceservice/frontend — pull request #19 by andrewgarner (2014-01-27 19:54:22+00:00)
Title: Consume Articles from MAS API

These changes introduce a strategy to consume external data, starting with an Article. The implementation deviates somewhat from Rails conventions insofar that it attempts to adopt Uncle Bob's idea of [Clean Architecture].

By isolating business logic from application logic through a core library I have attempted to provide a solution that has clean, decoupled code, that is easy to maintain and extend.

To provide the missing application logic one simply has to implement a controller that collaborates with the interactor then implement the presentation layer:

```ruby
require 'core/interactors/article_reader'

class ArticlesController < ApplicationController
decorates_assigned :article, with: ArticleDecorator

def show
@article = Core::ArticleReader.new(params[:id]).call do
head :not_found
end
end
end
```

I'm hoping that this approach will complement the front-end / back-end split of the team. Back-end developers would implement the business logic of a feature (as demonstrated here) which can then be picked up by a front-end developer. As a back-end developer I would be concerned with implementing the business logic exercised by tests. As a front-end developer I can focus on application specific behaviour, writing acceptance tests to discover the routes, controllers, decorators and views that need introducing.

[clean architecture]: http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html