Codementor Events

How I learned Java- Recursive coding

Published Jul 16, 2018

About me

I am a program manager at Johns Hopkins manage a private healthcare exchange and multiple IT products within Johns Hopkins healthcare IT portfolio

Why I wanted to learn Java- Recursive coding

I wanted to learn how to write recursive algorithms to be able to decrease the amount of actual code that was required to be able to run a sorting algorithm within Java. I understood the basics of Java from courses I had taken, but I wanted to learn more advanced ways to design programs

How I approached learning Java- Recursive coding

I researched the concept of recursion. I reviewed multiple examples. And then I wrote some very simple recursive algorithms (ex. factorials) and then I built myself a modified binary search algorithm, an algorithm that searches through variables and provides the index of the element when it's found.

Challenges I faced

There was a lot of syntax that was difficult to understand at first for designing the program, and the concept of recursion requires you to be able to envision the program running without being able to necessary see the lines of code being executed since it's somewhat abstracted through the use of recursion

Key takeaways

To not get discouraged when a concept does not become immediately evident. It is always advantageous when feeling a bit confused, to take a 5-10 minute break and decompress. It is amazing how much the brain processes even while we are not actively engaged in learning a concept. I greatly enjoyed the puzzle solving aspect of being able to get the program to work properly and being able to understand the bits and bytes of the programs logic.

Tips and advice

I would highly recommend that if someone wishes to learn recursive method calls in Java to begin very simply, with perhaps a program that does factorials or some very basic functions, to be able to start to conceptualize what the program is doing when using recursive methods. For some people it might come completely naturally, which is great, but as I had said prior, it's always good to take a few minutes to breath when a solution isn't readily available.

Final thoughts and next steps

I think that the strategy of learning concepts of programming languages can be greatly improved in order to make the languages more readily accessible to less advanced programmers. I wish to learn how to be able to build Red/Black binary search trees in order to be able to further my understanding of advanced Java concepts.

Discover and read more posts from Patrick Minot
get started