Upload
vladimir-rybas
View
57
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Organizing Rails Code. Namespacing::Approach
Citation preview
Organizing Rails Code
Namespacing::Approach
Typical Rails Architecture
Services
Service Layer
The `/lib` of Doom
1. Extract Value Objects2. Extract Service Objects3. Extract Form Objects4. Extract Query Objects5. Introduce View Objects6. Extract Policy Objects
7. Extract Decorators
The `/app` of Doom
Namespaces For The Win!
Dashboard displays Users List
1. Paginated2. Sortable
3. Searchable4. `current-user` specific
Create Namespaced Class
Use Namespaced class
The same in other controllers(assuming we got several user lists with different behavior)
`/lib` is for “shared” code ony. e.g ‘paginated’
The same with models
Services
VS
Big Ball of Mud
Living Organism