• Stars
    star
    110
  • Rank 305,147 (Top 7 %)
  • Language
    Ruby
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic.

From fat controllers to use cases

Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic.

Instructions to run this application

  • Ruby version: 2.6.5
  • System dependencies: sqlite3
  • Configuration and database creation: bin/setup
  • How to run the test suite: bin/rails test

The different kinds of architecture (project versions)

Version Description Rubycritic Score
1 Fat controller 91.53
2 Fat model, skinny controller 87.45
3 Concerns 89.25
4 Service objects 92.55
4.1 Service objects - Inheritance 92.93
4.2 Service objects - Inheritance overusing 93.15
5 Interactors 96.36
6 Domain objects 94.71
7 Use cases (Micro::Case) 94.97
7.1 Use cases - Dryer version 95.24
7.2 Use cases- Improving the SRP 95.11

Hint: in any of the versions above, use bin/rails rubycritic to see the full report result.

Extra: How to list all the use cases?

Use the use_cases task. e.g:

bin/rails use_cases

# Lines:
#     11 ./app/models/user/register/step/serialize_as_json.rb
#     12 ./app/models/user/register/step/validate_password.rb
#     17 ./app/models/user/register/step/create_record.rb
#     19 ./app/models/user/register/step/normalize_params.rb
#     10 ./app/models/user/register/flow.rb
#     18 ./app/models/todo/list/add_item.rb
#     16 ./app/models/todo/list/complete_item.rb
#     14 ./app/models/todo/list/delete_item.rb
#     12 ./app/models/todo/list/fetch_items.rb
#     14 ./app/models/todo/list/find_item.rb
#     19 ./app/models/todo/list/update_item.rb
#     16 ./app/models/todo/list/activate_item.rb
#     21 ./app/models/todo/serialize.rb
#    199 total
#
# Files: 13

Note: This task will only be available in the branches with use cases (v7, v7.1, v7.2).

More Repositories

1

u-case

Represent use cases in a simple and powerful way while writing modular, expressive and sequentially logical code.
Ruby
511
star
2

awesome-activeadmin

A curated list of awesome activeadmin resources, extensions, posts and utilities.
369
star
3

u-attributes

Create "immutable" objects with no setters, just getters.
Ruby
93
star
4

dicas-de-programacao-em-ruby

Dicas para iniciantes de boas prรกticas de desenvolvimento de software em Ruby
Ruby
91
star
5

request_via

RequestVia: A Functional HTTP Client That Wraps Net::HTTP
Ruby
74
star
6

todo-bcdd

Ruby
55
star
7

kind

A development toolkit for Ruby with several small/cohesive abstractions to empower your development workflow - It's totally free of dependencies.
Ruby
37
star
8

rails_app_to_refactor

A Rails app that was intentionally designed to be refactored.
Ruby
34
star
9

u-observers

Simple and powerful implementation of the observer pattern.
Ruby
31
star
10

u-struct

Create powered Ruby structs.
Ruby
19
star
11

type_validator

Adds type validation for classes with ActiveModel::Validations.
Ruby
17
star
12

elm-pt-br

Elm lang "awesome list" em pt-BR
13
star
13

exercitando-dicas-de-programacao-em-ruby

Ruby
9
star
14

ruby-lambdas

Expose Ruby object methods as lambdas (functions).
Ruby
9
star
15

event-sourcing-with-elixir

Implements an API in Elixir/Phoenix with Event Sourcing/CQRS, based on the excellent blog post series of https://blog.nootch.net.
Elixir
7
star
16

string_utility_belt

Useful methods for strings!
Ruby
7
star
17

u-authorization

Simple authorization library and role managment for Ruby
Ruby
6
star
18

slack-time-tracker

This project is simple slash command time tracker.
Ruby
5
star
19

lodash_ext

lodash.js / underscore.js extensions.
JavaScript
4
star
20

elixir-playground

Elixir
4
star
21

rake_challenge

Desafio para capacitar pessoas no desenvolvimento com a linguagem Ruby
Ruby
3
star
22

stringub-commons

This library borned from the early versions of string_utility_belt gem, this gem adds new common purpose methods to String class. E.g: split a string in words, replace a sequence of spaces per a unique space.
Ruby
3
star
23

banking_app

Elixir
2
star
24

Tita.js

JavaScript
2
star
25

conduit-commanded

My implementation of Building Conduit "eBook" using updated dependencies. e.g: Phoenix 1.4.6, Guardian: 1.2, comeonin 5.1...
Elixir
2
star
26

rails-components

Ruby
2
star
27

pt-BR

Ruby
2
star
28

minitest-exploration

Project to explore the minitest gem
Ruby
2
star
29

test-rack-cors

Sample os how to request from an app (Rack) via ajax to another one (Rails).
Ruby
1
star
30

ra-trustvox-backend-engineer-challenge

RA Trustvox - Backend Engineer Challenge
Ruby
1
star
31

phx-todo_api

App created to practise the blog posts of blog.codeship.com about Elixir/Phoenix.
Elixir
1
star
32

solid-process

Ruby on Rails/Business Process
Ruby
1
star
33

railway_oriented_programming_em_ruby

Ruby
1
star
34

firebase-ui-on-rails

A Ruby on Rails version of FirebaseUI for web - Auth Demo
Ruby
1
star