4 ms·
First, C++ has MI (which can be used as mixins, although they also give you enough power to shoot yourself in the foot if you so choose) and namespaces. Namespa
by strlen 17y ago
First, C++ has MI (which can be used as mixins, although they also give you enough power to shoot yourself in the foot if you so choose) and namespaces. Namespaces and mixins are vital for building large scale software projects. C++ also allows generic programming (via templates).
Java has interfaces and namespaces. Both C++ and Java have static typing, which is a tool for building certain kinds of large scale software projects (dynamic typing -- combined with an actual type system -- as in Python, Ruby or Lisp -- is another tool).
Lastly, Java (as well as PHP) are garbage collector. C and C++ don't -- yet many large scale software projects were created without a garbagage collector. Does this mean that you don't gain a lot of power from a garbage collector?
C++ and Java are not examples of powerful programming languages either. You don't use them because they're the most powerful and elegant programming languages. Typically, they're used out of HR considerations ("it's easy to hire Java programmers"), performance requirements (C++ is fast; properly tuned JVM can be at most 10% behind C for applications which don't require a large heap) or libraries (although availability of other languages on the JVM overrules that argument as well in many cases).
Hate to be blunt, but you're speaking as a Blub Programmer. Sure, you can get things done in PHP (or in Java, or in C++) but there are languages out there with a greater amount of power that you willingly neglect. That's sad.
- catch23 17y agoTechnically speaking, Java can have mixins as well if you include libraries that provide it. Stuff like Spring AOP uses aspectj under the covers and you can mimic mixin-like functionality in your classes with a few annotations here and there.
- strlen 17y agoTechnically, you could also provide mixins through the decorator pattern and interfaces. IntelliJ (and I am sure Eclipse) can generate this for me. However, that's less elegant and more fragile than using a language (e.g. Scala) which has Mixins as a language feature: IntelliJ can write code for me, but it can't read for me, nor can it explain it to other developers. Likewise, I can use multiple inheritance in C++ exclusively only to mimic interfaces (as purely virtual classes) or Mixins (and in fact a lot of corporate style guidelines, e.g. Google's explicitly say that), but it isn't quite the same as having these as language features.
- wvenable 17y ago> C++ and Java are not examples of powerful programming languages either. I never claimed they were, in fact I purposely lumped PHP in with them. I'm not ignoring other languages, but the these criticisms against PHP are entirely wrong. There are languages with a greater amount of cleverness, I agree. And yes, I probably would rather be programming in Python at this point. But PHP isn't bad because it lacks closures or mixins.
- dasil003 17y agoPHP is a blunt force language. You can get stuff done in it. It's success is based on low barrier to entry and easy deployment. The problem with PHP is not one thing that it lacks. It's the complete lack of design in the language. Everything is tacked on, and the sum result is quite ugly. Certainly it's a usable tool, and you can build large scale systems with it, but there is no language that's as much of a mess except for Perl, and Perl at least is incredibly powerful.