I'm struggling to come up with the name of a design pattern that I need to write about. I've been lead to think it was abstraction but apparently not.
Let's say I had a driver class which has a Drive
method:
public void Drive()
{
if(IsOnGasPedal)
{
//Lots of code
}
if(IsOnBrake)
{
//Lots of code
}
if(IsOnClutch)
{
//Lots of code
}
}
And I change the method to:
public void Drive()
{
if(IsOnGasPedal)
{
Car.Gas()
}
if(IsOnBrake)
{
Car.Brake()
}
if(IsOnClutch)
{
Car.Clutch()
}
}
I have moved the complex and long code into separate methods in my Car property so that the Drive method is more organised. This is an example of refactoring but that is not the word. I thought it was either encapsulation or abstraction but I can't get any solid answers. What is this pattern called?