Honking the horn to let someone know about a dangerous situation is not illegal. Honking the horn for a long period so that the other person knows just how mad s/he made you is illegal.
I taught my kids that, generally, if you have to honk, then you already screwed up by not seeing the situation develop in the first place. Of course, there are exceptions, but it is exceedingly rare for a situation to develop wherein blowing the horn is the ONLY way to avoid an accident.