Look at this beauty: https://github.com/crowbar/crowbar-core/blob/master/crowbarframework/app/models/serviceobject.rb#L941

Nice uh? Its a 500 lines methods that its distinctly separated into 4 different pieces internally that make 4 very distinct phases inside.

So why not split that into 4 different methods with nice names that make clear what they are doing, then make apply_role just call those 4 methods? Sounds like that would make it more clear and easy to make modification to it. Not only that, but have you think about testing? Testing that big of a thing sounds difficult, while testing 4 different methods separated should be much easier!

The goal of this project is as follows:

  • Split apply_role into (at least) 4 different methods that cover the 4 different steps inside it
  • Add tests for those 4 different methods
  • ???????
  • profit!

Risks and challenges

  • Break apply_role functionality
  • If everything goes as expected and this is properly done, we may get too much love from our workmates for making their lives easier


Be the first to comment!

Similar Projects

This project is one of its kind!