To factor $ a^2-8a+ab-8b $ we can use factoring by grouping.
Group $ \color{blue}{ a^2 }$ with $ \color{blue}{ -8a }$ and $ \color{red}{ ab }$ with $ \color{red}{ -8b }$ then factor each group.
$$ \begin{aligned} a^2-8a+ab-8b &= ( \color{blue}{ a^2-8a } ) + ( \color{red}{ ab-8b }) = \\ &= \color{blue}{ a( a-8 )} + \color{red}{ b( a-8 ) } = \\ &= (a+b)(a-8) \end{aligned} $$