Skip to main content
edited tags
Source Link

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad design decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits itstheir testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad design decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad design decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits their testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

added 7 characters in body
Source Link

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad design decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad design decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

edited body
Source Link

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more methodicalsystematic way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more methodical way using interfaces?

If we program to interfaces various parts of the implementation can be effectively hidden. We can define multiple interfaces for a single implementation and use them as needed, instead of 4 fixed levels (public, protected, package protected, private).

From this point of view Access modifiers seems redundant and limited. From my experience, they also tend to promote bad practices and bad decisions compared to interface-managed access. The private access modifier seems especially contra-productive on methods because it limits its testability.

Is there some case for access modifiers that can't be handled better in a more systematic way using interfaces?

Source Link
Loading