There are few programs which teach us so much in so few lines of code.One of the best programs I like to code and see people code is computing the Fibonacci number.
F(n) = F(n-1) + F (n-2)
The Fibonacci program can be approached in 2 ways — recursive and iterative.
Let’s start with the recursive one.
public static int getFibRecursive(int n)
if(n==1) return 1;
if(n==2) return 2;
int fibonacci = getFibRecursive(n-1) + getFibRecursive(n-2);
Plain and simple right? Wait, hold your horses. Let’s start computing.
System.out.println("Fibonacci term 8th is : " + getFibRecursive(8)); System.out.println("Fibonacci term 18th…
In Life you are dependent on a lot of external parties and so are you in software. Just like real world, an external system may not always fulfill the requirements of our system and hence “Retries”. Let’s try to capture some principles of Retries via a boy and girl story :)
Scenario — A boy has finally gathered enough courage and is proposing to his ladylove.
Boy proposes, girl says → “I am married!”
Retry Strategy → Don’t!
Solving problems through software