It seems that there are many people who say that Java is old and not cool from the viewpoint of the "Imadoki" language. On the other hand, my claim [^ 1] from Hirao that "No, Java is aiming for a great moderation in the first place, so this is fine" is "C ++ design. And evolution ”is the basis for loose poetry.
[^ 1]: I just think so
It goes without saying that Java is influenced by C ++. And, of course, Java has some choices from C ++ and some not. By reading "Design and Evolution of C ++", which tells in his own words how Stroustrup made C ++, I think it will be possible to see how Java chose the current path. think. Aside from that, "Design and Evolution of C ++" should be read by any programmer who loves programming languages after overcoming the barrier of consciousness that "any language can move" regardless of whether C ++ can be done. I think it's a good book.
The problem is that new products are no longer available. In writing this article, I borrowed it from the library for the first time in a while and read it ...
So, unless otherwise noted, the following quotes are from "C ++ Design and Evolution".
As you all know, Java has classes, abstract classes, and interfaces, but I'm sure some of you may be worried about how to use each, especially abstract class and interface.
Function definitions are usually specified "outside" (outside the class declaration). That's to make the class declaration (...) purely like an interface specification.
In Java, this is class and interface, isn't it? It can be said that the interface was prepared just "to make it look like an interface specification".
Did not correctly explain to C ++ users that they use derived classes to separate the interface from the implementation. I made an effort to explain it, but it seems that the purpose was not properly communicated. Perhaps the main reason for this failure is that many (most?) C ++ programmers and other programmers interested in C ++ express themselves in class declarations that specify interfaces-one of the implementations of objects. I never dreamed that I could write a club, which is equal to what I had to do. If can is misunderstood as have to and the "always" expression (implementation) is written in the class declaration, the benefits of the derived class I tried to explain disappear. Naturally.
Yes, you can also write the implementation inside the interface, this is an abstract class.
I'm not sure if the Java class system was actually designed in line with the idea of Strawstrap, but if so, it would be better to design with interface and implement with class, abstract class. I think it is possible to think that there was no particular need. However, Java seems to have chosen to have as an abstract class the part that C ++ had as a result, "the expression-a part of the implementation of the object-can be written in the class declaration that specifies the interface". Seems to be. I think I had the option of not having an abstract class, but Java dared to do that.
There are several reasons why we didn't make a big difference from C. Integrating C's suitability for systems programming with Simula's ability to organize programs was a major challenge. If we added important features of other languages one after another, it would become a "shopping list" language, resulting in an unfocused language.
If we had ignored C and Simula's implemented technologies from the beginning, C with Classes and C ++ would have taken longer to mature.
I think these are probably language implementation stories, but even when it comes to language specifications, it would have been of great significance for the spread to not change what is already there.
The C syntax I hate the most is the declaration syntax. Many people are confused because there are both prefix and suffix operators for declaration.
The negative reaction from users to this part of the change was very strong.
Even in Java, for example, array declarations
String[] values = null;
Although this notation is recommended
String values[] = null;
It's okay to add []
to the variable
What if
//Even without spaces
String[]values = null;
//Even if it sticks to the beginning of a variable
String []values = null;
//Even if it's scary
String [] values = null;
//Even if you break a line
String values
[] = null;
All of these are also accepted. Again, I'm sure there was a choice to allow only the first notation, but Java didn't. Java also chose not to make syntax changes that Stroustrup couldn't do in C ++.
Besides, why is there a primitive type and it is not pure as OOPL? I'm sure there are a lot of things that make me want to say that, but I'm sure Java knows everything and chooses it. To stay blunt and moderate, forever and ever.
I love Java like that.
Recommended Posts