It was in my final year. I was a bit perplexed and was mostly witnessing while MBBS* interns and residents rushed to the site to take an ECG and perform CPR. Everyone worked spontaneously to perform resuscitation efforts, and it seemed like a very chaotic task, though people did perform the required roles.
Teamwork plays a very important role. When a patient codes, you can see everyone work synchronously at their capacity they can. The duty resident (or the senior doctor in the room at that time) commands, and everyone follows their instruction. As chaotic as it may look, everyone falls right into their roles - the residents perform ECG to diagnose the waveform and perform CPR, nurses prepare/load drugs, interns bring crash carts and assist overall. There has to be one commanding officer, at least 2-3 doctors/medical students to follow orders, and at least one staff nurse at the scene to load drugs as and when required.
In a hospital setting, I've usually not been alone in doing it, so I usually take turns with my colleagues. But when there are only a few people, I try to do my best because it is a matter of life and death. I usually try to keep my body in the same position and bring in more pressure from the abdomen/waist.
I lock in the same position - elbows extended, shoulders at the same 90° inward rotation and flexion.
I'll remove any accessories (stethoscope, pen, glasses, etc.) before doing it to minimize disturbances.
Since I'm musically trained, I find it easy to think of 'Stayin' Alive' by the Bee Gees or other such songs - it helps me mentally reduce the pressure and focus on the correct rate of compressions.
Always perform at the midline. Yes, the heart is to the left, but the midline compresses the right chambers and great vessels between the sternum and the thoracic vertebrae at that region
Always go in deep, try to go 5 cm (2 inches) deep, doesn't matter what the consequences are.
I'll have someone for backup when needed
Depending on the setting, it's probably going to be chaotic; the best thing to do is to ignore the chaos and focus on what you can do in that moment.
It doesn't matter if the ribs get fractured. In fact, that could help provide additional pressure on the heart, as I see it.
*MBBS = Bachelor of Medicine, Bachelor of Surgery, equivalent to an MD degree