18
dear Ruby friends

Rails refactoring call for help

Embed Size (px)

DESCRIPTION

I'm working on techniques that help you safely refactor your Rails codebase. At the start I'm mostly focusing on the Rails controllers. You can sign up at http://rails-refactoring.com/ for free rails refactoring lessons. Meanwhile, please send me more examples of Rails controllers, so that I can discover better patterns. [email protected]

Citation preview

Page 1: Rails refactoring call for help

dear Ruby friends

Page 2: Rails refactoring call for help

It’s fun to talk about …

Page 3: Rails refactoring call for help

Microservices, bounded contexts, DDD, DCI, Hexagonal, Clean

Architecture, UncleBob, events, CQRS, streams, microapps

Page 4: Rails refactoring call for help

but…

Page 5: Rails refactoring call for help

Then we go back to our controllers

Page 6: Rails refactoring call for help

so called, real life

Page 7: Rails refactoring call for help
Page 8: Rails refactoring call for help
Page 9: Rails refactoring call for help
Page 10: Rails refactoring call for help

Can you safely improve it? !

step by step? !

quickly?

Page 11: Rails refactoring call for help

it’s difficult

Page 12: Rails refactoring call for help

but possible !

even without tests

Page 13: Rails refactoring call for help

safe techniques include:

Page 14: Rails refactoring call for help

• inline controller filters

• move model callbacks into controller

• render views explicitly without @ivars

• move action to a new class (service object)

• …

Page 15: Rails refactoring call for help

I need more examples of ugly controllers and

models

Page 16: Rails refactoring call for help

Send them to me, please :) !

@andrzejkrzywda [email protected]

Page 17: Rails refactoring call for help

I will add it to my book! !

fame forever

Page 18: Rails refactoring call for help

http://rails-refactoring.com/