vendredi 16 février 2018

how to change a java code so that it will be customized by its subclasses with minimal impact

My code has below situation.

class A{

    public void putLogicHere(){

        //method is about 500 lines long.

        //Initial Few lines of code will be common 

        //middle part of code will be customized by its subclasses

        //Again here comes few lines of common code

    }
}

class B extends A{}
class C extends A{}

At a design level what approach should I decide to break this code further? considering middle part of method will be customizd by others in the hierarchy.

Aucun commentaire:

Enregistrer un commentaire