ON
REFERRAL MANAGER
A.K.A
EQIPIA
HIRE MY FRIEND AND PAY ME
EMPHELUNGMANAGER
[ADD HERE WEIRD GERMAN NOUNS]
Have the best code ever because that's what makes us happy.
class Genius
attr_reader :number
def initialize(number)
@number = number
end
def be_a_genius
number * super_weird_Calculation
end
private
def super_weird_calculation
...
end
endRSpec.describe Genius do
subject { described_class.new(number) }
let(:number) { 10 }
describe '#number' do
it 'assigns the number' do
expect(subject.number).to eq(number)
end
end
describe '#be_a_genius' do
it 'returns something' do
expect(subject.be_a_genius).to be_present
end
end
endRSpec.describe Genius do
subject { described_class.new(number) }
let(:number) { 10 }
describe '#be_a_genius' do
it 'returns the super calculation' do
expect(subject.be_a_genius).to eq(1023464323)
end
end
endSynchronizer
Importer
Transformer
Saver
Options:
We need to decide
Base class
Child class
Parser
Normalizer
Sender
Class
class DefaultParser
include Service
...
end
class DefaultNormalizer
include Service
...
end
class DefaultSender
include Service
...
endclass Class
include Service
DEFAULT_PARSER = DefaultParser
DEFAULT_NORMALIZER = DefaultNormalizer
DEFAULT_SENDER = DefaultSender
def initialize(data, options = {})
@data = data
parser = options.fetch(:parser, DEFAULT_PARSER)
normalizer = options.fetch(:normalizer, DEFAULT_NORMALIZER)
sender = options.fetch(:sender, DEFAULT_SENDER)
end
def call
sender.call(normalized_data)
end
private
def normalized_data
normalizer.call(parsed_data)
end
def parsed_data
parser.call(@data)
end
endBetter specs
(we can inject both mocks and real classes)
Moar flexible
(we can modify behaviour without modifying the code)
THE ACTIVE NOTHING PATTERN
IDEAS?
HOW DO WE PUSH THIS THINGS FORWARD?
QA check specs for possible scenarios
ASK FOR IT
DO IT
Pair reviewing
Don't be afraid to propose big changes
Boy scouting
If you see something small you don't like... FIX IT!
If writing specs is hard... go fix the code to make it easier :)
Ask for help!
Read some chapters of a book every 2 weeks / 1 month / whatever
Gather and discuss
Decide what to apply, document possible cases
Use those example cases when boy scouting :)
Team reading club
When guiris in BCN, do at least 1 kata per week.
Pairing katas
Discuss solutions, share approaches
Decide what to apply, document possible cases
Use those example cases when boy scouting :)
HAVE BREAKFAST WHILE DOING IT! =P