- Use a static analysis tool that kicks out a dependency diagram. That literally shows the dependency order.
- Look for import/include/using statements. That shows the dependency order.
- Look for inherits/implements part of class definitions. That shows the dependency order.
- Look at the build commands. It'll tell you the dependency order.
- When you see a function, constructor, whatever being used, you have a dependency.
And if the code is yours, and you don't know the dependency order, then fix that. Write it down or something.