There are many different ways to design an adventure or a dungeon. None of them are wrong as long as they result in fun experiences for players. However, using a different method can yield fresh and new experiences for players. For this reason I hope to try and explain the idea of thinking of these things as problems presented to the player. Some of this is similar to one of my earlier pieces about the world, but this is more aimed at designing and analyzing situations.
What I Mean
When looking at what the players will do, it's easy and even natural at times to think about their actions and include them in your design. This, however, can lead to railroading at times, though a good adventure designer will notice it and correct it. The alternative is to not even consider what the players will do but instead create the situation. As a result, the goal is internal consistency and an interesting situation. I go after this goal by thinking of the adventure as a problem we are posing for the players.
- The first step is to think of a problem for the players. “Get item X from the cave.” “Kill this person.” “Win the trust of X.”
- Who is preventing the players progress?
- Why are they doing so?
- Life would be far less eventful if everything was as easy as walking up to the problem and fixing it. There will probably be some complications, restrictions or opportunities for the players. “Half of the occupants walk away on day 5 because the bad guy refused to pay their wages.” “Guards change every 8 hours and it's easier to sneak/ambush when the guards are tired close to the end of their shift.” “Reinforcements are coming in 2 weeks.” “The ritual will begin as soon as everything is in order (in 1d4 days).”
As players interact with the situation, they will add their own compilations, restrictions or opportunities. Having a couple there help give a starting point for more elaborate plans (it's also possible you'll think of a few things that the players won't, leading to more fun as they try to find weak points in the situation they can exploit). Eventually, they will succeed or fail and as a result end up in a new situation (bad guy is chasing after them, they need to get the artifact from the bad guy's keep instead of the less well defended country side, etc.).
The key in this approach is that the situation is designed and understood by the Dungeon Master but the Dungeon Master did not assume player actions. As a result, the situation will change based on the players actions as they try to go after their goals and hopefully not railroad the players.
It's Not Perfect
You can still end up railroading players to some extent just by the nature of the situation and other factors (the cave system you designed has one entrance and one path through it). When everything is done, look at the situation and think about different approaches that players can try to use to accomplish their goals. You don't want to be exhaustive and you don't want to let the options influence your design. However, if you have serious trouble thinking of 3 or 4 general ideas quickly, the situation may be too restrictive (for my players, it probably is).
As a Diagnostic Tool
Even if you already designed a dungeon with particular important events for the characters, thinking about internal consistency is still important. By looking at the dungeon through the lens of the baddies and their plans you can at the very least verify the dungeon's consistency and at most make changes that make the dungeon more coherent and engaging. Most of the Dungeon Masters I know already do this. However, it's important to verify that the situation makes sense without the players there.