My guess ....
Sounds like the barcode is the PNR (Passenger Name Record*) number and seat assignment. In this case, the PNR # and seat assignments on the 2nd & 3rd legs were the same, so the boarding passes could be used out of sequence. Here would be the logic:
1) prior to boarding, the gate reader was intitalized as working flight "123"
2) passenger Mr Terenz presents his boarding pass while boarding
3) the gate reader scans the barcode as PNR #ABC789 and seat #1A
4) gate reader transmits this to the reservations computer
5) res computer pulls record #ABC789
6) res computer sees this record has a confirmed reservation for flt 123 today
7) res computer sees the segment on flt 123 is "checked in", seat 1A
8) res computer info matches that received from gate reader
9) res computer sends back "ok" and name of "terenz" to the gate reader
10)gate reader "beeps" after getting the "ok" & displays the name sent to it
11)gate agent hears "ok" beep, so double checks the name
12)gate agent sees name "terenz" on gate reader and boarding pass
13)gate agent says "Welcome Mr terenz" (or grunts; based on mood)
Out of sequence is irrelevant cuz both barcodes say "PNR #ABC123, seat 1A"
Did I mention I used to be a Gate Agent (for AA .. ughh)
They can't double check the name for all 150+ passengers boarding within the 30 minutes boarding time (assuming boarding started on time) and do their 100 thousand other duties and get the flight out on time. Some name mis-matches will slip thru and board the wrong plane. That's why it's the Flight Attendants job to announce a couple of times during boarding that this is "flight 123 to Timbuktu". The passenger who flies a flight to the wrong destination shares 50/50 of the blame with the hurried Gate Agent.
Did I mention I'm now a Computer Programmer (not AA, tho I started programming there).
My alledged scenario could very well be true. The passenger name could also be encoded on the barcode so that all verification lies within the reservation computer. But how many parameters due you want to pass on that bar code?? Keep in mind that every scan from the gate reader computer has to transmit all barcode parameters to the main (reservations) computer. Sometimes (as in gates shared between multiple airlines) that transmission is done via a radio link. You need to keep the amount of data transmitted back and forth to a minimum; this isn't a batch job being run in the middle of the night when the computers aren't busy with more important jobs; this is 150+ passengers standing in line and we must have all of them processed in 30 minutes. Keep data transfers to a minimum.
Steve
* PNR - commonly called a "confirmation number" but it doesn't confirm anything, it's just a record locator in the computer to pull a given reservation, ticketed or not. It will contain the currently booked flights w/details (seats, FF # etc) as well as a history of all flights previously booked/cancelled under this reservation.