When the metal is cold, the molten solder freezes up as it touches it, making electrical contact but not really sticking. So sometime later, as a result of thermal expansion or mechanical flexing, the solder joint becomes unstuck. This is called a "cold joint".
It's also essential to use flux when soldering. Most solders used in electronic hand-soldering have a rosin flux core in the middle. The rosin melts first onto the metal you're heating, preventing the heat from forming an oxide layer so the solder can bond to the metal. (I think the flux also helps break down any existing oxide layer, not too sure on that part.)
This teacher's technique would result in unreliable cold joints all up and down the pins.
Search for "cold solder joint" for more information and photos of cold joints.
Also, lead. Don't use a drinking glass.
I can't check it for myself now but I assume this would also work with lead-free solder. Not that you should put any kind of solder in your drinking glass.
Also, at school, our chemistry teacher heated a rod of glass and asked a boy (who was grabbing an end of the rod in pliers) to run across the room, creating a thin thread of glass.
I don't think they'd do that in schools today, but maybe I'm wrong.