Category Archives: Software Engineering

Understanding Recursion

Did you ever get confused how the stack is maintained while recursion. Try executing this code and you will understand


public class test {

public static void main(String s[])
{
try{
recursive();
}
finally{
System.out.println("FINALLY");
}
}

public static void recursive()
{
try{
System.out.println("add call to stack");
recursive();
System.out.println("remove call from stack");
}
finally{
System.out.println("from finally call recursion again");
recursive();
System.out.println("call from finally is over");
}
}
}

Thought of the day!

A Typical software development lifecycle has following phases- ordered by timeline

Requirement gathering
Design
Build
Demo
Testing
Fix issues
Deploy
Document
Maintenance

The golden rule is- The more time you spend at the top, the less you have to spend towards bottom.

So obvious, but we ignore it often.