4 ms·
It isn't often I see Java described as simple.
by sirsinsalot 4y ago
It isn't often I see Java described as simple.
- kaba0 4y agoIt has quite a few keywords, you have primitives and objects and you call methods on those. Compare it to C#, Swift or C++, and it is insanely tiny compared to those.
- zelphirkalt 4y agohttps://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html https://docs.oracle.com/javase/tutorial/java/nutsandbolts/_k... lists 50 keywords for Java. https://en.cppreference.com/w/cpp/keyword https://en.cppreference.com/w/cpp/keyword lists 97 keywords for C++. https://realpython.com/python-keywords/ https://realpython.com/python-keywords/ lists 35 keywords for Python 3.8. https://en.wikipedia.org/wiki/Smalltalk#Syntax https://en.wikipedia.org/wiki/Smalltalk#Syntax lists 6 keywords for Smalltalk. Neither one of them I would consider small or simple, but you are correct, that Java has much fewer than C++ and I would definitely agree, that it is the simpler language.
- sirsinsalot 4y agoSimpler syntax != simpler semantics. Also syntactic sugar can simplify language comprehension but adds tokens. Keywords is a poor metric for complexity in any sense other than choice of keywords. That IMHO doesn't make a language complex in any meaningful way engineering wise.
- xmcqdpt2 4y agoJava is a simple language even if people build gigantic piles of abstractions in it. It doesn't have multiple inheritance, it only has like eight base types, only a few well-worn ways to control flow (while, do while, for, if, switch, throw, return). It doesn't have operator overloading, or array access overloading. Attributes and methods are instantly discernible by the presence or lack of parentheses. It doesn't have templates or macros. I don't know many languages that are as simple as Java. If anything Java being so simple syntactically is a major reason why it's so wordy.