Why is the differentiability of a piecewise defined function often studied using the definition of derivative?
For example, let: $\begin{align*} f(x) &= x\cdot |x-1|\\ &= \left\{ \begin{array}{lcl}x (-x+1)& \text{if} & x < 1 \\ x (x-1) & \text{if} & x \geq 1 \end{array} \right.\\ &= \left\{ \begin{array}{lcl}-x^2+x& \text{if} & x < 1 \\ x^2-x & \text{if} & x \geq 1 \end{array} \right. \end{align*}$
$f$ is continuous in $\mathbb{R} $ except, maybe, when $x=1$: $\begin{align*} \lim_{x \to 1^{-}} f(x) &= \lim_{x \to 1} (-x^2+x) = 0\\ \lim_{x \to 1^{+}} f(x)&= \lim_{x \to 1} (x^2 -x) = 0 \end{align*}$
$f$ is continuous when $x=1$ because: $ \lim_{x \to 1^{-}} f(x) = \lim_{x \to 1^{+}} f(x) = f(1) $
As to the differentiability at that point (by derivative's definition):
$\begin{align*} \lim_{h \to 0^{-}} \frac{f(1+h)-f(1)}{h} &= \lim_{h \to 0} \frac{\left[-(1+h)^2 + (1+h)\right] - \left[-1^2 + 1\right]}{h}\\ &= \lim_{h\to 0} \frac{- h(h+1)}{h} = -1\\ \strut\\ \lim_{h \to 0^{+}} \frac{f(1+h)-f(1)}{h} &= \lim_{h \to 0} \frac{\left[(1+h)^2 - (1+h)\right] - \left[1^2 - 1\right]}{h}\\ &= \lim_{h\to 0} \frac{h(h+1)}{h} = 1 \end{align*}$
$ \lim_{h \to 0^{-}} \frac{f(1+h)-f(1)}{h} \neq \lim_{h \to 0^{+}} \frac{f(1+h)-f(1)}{h} $
so $f$ is not differentiable when $x=0$.
The "second" method is:
f'(x) = \left\{ \begin{array}{lcl} -2x + 1& \text{if} & x < 1 \\ 2x-1 & \text{if} & x > 1 \end{array} \right.
f'(1^{-}) = -1 \neq f'(1^{+}) = 1
Is there any case in which the differentiability study by using the derivative (the second method) would be wrong?