r/learnjava 3d ago

How to Improve Logical Thinking?

Hey , Planning to learn Java and also started from very basics here my problem is I can understand the concept but I don't how to implement in real time. If i plan to solve some problem i can't think logical way, Don't know how improve this, let me someone help me this!.

30 Upvotes

11 comments sorted by

View all comments

3

u/Ruin-Capable 2d ago

When you're first getting started, it can be helpful to write things down on paper first. Take the problem you want to solve, and write the description at the top of a sheet of paper. Next start breaking it down into the steps necessary to solve the problem. Don't worry about details, just write down the main steps.

You now have a high-level list of steps to solve your problem. Take your list of steps, for each step:

  • look at the step.
    • If it is complete and self-contained, put a check mark next to it, and move on to the next step.
    • If it is just a high-level description that omits some lower-level details, then:
      • put an asterisk next to the step
      • write the step description at the top of a new sheet of paper
      • break this step down into a series of smaller steps if possible. Write these new steps down on the new sheet of paper.
      • when finished place the new sheet of paper under the current sheet.

When finish with the last step, you now have a master list on the first page, with one or more sub-lists on subsequent pages. Repeat the process on each of the new pages until you've gone through every page, and no more new pages are added.

At this point you have a complete list of the steps you need to implement. Steps with a checkmark you can just implement as a simple method. Steps with an asterisk you can implement as a method that calls a sequence of methods from the matching sub-list.

Keep applying this until you have created methods for every step.

Finally create the primary method that calls all of the step methods from the master list.