Michael Feathers about improving large classes
// if you have decent test coverage, then just start // rough if you dont have tests in place and to get them in place
// big class to better state // if static typed lang with interfaces
// revealing interfaces giant class with lots of responsibilities goto place where the class is used try and figure out what pieces of the class are used in this context create new interface, give it silly name like X big class starts implementing that interface goto place where its used. change it to use the interface and not the big class you get compilation errors because context tries to call on class then take signature from method from original class and add to interface to solve compilation errors stop at some point when no comp errors then you have an interface which represents the use in that context and find a better name for X no moving of methods to new class yet, but code is already better! do this over and over again until you notice points can be done without tests because compiler helps you and already improves the code the interfaces document the roles which your class takes inside the system
keep the god class as facade keep all public methods and delegate to new class that has the behaviour quite often when you mess with the protocol between a class and its client, things get more involved
making the code more habitable vs making it to best design same as: more accessible so that people understand what they are dealing with ?
how to communicate the intention: lets make this easier to understand. this looks like a separate resp, lets go and isolate this. not just classes but also methods: you know you make these small pieces and its cluttering things. before we had 3 classes, now we have 15. we dont see the primary things anymore see this constantly. people afraid to miss the big picture because you go and break out thigns and name them. i know it looks different and we have more pieces than before but you get used to it over time may take bit more work to understand where its happening, but once you do, the work is easier because its not tangled with other things the pain you feel when you do something like this, is just the pain of something different than what you used to. towards more granular is a nice direction. i can usually quickly find the thing i have to
please, trust me on this, once you get used to it, you
not just aa team on paper. we work on a giant canvas together.
we look for buy in from the team. rarely we would say “trust me” and just do it. sad?!
goto conferences because you see talks and learn things.