Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Developers don't complain about protections until they prevent the developer from getting to something they want to use. For developers that are creating child classes, protected is no big deal because they'll have access to the goods from within their child classes.</p> <p>For developers that are <em>using</em> a given class (not extending it), protected blocks access to potentially juicy internal implementation details. This is what they will gripe about.</p> <p>It can be said that some framework designers err too much on the side of privacy - deny access to everything and only allow access to specific documented, supported features. This can be frustrating when you know there's good stuff on the inside that you could use to solve your immediate problem, but consider the flip side: if your framework were instead designed by someone who gave free access to everything, all the internal details of the implementation, you will very likely encounter one of two things when the framework is updated at some point in the future: </p> <ol> <li>The updated framework changes implementation details that your code is dependent upon, and your code breaks</li> <li>The designers realize they can't change the implementation without breaking lots of code, so they opt to not implement useful features or bug fixes. This is called code paralysis.</li> </ol> <p>Even though it's frustrating to see things you can't access, it's better for code longevity and lower revision costs to operate in a restrictive (deny all, permit by exception) mode than in a permissive mode. </p> <p>I have worked on (nay, written) frameworks in which developers using the framework complained about it not being permissive enough with internal details. These folks complained even as bugs were fixed, features were added and the implementation was rewritten across various platform migrations, but the public, supported interface, the contract of the code remained stable and their code remained largely unaffected.</p> <p>So, in a nutshell, developers will complain about protected (and private) access modifiers simply because it gets in the way of what the developer feels would be the simplest and fastest way to implement a solution, ignoring the future cost of relying on such implementation details. </p> <p>Encapsulation is a good thing, even when it blocks the shortest path to solution. ;></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload