HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

October CincyRb - Jim Weirich on Decoupling from Rails

Launch Scout1 HN recommender · recommended in 1 month, 2014-2017
YouTube
48K views · 13 years ago · talk · evergreen

A Cincinnati Ruby meetup talk by Jim Weirich on decoupling application logic from Rails. He argues for separating business logic from framework and database models.

Cited in HN debates on testing and clean architecture as a concrete example of keeping domain code separate from Rails so tests run fast.

Software architecture & designPython, Ruby & scripting languages#rails#ruby#decoupling#unittesting#cleanarchitecture

5 comments from Hacker News

@theptip2017 · in “The Clean Architecture (2012)”

This is a powerful technique, though I'd say it's more useful for the build pipeline than for developers running UTs while coding (since the schema can change more frequently while doing so). To provide a counterpoint though, an advantage touted by advocates of complete decoupling from the DB is that your UT suite can run in O(one minute), rather than O(ten minutes). E.g. see ▶ this video . I'm not 100% sold on this approach yet (separating your domain objects entirely from the ORM wrapper is an uphill struggle), but it's interesting.

CitesView on HN
@theptip2017 · in “Zen and the Art of Unit Testing”

Here's a retort to that argument from the source (Uncle Bob): link DHH wrote an article with the title "test induced design damage", not sure if he coined the term. I think there's a grain of truth there; it is possible, but not necessary, to mangle your architecture to enable testability. The case that DHH was complaining about is quite interesting in itself; it was an architecture that Weirich suggested ( ▶ this video ) where the framework DB models (in his case Rails) are separated from the Domain Models, to allow you to 1) run your tests of the business logic faster (without spinning up a DB) and 2) decouple your business logic from your choice of framework. I've felt the need for this factoring in my own code, but actually making it happen is tricky, since you lose a lot of the magic that makes your life easier (but that also couples every level of your architecture to the framework's concepts).

CitesView on HN
@theptip2016 · in “Test Induced Design Damage? (2014)”

I'm interested to hear the patterns that users of MVC frameworks like Rails and Django have adopted when "fat models" start to become unwieldy. The video "Decoupling from Rails"[1] that's linked in this article was quite interesting, and argued a complete separation of business logic from the model code, to allow the business logic to be tested (and reused) more easily. I've definitely found fat-model code to be tricky to mock and test at times in Python/Django, as mocking out the ORM is gnarly. But if the business logic operates on proxy objects, then it would be much easier to do so. On the other hand, DHH's retort to this approach also makes some good points regarding the introduction of excess complexity[2]. It's a fair point that architectural decisions should not be motivated by the speed of the UTs. But perhaps there are other benefits to the Hexagonal architecture, as well. [1]: ▶ this video [2]: link

RecommendsView on HN
@brudgers2014 · in “Ask HN: Which are good computer science problems to work on right now?”

Decoupling business logic from web frameworks might be an interesting architectural problem that could use better tooling. Here's Jim Weirich going about it manually in Rails: ▶ this video

CitesView on HN
@kentwistle2014 · in “Slow database test fallacy”

Am I only the only one that doesn't find 'All tests in 4 minutes, all model tests in 80 seconds' very impressive? It sounds like a really long time to me. You know what could increase the speed dramatically.... decoupling. I also think decoupling phrased in the context of the Rails 2 to Rails 3 upgrade, where pretty much everything changed, makes perfect sense. Imagine just having a few wrapper classes that spoke to Rails and only having to adapt them. Sounds good to me! Bernhardt: Boundaries link Weirich: Decoupling from Rails ▶ this video Wynne: Hexagonal Rails link

CitesView on HN
GoRuCo 2012 Hexagonal Rails by Matt Wynne29:23

GoRuCo 2012 Hexagonal Rails by Matt Wynne

Confreaks
17K views • 14 years ago
Ruby Midwest 2011 - Keynote: Architecture the Lost Years by Robert Martin1:06:39

Ruby Midwest 2011 - Keynote: Architecture the Lost Years by Robert Martin

Confreaks
172K views • 14 years ago
Rails Conf 2012 Keynote: Simplicity Matters by Rich Hickey36:53

Rails Conf 2012 Keynote: Simplicity Matters by Rich Hickey

Confreaks
220K views • 14 years ago
Lone Star Ruby Conference 2010 Real Software Engineering by Glenn Vanderburg51:57

Lone Star Ruby Conference 2010 Real Software Engineering by Glenn Vanderburg

Confreaks
30K views • 15 years ago
The Clean Architecture in Python49:54

The Clean Architecture in Python

Next Day Video
114K views • 12 years ago
Yehuda Katz - Why Rails is Hard (Railsberry 2012)53:12

Yehuda Katz - Why Rails is Hard (Railsberry 2012)

applicake
29K views • 14 years ago
RailsConf 2015 - Nothing is Something35:53

RailsConf 2015 - Nothing is Something

Confreaks
84K views • 11 years ago
MountainWest RubyConf 2014 - But Really, You Should Learn Smalltalk28:06

MountainWest RubyConf 2014 - But Really, You Should Learn Smalltalk

Confreaks
27K views • 12 years ago
RailsConf 2014 - Keynote: Writing Software by David Heinemeier Hansson1:01:17

RailsConf 2014 - Keynote: Writing Software by David Heinemeier Hansson

Confreaks
123K views • 12 years ago
RailsConf 2014 - All the Little Things by Sandi Metz38:47

RailsConf 2014 - All the Little Things by Sandi Metz

Confreaks
190K views • 12 years ago
Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich53:22

Ruby Conf 12 - Y Not- Adventures in Functional Programming by Jim Weirich

Confreaks
65K views • 13 years ago
RailsConf 2011: Aaron Patterson, "Double Dream Hands: So Intense!"47:34

RailsConf 2011: Aaron Patterson, "Double Dream Hands: So Intense!"

O'Reilly
26K views • 15 years ago
RailsConf 2016 - Rails to Phoenix by Brian Cardarella28:34

RailsConf 2016 - Rails to Phoenix by Brian Cardarella

Confreaks
12K views • 10 years ago
Ruby Conf 12 - Boundaries by Gary Bernhardt45:55

Ruby Conf 12 - Boundaries by Gary Bernhardt

Confreaks
58K views • 13 years ago
Rails Conf 2013 The Magic Tricks of Testing by Sandi Metz32:23

Rails Conf 2013 The Magic Tricks of Testing by Sandi Metz

Confreaks
144K views • 13 years ago
RailsConf 2019 - Opening Keynote by David Heinemeier Hansson1:01:08

RailsConf 2019 - Opening Keynote by David Heinemeier Hansson

Confreaks
46K views • 7 years ago
7 minutes of Pharo Smalltalk for Rubyists7:15

7 minutes of Pharo Smalltalk for Rubyists

Avdi Grimm
37K views • 11 years ago
Hacker Way: Rethinking Web App Development at Facebook44:36

Hacker Way: Rethinking Web App Development at Facebook

Meta Developers
900K views • 12 years ago
Brian Goetz - Stewardship: the Sobering Parts1:03:31

Brian Goetz - Stewardship: the Sobering Parts

ClojureTV
39K views • 11 years ago
Spec-ulation Keynote - Rich Hickey1:16:14

Spec-ulation Keynote - Rich Hickey

ClojureTV
135K views • 9 years ago