CSC/ECE 517 Fall 2011/ch1 2b qu

From Expertiza_Wiki
Revision as of 16:04, 17 September 2011 by Uojha (talk | contribs) (→‎Introduction)
Jump to navigation Jump to search

Access Control in o-o Languages

O-o languages have different approaches to controlling access to variables and methods. Ruby, for example, doesn't allow an object to access the private features of another object, even if the other object is an instance of the same class. Java 1.0 had a "private protected" access specifier that allowed subclasses to access a variable, but not non-subclasses in the same package. It was dropped, probably because it was confusing. Have philosophies about allowing access become more restrictive over the years, as accessor methods have become more prominent?

Introduction

Access control is a feature that is available in many programming languages that allows the programmer to define a set of rules that govern how the elements in a program (for example methods or attributes in a class) can be used from different contexts. While some programming languages like C++, JAVA etc have predefined policies for access control (public/protected/private) allowing structured but limited power in the hands of the programmer, others such as Eiffel provide more flexible access control scheme (selective export). Here, we will look at access control policies of some programming languages and how these policies have changed over the years.

Why Access Control?

Access control in different o-o languages

C++

JAVA

Smalltalk

Eiffel

Ruby

What are accessor methods?

Accessor methods in different o-o languages

C++

JAVA

Smalltalk

Eiffel

Ruby

How has access control changed in the recent years?

Conclusion

References