That’s not what the science says. Time outs are very effective if used correctly. Too many parents do them in anger.
Time outs do not work with many kids. I had two who LOVED time-outs. They are also ineffective with young kids who do not link things thru time.
Spanking a 12 year old makes no sense to me. But it can work great with a 2 year old.