From the question Why does Java have transient fields?. I am able to understand the transient. But, not able to evaluate to using transient keyword at the time of designing.
public class A implements Serializable
{
public String s;
public transient ts;
}
If i do the same thing in alternative way..
public class A implements Serializable
{
public String s;
//public transient ts;//removing this variable.
}
And use another class and define method inside the class and define the variable ts
and do the operation and persist the value of s as business defines.
QUESTION
I didn't find any real time example in the web where i will take decision to define a variable transient
.
How could i take the decision to define transient at the time of designing? Is there any realtime scenario that helps me to understand?