Accessor: meaning, definitions and examples

🔑
Add to dictionary

accessor

 

[ ˈæksɛsər ]

Noun
Context #1 | Noun

programming, technology

An accessor is a method or function that retrieves the value of an object's property without modifying it. Accessors are commonly used in object-oriented programming to encapsulate data while providing a way to access that data safely. They help maintain the integrity of the object by controlling how properties are accessed.

Synonyms

access method, getter, retriever

Examples of usage

  • The getter method serves as an accessor for the private variable.
  • Using accessors can improve code readability and maintainability.
  • Each property of the class has its own accessor method.

Translations

Translations of the word "accessor" in other languages:

🇵🇹 acessório

🇮🇳 एक्सेसर

🇩🇪 Zugriffsmodul

🇮🇩 aksesori

🇺🇦 доступник

🇵🇱 akcesorium

🇯🇵 アクセサリー

🇫🇷 accessoire

🇪🇸 accesorio

🇹🇷 aksesuar

🇰🇷 액세서리

🇸🇦 ملحق

🇨🇿 příslušenství

🇸🇰 príslušenstvo

🇨🇳 配件

🇸🇮 pripomoček

🇮🇸 auka

🇰🇿 аксессуар

🇬🇪 аксესუარი

🇦🇿 aksessuar

🇲🇽 accesorio

Word origin

The term 'accessor' originates from the word 'access,' which comes from the Latin 'accessus,' meaning 'a coming to' or 'approach.' The root 'ac-' means toward, and 'cedere' means to go. In a programming context, the term began to be used in the late 20th century as object-oriented programming gained popularity. Accessor methods were introduced as part of encapsulation principles, allowing developers to control how properties of an object can be accessed and modified. Over time, the use of accessors became a common practice in software development, promoting better design patterns and enhancing code maintainability.