Punishing your cat is never a good idea. Even if you don't hurt them or don't use a very severe punishment, the reality is that cats can't draw the connection between their action (for example, scratching the sofa) and your reaction.
What in the world does a perfectly normal action, such as marking their territory or sharpening their little claws, have to do with that sudden aggression that your human has displayed from out of nowhere?
Instead, the cat will associate the punishment directly with the human who applied it and, naturally, will try to avoid that person.
Cat behavior experts, therefore, recommend that you train them instead with rewards: food, attention, toys.