Is caning or yelling at kid a right way to educate kid? To me it is not. Yes, perhaps you could see the 'instant result' after that, but is that forever?
Child pick up parents' behavior very fast, to them 'mom/dad caned/scolded me when they want something from me/they want to stop me from doing something' (to them it's something, because they don't even know it is wrong) thus 'I can do the same thing if I want something from someone/I want to stop somebody doing things that I don't like.'
For typical children who have awareness on what is wrong and what is right, they might be able to suppress that thought of beating people or shouting at someone (bear in mind, that is not forever, the aggressive thought will be deep in subconscious and carry forward in live - the root of family abuse). However, for children with special needs who have low awareness on this, it is difficult to them, thus, here come the behavior problem.
Some time we lost our temper, some time we lost our patient. We are all human, we make mistake, we are all born with emotion. It is okay, if you have accidentally shouted at your kids, it is okay too, if you feel guilty after that. No one has the right to tell you 'you are wrong to disciplined your kid'. Take a step back, breath in and out, repeat this in your mind: 'I am an adult, he is just a kid, I can out beat this!'.
So, now the question is, 'what is the right way?'
To answer this, there is no right way, however, there is only reasonable way. Be firm and consistent are definitely the key words. Be firm on your instructions and be consistent with your actions.
What make shouting and being firm different?
Being firm is when you want something to be done and you insist to;
shouting is when you express your anger. Often yelling at kids will make their behavior go worst. What we need are a deep breath and be firm and be consistent on the consequences. Remember, discipline a child is not an overnight thing. It could take a week or even more to see the outcome. Give you a scenario:
For instance, you enter your house with a messy living room, while your kid just happily walk away to station 2 to create another mess.
'Keep the toys', he just walk away without giving you much reaction, repeat the same instruction, but this time round give a bit of clue to him by pointing at the toy (gestural prompt). Oh hack! He is still not listening! Keep calm parents! Repeat the same instruction again, but this time round, hold his hand, physically prompt him to keep the toys, and of cause, you could offer some help, let's say 'We keep it together'. At this point, he would probably struggling with you, kicking your, elbow striking or punching in your face, again, breath in and out (KEEP CALM IS ALWAYS THE WORD). Get the job done, then leave him alone (he would be at the state of devastating), praise his effort of keeping away the toys (even though you literally just went through all the struggle with him), tell him that you love his effort and try again next time. And there, you get your desire outcome, even though you ended up bruises every where, be consistent with your instruction, if you want the him to keep away the toys every time he is done with them, then make sure you are doing it every time when he is not keeping the toys. At the end of the day (maybe 1 or 2 weeks later), you would eventually get your fruitful outcome.
Remember, we are just human, born with emotion, it is okay if you accidentally shouted or lost your temper at your kids. Take a step back, self regulate first before you gain back your sanity to discipline your kids.