Fine for simple stuff
“ every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility ”
views
services
models
mailers
helpers
controllers
assets
presenters
validators
serializers
forms
policies
lib
workers
paginators
jobs
inputs
importers
authorizors
% ls app/services
artist_email_list_manager.rb
artist_studio_manager.rb
tag_frequency_service.rb
...
class ArtistEmailListManager
def initialize(artist)
@artist = artist
end
def add_email(email)
...
end
def remove_email(email)
...
end
end
class ArtistStudioManager
def initialize(artist)
@artist = artist
end
def assign_studio(studio)
...
end
def unassign_studio(studio)
...
end
end
class TagFrequencyService
def self.compute(model)
# compute frequency of tag usage for model
...
end
end
class ArtistRepo
def self.find_by_art(art)
...
end
def self.find_by_name_or_login(name_or_login)
...
end
end
class ArtistAssociationsManager
def initialize(artist)
@artist = artist
end
def add_email(email)
...
end
def remove_email(email)
...
end
def assign_studio(studio)
...
end
def unassign_studio(studio)
...
end
end
Mr Rogers jon@carbonfive.com bunnymatic @rcode5