java - best way to seperate common methods -


i have common methods 2 classes , maybe others in future. therefore not want copy same methods in classes. thought create utility class , put these methods inside , send necessary data parameter. read using utility class violate oop.

as second, thinking apply strategy pattern not need change behaviour of method in runtime, work same both classes therefore looks not suit problem.

do have idea best approach situation or design pattern applied?

it's not bad violate oop utility class.

almost frameworks (spring, hibernate you_name_it) extend.

furthermore, if later plan support code, composition easier refactor / support maintain inheritance in classes.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -