Sometimes it is difficult to understand the code written by some one else.Are there any tools that visualize the flow of code in visualforce and apex?
As far as I know there is no tool which can tell about code flow of Apex and visual force page. These feature are dependent to an dedicated IDE build for particular language. Force.com IDE is basically a plugin runs on eclipse and require too much development. That plugin is even not able to provide code suggestion properly, so that functionality is impossible for now. You have to manually do this by debug logs, adding
System.debug(''); or code reading. And Force.com IDE is the only big tool available right now and this has no functionality like this. You can work offline through this its enough.
While not a visualization per say, the logs in the Developer Console and some System.debug statements placed throughout the code can be helpful for this. And if you hit a point where the log is truncated because the maximum size has been reached, you can add in some code to spit out debug type statements into a text field in a record in Salesforce (sandbox only!) to help see what's going on.
The next release (Winter '14) is going to provide a tool for tracking order of execution across triggers and workflows etc. to make complicated scenarios easier to debug.
As for Apex and Visualforce, I don't believe there are any tools around. You should familiarise yourself with the standard order of execution, and then just study the code and try to follow the flow yourself for various data values etc.. As Jessie suggests, debug logs are your friend if you can't follow the source through reading it.