My children are older, OP (16 plus).
One in particular was extremely difficult (ASD). However, I was complimented many, many times on how well behaved they all were in public/restaurants/other people's houses, etc.
These same children could be absolutely foul: tantrummy, 'non-compliant', over-exuberant (i.e. boisterous), aggressive to one another, whingey, etc, etc, etc.
I spent a lot of time thinking I was either too strict, or not strict enough.
OP, I think things that worked to keep a balance were:
Some things are absolutely not negotiable. If they have the idea that there is any wriggle-room whatsoever, they will exploit it. So going to bed, in your own bedroom, at (insert appropriate time for young child) is non-negotiable. Eating only sitting at the table is non-negotiable (no walking around eating, or hopping up and down from the table, etc). Transgressions merit one warning, and then the offender is removed. This is absolutely vital, as a child who doesn't know that food is only consumed at the table, as a group, is the same child who runs around in restaurants, annoying other customers and getting in the way of the staff.
I think those were the two big 'non negotiables'', but they were generally helpful as it gave the DC the idea that some things were set in stone - which comes in handy when you want them to behave in a certain way in a certain setting.
So: restaurants. I used to take mine to a rather fine place for coffee and biscuits (they didn't have coffee, obviously) before taking them for a very long walk on Sundays. This involved a lot of prior preparation ("When we get there, we are all going to talk quietly and sit in our chairs", etc). It also involved me being engaged with them the whole time. I couldn't read the papers: I kept them occupied with stories, cards, hangman etc. This was pre-phones, tablets, etc (though I think actual engagement with the child is a far better way to do it, as they learn 'better manners', if you like, than they would from staring at a screen while the adults do their own thing). So it was not a relaxing experience, but it gave them the idea that 'nice' places require 'nice' behaviour (they were always so well behaved that they were great favourites with the staff). The best thing was always when crotchety old types would come in and glare at the sight of 'small children', but would then end up saying how nice it was to encounter such pleasant and polite and quiet children. These same children then got to run around the woods for the rest of the day, bickering, moaning about 'he said' and 'she said', running around and yelling. Because those things are absolutely fine outside where they're among other children all doing the same.
After that, the likes of Pizza Express, cafes are a bit easier (though, again, I just had to keep them occupied all the time - colouring, noughts and crosses, etc). I also had a couple of very special hand puppets which only came out on very special occasions (i.e. when I particularly needed them to behave). They used to love talking to the Special Puppets.
So I suppose it's context, OP.
My child with AS was a PITA at toddler groups etc (or would have been). The only way round this, for me, was for me to forget any ideas of having a chat with other mums (sod socialising the children: socialising with other mums was the main reason I was there) and engage with him instead. I sort of had to show him how to play in such a way that he wasn't going to piss everyone off. I could do this with him, as I was reasonably sure that the others would potter around without too much drama.
It is very hard work, though.
As I say, mine are now older and are still capable of being absolutely unspeakable at home, and one in particular is a 'one of the crowd' type and is prone to doing very ill-considered things, just as she was when she was a toddler (though I can take them all anywhere, and they are apparently excellent house guests).
Sorry for the essay, @OneStepAheadOfTheToddler I could just have said "striking the balance is really hard work". 