There's a lot of folklore in the Debian community about how apt works.
Unfortunately, a lot of it is also just plain wrong. For instance, I
often hear people confidently say things like
aptitude is a
frontend to apt-get (it isn't).
These misconceptions are understandable -- all the programs that use apt perform the same tasks, many of them imitate each other's interfaces, and they all share common code. It's easy to assume that they must all be invoking apt-get under the hood. In the interest of clearing up some of this confusion, I've created some simple diagrams of what uses what in the apt system. apt is large and complicated, so these diagrams can't be complete, but I hope they at least clear up the basic relationships between the different pieces of software.
This diagram shows how apt, dpkg, and some popular frontends are related to one another (also available as a pdf).
In order to keep things simple, the above diagram is limited to a very cursory description of how the system components are bound together. The other diagram I've built shows a few more technical details about the structure of libraries, programs that invoke one another, etc (also available as a pdf).
In order to make these diagrams manageable, I had to throw out a great deal of information. If you have a question that these don't answer and if I have time, I'd be happy to take a stab at diagramming some other aspects of apt.
[EDIT]: I've updated the diagram in response to a request to indicate where packagekit will reside, when and if it is completed. My understanding is that they are basically writing yet another apt frontend, but there's an intermediate library that translates to some least-common-denominator API so the frontend can be identical on all package systems.