The Chinese Ch'an Master Tsung-mi wrote about the sudden/gradual distinction, classifying the relation between the two in several ways including:
In the "mu" koan, someone might engage in the repitition of "muuuuu" until they become one with "mu." When they become completely one with "mu" and then they awaken out of that state, then there can be a sudden realization of the oneness that had been obscured by scattered thoughts.
We can see how this relates to the example of the Zen student who attains enlightenment when a pebble hits a bamboo. They have been purifying their consciousness so that there are no excess thoughts obscuring the awareness of immediate experience (some used the term "pure experience"). It's almost as though one is gliding down a pure, flowing river with nothing to interrupt the flow. As long is one is completely immersed in the pure flow of immediate consciousness, it's almost as though one is unconscious because one does not have the thought, "This is a flow," or "I see the flow."
But something clicks to make one notice that one is in the flow. Perhaps one looks up and the glint of rays from Sun makes one take notice, and one has the thought, "Wow, what am amazing flow of water," "What an amazing flow of vivid moments."
The rock hitting the bamboo can be likened to this moment.
If we emphasize this particular model of gradual build-up and sudden realization too much, then we become closer to the original poem by Shen-hsiu that was criticized by the 5th patriarch. If we focus on keeping the mirror clean, worring about the dust, then we can never really be fully immersed in the present moment. So, if one tries too hard to immerse oneself in the flow of immediate experience (first nen) as a sort of concrete goal, then one might actually be frustrated by all of the "distractions" that take away from this concentration.
One should see the purity of experience that is always there, always underfoot, in the here-and-now. By focusing on the here-and-now, one will naturally become immersed in the immediate moment (and also awaken out of it moment by moment.)