READ-ONLY OBJECT IN OBJECT-ORIENTED PROGRAMMING - Zhou, Hong (European Scientific Journal, ESJ, 2014)
Object-oriented programming (OOP) has become the dominant programming paradigm by its promise of easy code maintenance, code reuse, and code evolution. The central dogma in OOP is to model a concept as an object that has its own internal state and behavior. How to limit the access to the internal state of an object is always a tricky question to new OOP programmers. Though OOP languages have various ways of limiting the access to an object’s internal state, a call for read-only objects emerges as the protection of data authenticity in information flow becomes more and more critical. Since the existing approaches to achieve read-only concept in programming languages cannot dynamically create read-only objects, this article presents the definition of the keyword “readonly” and demonstrates how to use it to dynamically generate read-only objects via two case studies.