Personal Notes from Sendagaya.rb #176

This article was automatically translated from Japanese by AI. Read the original Japanese version →

Table of Contents

I went to Sendagaya.rb #1762016-12-12(月)19:30 - 21:40 参加登録時にツイートしてもらえると喜びます 今回の内容 オブジェクト指向設計実践ガイド を読む 75ページ〜 3.2 疎結合なコードを書く 3.3 依存方向の管理 質問とか気…Sendagaya.rb · sendagayarb.doorkeeper.jp.

Main Activity

Reading "Practical Object-Oriented Design in Ruby"

Starting from page 75~

Below are some memorable conversations from the session.

The Service Layer Turning into a Dumping Ground

  1. Move logic to the Model to avoid a Fat Controller
  2. The Model starts getting Fat
  3. Extract logic spanning multiple tables (models) into a Service layer
  4. The Service layer gradually turns into a dumping ground

No matter what conventions an MVC web application framework gives us, we can never escape our duty to design proper classes.

api/mypage.json ... Ugh, My Head...

The quintessential non-RESTful API you end up building even when trying to stay RESTful, because you can't escape the app side's demand to minimize API requests. Oh well ¯\_(ツ)_/¯
Clients and servers can't be cleanly separated that easily. On the server side, it's better to handle this cleanly by isolating JSON rendering into the View layer. If you put JSON rendering logic into the Model layer, you're doomed.

Webpack Might Make It into Rails 5.1

rails/webpackerUse Webpack to manage app-like JavaScript modules in Rails - rails/webpackerGitHub · github.com

Webpack adoption among Rails users seems pretty high already, so this sounds like a nice fit.
We might need to add rails webpacker:compile to our deploy commands.

MVVM (Frontend Talk)

We talked about whether a frontend model layer ends up overlapping with server-side code. Because the frontend's responsibilities (UI transitions, input/output) and the server's responsibilities (DB transaction management, etc.) are clearly distinct, I haven't actually struggled much with the design there so far.

Anemic Domain Model

mamelog.hatenablog.jp

Because the code doesn't speak for itself, people try to force it to speak through comments.

That's it—we didn't get very far in the book, but it was a worthwhile meetup.