Most investors have no idea about the life cycle of a trade. This is because they rarely have occasion to work with the middle or back office. The middle and back office are support functions for the front, or sales, office. The back office works on trade settlement and the middle office is concerned with confirmations. All three contribute to the actual buying or selling of stock along the trade life cycle.
The back office exists for three reasons: clearance, settlements and accounting. These three function interact directly with external agencies like the custodian (actual holder of the security), the clearing firm (third party) and a commercial bank. The back office maintains external relationships and control functions and is where the trade ends.
The middle office, as the name implies, is a hybrid function between the front and back office. The middle office handles validations (of stock orders), bookings (orders) and confirmations. Technically, these are all back office operations, however, they often require the help of front office staff to resolve.
The front office is responsible for trade capture and execution. This is where the trade originates and the client relationship is maintained. The front office makes/takes orders and executions. Traders and sales staff are considered front office staff.