Push Down

In software engineering, Push Down refactoring involves moving a method from a superclass into a subclass. Compare the following Java classes before and after the Push Down refactor is applied:

   public class SuperClass{
       void methodA() {
           //do something        
       }
   
       void methodB() {
           //do something else
       }
   }
   
   public class SubClass extends SuperClass {
       void methodC() {
           //do something
       }
   }

After the Push Down refactor is applied:

   public class SuperClass{
       void methodA() {
           //do something        
       }
   }
   
   public class SubClass extends SuperClass{
       void methodB() {
           //do something
       }
   
       void methodC() {
           //do something else
       }
   }

See also

Pull Up refactoring

This article is issued from Wikipedia - version of the Monday, January 16, 2012. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.