Terminology. Struggle with complexity

imageTerminology is the most important thing in any business. Without agreeing on terms it is impossible to succeed. What is the problem with programming? In particular in Java? Not very good, if not bad.

There seems to be no clear agreement even on basic terms. For example, if I say “inner class,” what will you think? I bet there will be more than one version of what is meant. And this is very bad because creates difficulties in communication and not only.

How such a situation is usually corrected - GOSTs are issued. These GOSTs have the term "Terms and definitions." For example - GOST R 7.0.8.-2013 "Paperwork and archiving - Terms and definitions."

But GOSTs are boring. Therefore, I will give my contribution to the elimination of chaos below, at least in terms of terminology regarding Java classes.

So, in Java there are classes:

  • “Radiant class” - all classes are “radiant”. If you say, “I wrote a radiant class,” this will mean that this is some class of the following, that's all. All of the following classes are “radiant”!

    • A soaring class is a class that begins immediately after the “package” and “import” sections of the source .java file.
    • “Sneaking class” - sneaking classes 'live' (defined) only inside the soaring classes. This is a general concept for the following types of classes.

      • The sizzling class is a static class declared directly inside the soaring
      • A piercing class is NOT a static class declared directly inside a soaring class.
      • A shadowy class is an anonymous class.
      • A yawing class is a local class. It is declared in blocks of code (in class methods), however, like “shadow-like”

Refinement just in case: in this scheme, “Radiant” is a generalization for all kinds of classes in general, and “Crouching” is a generalization for all those “Radiant” classes that are not “Floating”.

More details


Soaring

  • the main type of classes - located directly at the "upper level" of the source .java files

Sizzling

Example:

//А - парящий классpublicclassA{
      //B - испепеляющий классpublicstaticclassB{
      }
}

  • essentially no different from a soaring class, except for the place of its announcement
  • does not have access to non-static elements of its parent floating class

Piercing

Example:

//А - парящий классpublicclassA{
      //B - пронзающий классpublicclassB{
      }
}

  • has access to all elements of the parent, floating class
  • cannot have static ads
  • without being declared as public it can only be instantiated inside its parent floating class

Shadowy

Example:

new Thread(new Runnable() {
        publicvoidrun(){
            ...
        }
    }).start();
//то что внутри Thread(...) - это тенеподобный класс

  • located inside code blocks (in methods). All other classes are first written with a name and then this name is somehow used. The same class is written without a name and is immediately used with the new operator, i.e. instantly instantiated
  • has access to the elements of the framing class
  • has access to local elements of the framing code block (for example, method variables)
  • cannot define static elements inside itself except static final

Yawing

Example:

//А - парящий классpublicclassA{
        publicvoidmethod1(){
            //B - рыскающий классclassB{
                ...
                }
        }
}

  • located inside code blocks (in methods)
  • has access to the elements of the framing class
  • has access to local elements of the framing code block (for example, method variables)
  • visible only within the block where defined
  • cannot be declared as private, public, protected or static
  • cannot define static elements inside itself except static final

Conclusion


I gave this terminology the name [ydax] - a random but unique name within me, generated by a special script.

And now let’s rejoice, brothers and sisters - the Hoas has become less with this world! Use this terminology, and if someone does not understand something, throw a link to this article. Good buy)

PS This article can be mistaken for banter, but it’s not so - in every joke there’s only a fraction of a joke)
PPS if you brought in the wrong information, correct me

Also popular now: