void method( var1, var2 )
{
if ( something )
{
// Do 20 things
}
else
{
// Do 20 other things
}
// Do something
if ( somethingelse )
{
// Do 15 things
}
else
{
// Do 25 other things
}
// Do something else
if ( God )
{
// Do 30 things
}
else
{
// Do 50 other things
}
}
Changes to:
void method2( )
{
if ( something )
{
// Do 20 things
}
else
{
// Do 20 other things
}
}
void method3( var1, var2 )
{
if ( somethingelse )
{
// Do 15 things
}
else
{
// Do 25 other things
}
}
void method4( )
{
if ( God )
{
// Do 30 things
}
else
{
// Do 50 other things
}
}
void method( var1, var2 )
{
method2( );
// Do something
method3( var1, var2 );
// Do something else
method4( );
}