There's a few conflicting things here. One is that you fire an employee then moment it becomes obvious they will have to be fired, so a firing should be quick. Another is that performance problems should be addressed - an employee should know if their current performance is not acceptable. Finally, you don't want an employee (especially programmers) to know that they will be fired, or they attack you from within.
Of course, it does seem like management was very passive-aggressive here. Not good.
A quick edit - I HATE the term "passive-aggressive". All usually means (in the workplace) is "not actually doing their job until a crisis hits".