The authors present model calculations of total energies and formation enthalpies for epitaxial Ga0.5In0.5P ordered alloys. (100)-(111)-oriented monolayer superlattices and (110) bilayer superlattices are considered. For each of these systems they analyse the stability of (i) an infinite epilayer, (ii) an epilayer of finite thickness and (iii) chemically ordered (001) surfaces. They demonstrate that dimensionality of a system, progressively reduced from 3D to 2D, has a decisive influence on its stability. In particular, an infinite (111) monolayer superlattice is unstable against segregation into end compounds, but a sufficiently thin epilayer of this phase becomes stable. The stabilization is due to atomic relaxation at the epilayer surface, and at the interface between the substrate and the epilayer. Next, they consider stability against 2D segregation, at the surface of chemically ordered (001) surfaces of Ga0.5In0.5P. Surface stability is found to depend on atomic configuration at the surface, but to be independent of the 3D global stability of a given phase. In consequence, an unstable phase may have a stable surface, and vice versa, a stable phase may be terminated by a surface with a vanishing surface formation enthalpy. Finally, the growth of ordered Ga0.5In0.5P is followed layer by layer, beginning with the first layer of alloy deposited on (001) GaAs substrate. The growth of (110) bilayer superlattice is the most favourable energetically. The growth of only two out of four possible orientations of (111) monolayer superlattice is stable against segregation, being, however, unstable against formation of an antiphase boundary plane. The obtained results compare reasonably with the actual morphology of ordered Ga0.5In0.5P. This supports the hypothesis that the recently observed unintentional growth of ordered alloys results from the 2D ordering at the surface during epitaxy.