Access Control: language and Platform

Source: Internet
Author: User

Program logical organization (such as namespaces and packages) different from the distribution method during deployment (such as assembly and jar package), should the mutual access permissions of different classes be restricted in logical organization or physical distribution?

JAVA

language

the logical organization mode is restricted, that is, you can access Java. the private classes in Lang can be compiled, as long as your Code is also in Java. lang is the package name [I guess, I have never tried]

runtime

the physical distribution method is restricted, which may be related to the default classloader, even if you have compiled, but the classes under the same package are divided into different jar packages during deployment, access to private classes may fail [I guess, not tried]

. Net

CLS

I don't know. I want to add it

C #

restrict the physical distribution method, that is, the assembly, from language to runtime

I personally prefer C # permission control, which is reasonable and flexible. in Java, when the logic is different from the physical organization, it is not forced to move a class to the current package, that is, it is declared as public, once declared as public, you can no longer control it.

Traditional access control is beyond the scope of the language and is a platform feature.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.