Transient

What Does Transient Mean?

In computer programming, in Java specifically, transient is a keyword that is used to indicate that a variable should not be serialized. By default, all variables in an object can be serialized and therefore become persistent, but if a specific variable does not require persistence for any reason, the transient keyword can be used to mark that variable so that it is not serialized when the code is compiled.

Advertisements

Techopedia Explains Transient

The transient keyword prevents a variable from becoming persistent. The latter means that a variable is turned into a stream of bytes and then stored in a file. This process is called serialization and is the default behavior for all variables in an object. Serialization is mostly relevant for network programming because an object that needs to be transmitted over a network needs to be converted into a series of bytes so that it can be sent in pieces; because of this every class and interface must be serializable by default. But if there is no requirement for network transport, the transient keyword can be used to mark a variable for exclusion when serialization takes place. This may save some computing resources and a tiny bit of processing time.

Advertisements

Related Terms

Latest Computer Science Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…