The most common signalling agreement when discarding is 'discourage/encourage' or 'show/deny strength'. This can be done 'directly', i.e. by playing a card in that suit, or 'indirectly', i.e. by discouraging one suit we may indicate strength in another because otherwise we might have chosen to discourage that suit instead. That's the easy definition. In real life many other things may factor in. Does dummy has a trick source? What did the lead reveal? How many cards does dummy have in a particular suit, can I afford to discard one? And so forth.
A very important aspect is what general signalling philosophy that your partnership applies. The main 'sides' are:
1) Obvious-shift style where the key word is INTENTION.
2) Actual holding (what do I have), where the key word is POSSESSION.
There are layers of this, but an easy example of this might be when partner leads an ace vs a suit contract and I have a weak holding in that suit. Style 1 would encourage or discourage depending on the holding in the suit partner would be most likely to shift to if I discourage. Style 2 would discourage, as we have nothing to contribute, and leave it to partner to work out how to continue (with the information that I don't have any strength in this suit). There are advantages and disadvantages to both and exceptions, such as cases when you intentionally choose to mislead partner because you can see it's correct (by looking at your hand and dummy).
It might actually even be proper to have a different terminology for these styles. Perhaps the INTENTION-style is best described by 'encouraging/discouraging' and HOLDING-style should be coined 'strength/weakness'. That would also be better from a disclosure perspective as it would give the declaring side a better understanding of your signalling methodology, something he/she is entitled to.
Well, I digress. Back to the defence vs 4S. The reason for the above is that playing style 1, a high diamond (relatively, according to UDCA) here wouldn't necessarily say anything about the Q if he really want another suit/shift. It would only say that he's got no interest in you playing a diamond if you're on lead. Playing style 2, the [relatively] high diamond would (should) pretty much deny the Q. When looking at this particular dummy it's hard to find a case where an exception might apply.