the situation is like this:
im creating a Logger class that can write to a file but the write_to_file() function is in a helper class as a static function.
i could call that function but then the Log class would be dependent to the helper class.
isn’t dependency bad?
but if i can let it use a helper function then what is the point of having helper functions?
what should one prioritize here: using helper functions and have to include this helper class everywhere (but the other 99 methods wont be useful) or just copy and paste into the Log class (but then if i have done this 100 times and then make a change i have to change in 100 places).
share your thoughts and experience!
Dependencies aren’t bad per se; they just need to be effectively managed. It sounds like you might have a helper class that has more than one responsibility (100 methods seems like a lot to me), so maybe that helper class needs to be split apart into multiple classes.
Another option is to create a IFileWriter interface which has the one helper method you need on it. Then, have the helper class implement that interface, and have the logger depend on the interface and not on the concrete helper class. That way, if you ever have the time to refactor the helper class the logger doesn’t have to change.