I have common methods written in different classes, making code duplicate and now to avoid this duplicacy, I am thinking of 2 approaches:
- Make static methods in some util class and call them, or
- Make a super class and write all these methods in super class and extend each class with this super class.
Definitely, with approach 2, I will loose the ability to extend my class further. So I am thinking to go with approach 1.
Can you please help me in identifying which approach is good and also in suggesting better approach, if you have any?
Aucun commentaire:
Enregistrer un commentaire