trait
Pluraltraits
- 1An identifying characteristic, habit, or tendency that distinguishes a person, animal, or thing.
Curiosity is a trait shared by most successful scientists.
Researchers studied which personality traits predict career success.
Similarcharacteristic
Note
A word that began as a line drawn: Middle French trait meant "line, feature," from Latin tractus, "drawing," and tract is its doublet. In biology and psychology it names one feature among several. The pairing inherited and acquired traits sorts them by origin, and personality trait is the everyday compound. Emerson titled a book English Traits in 1856, using the word for what marks a whole people.
- 2In object-oriented programming, a set of methods that cannot itself be instantiated and that adds behavior to a class through that class's own interface.
The developer defined a trait so several classes could share the same validation logic.
Rust programmers rely on traits to specify behavior that types must implement.
Note
Programmers place it somewhere between an interface and a mixin. Like an interface, it is never instantiated on its own, but it carries working methods. Those methods lean on others the class must supply, which is why Nathaniel J. Nystrom warned in 2006 that composing many mutually dependent traits could lead to "parameter explosion." A class is said to use a trait rather than inherit from it.
Practice
Can you tell the meanings of trait apart? Answer 4 quick questions from this page, or write your own sentence and AI will check it.
Origin
This word was borrowed from Middle French trait ("line, feature"), which came from Latin tractus ("drawing, pulling"), from the verb trahō. It is a doublet of tract.