Speaking ill or well of the child in front of them. Both are equally disastrous.
Speaking ill of the child, talking about his faults, or something silly that he said affects the self-esteem of the child. S/he can pick on your tone, your facial expressions and also gauge the reaction of the listener. S/he will be more cautious on being himself around you and the listener the next time.
So your child may do that thing again, just be more careful of you finding out, that's all.
So consider the analogy of losing a bit of your child each time you do that.
Similarly speaking well of the child encourages the child for all the wrong reasons: mainly your approval. A better thing would be to tell the child how what they did will benefit them in the immediate now and the long run.
All this WITHOUT instilling the fear or shame attached to NOT doing it. Very important to remind the child of the reward for him, without the punishment.