What's the structure behind Apple version numbers / build numbers? macOS Sierra 10.12.3 is 16D32, but the SDK is 16C58 according to my Xcode.

iOS 10.3 beta is 14E5239e.

Xcode 8.2 is 8C38.

You know how they look, and they are shared among all Apple software.

But how are they made up? What's the logic behind? I can barely guess that "sometimes", the first number is the "major" version, eg. for Xcode, but that's not always true, eg. for iOS.

And what's the middle letter about?

The last number surely is a sequential build number, with minor revisions having a lowercase letter appended (take iOS 10.3 beta).

Do they all start at 1A1 internally, then move on build after build?

What is the greater scheme at play here?
Paul Suh (formerly a consulting engineer and training developer at Apple, wrote the following (published on Joe Moreno's blog):


  For instance, Mac OS X 10.4.10 Intel is build 8R2232. Mac OS X Server
  10.4.11 Universal is 8S2169. These numbers have the following rough meanings:
  
  8 - This is the major version number of the software package. 10.5 =
  9, 10.4 = 8, ... 10.0 = 4. Prior to that was NextStep 3.3, from which
  we get the 3 series.
  
  R - This is the minor version number. It is always incremented for
  system updates (i.e. 10.4.10 to 10.4.11 is always a letter jump), but
  may be incremented as well for hardware-specific builds. R is the 18th
  letter, but only the 10th update to Tiger. The other 8 letter bumps
  were for hardware support for new releases. Security updates generally
  don't merit a letter bump.
  
  2232 - This is the sequential build number within the minor version.
  If it is a four-digit number, the first digit indicates a specific
  platform. In this case, 2 indicates that it is for Intel. A
  three-digit or shorter number indicates a unified build for all
  architectures. The remaining digits are the sequential build number.
  In this case, the R train had 232 builds before release, the first one
  being build 8R2001. Although the builds are roughly daily, you can't
  really go by that number. In the early stages builds may only happen
  once every two or three days; towards the end they may occur two or
  three times a day. The build trains of successive releases may overlap
  to a certain extent, based on what Apple Engineering sees as the
  priority vs. risk of various changes to the code. The earliest builds
  of 10.4.11 almost certainly overlapped with the last builds of
  10.4.10. The builds of Leopard definitely overlapped with builds of Tiger updates, going back to almost all the way to the day after Tiger
  was released.
  
  Note that different software packages have totally different build
  numbers, so you can't compare the build numbers to each other in a
  meaningful way. The exception is that Mac OS X and Mac OS X Server
  share the same build numbers.