• 0 Posts
  • 73 Comments
Joined 4 months ago
cake
Cake day: June 12th, 2024

help-circle













  • It’s only as incomprehensible as you make it.

    If there are 6 subfunctions, that means there’s 6 levels of abstraction (assuming the method extraction was not done blindly), which further suggests that maybe they should actually be part of a different class (or classes). Why would you be interested in 6 levels of abstraction at once?

    But we’re arguing hypotheticals here. Of course you can make the method implementations a complete mess, the book cannot guarantee that the person applying the principles used their brain, as well.




  • You’re nitpicking.

    As it happens, it’s just an example to illustrate specifically the “extract to method” issues the author had.

    Of course, in a real world scenario we want to limit mutating state, so it’s likely this method would return a Commission list, which would then be used by a Use Case class which persists it.

    I’m fairly sure the advice about limiting mutating state is also in the book, though.

    At the same time, you’re likely going to have a void somewhere, because some use cases are only about mutatimg something (e.g. changing something in the database).