When do we use stars and bars

Hello,
I am not sure when we can use stars and bars and when we can't. For example, in this question:
How many ways are there to put 5 balls in 3 boxes if the balls are not distinguishable and neither are the boxes?
Is the answer 7 choose 2?
If, for example, the balls become distinguishable, how does that change the stars and bars formation? What if both become distinguishable (i.e. the balls and boxes?)
Thanks,

@authenticcrane If I recall correctly, stars and bars is for both indistinguishable items. Thus your reasoning as to why it is 7 choose 2 is correct. Unfortunately, I do not think you can manipulate stars and bars for items that are distinguishable.