When should someone be a coauthor instead of being in the acknowledgements?
Usually, the key indicator for co-authorship is the contribution of creative content. Did the student have own ideas that improved the paper? Was the program/database he wrote just a technical thing, or did it contribute scientifically? These are some questions that can help make/understand the decision.

There is a fine line to walk sometimes. Especially between different subject areas, there can be discrepancies who gets to be co-author. Sometimes everybody is counted, sometimes only the first author and his advisor(s) without any students.