4 ms·
I tend to agree with the comments about intentionally controversial headlines, but the article itself was excellent. If you haven't actually read it, please tak
by DanielStraight 17y ago
I tend to agree with the comments about intentionally controversial headlines, but the article itself was excellent. If you haven't actually read it, please take the time to do so.
I think in the end, the author really nailed it. The important question is, "Is Java dead for me?" I would not use Java for a new personal project (and probably not for a work project either unless the libraries were needed). I do not have a clear replacement in mind... Python stands out the most.
My biggest problems with Java are the compilation step (admittedly not that big a deal with an IDE, but I don't always like to use an IDE), the insistence on objects, and most importantly, the lack of first class functions.
A new issue that has come up for me in comparison to Python is constructor overloading. In Python, constructor overloading is beautiful because of args and kwargs. In any C-family language (including Java here), it's horrible. With small objects where inheritance works well, the constructors in other languages can get unwieldy fast. In Python, they're always concise. I also love keyword arguments in general. It can make code much more readable, especially when using something like wxPython, where the parameter lists are long and otherwise would be quite vague.
- axod 17y agoThat's not being 'dead' though. That's just choosing the right tool for the job at hand. It's like proclaiming conventional spanners dead now that you can get adjustable spanners. Some jobs you want solid object based exception handling water tight programming, and other jobs you want loose runtime based functional stuff.
- plinkplonk 17y ago"The important question is, "Is Java dead for me?" " Great Point, "Is Java dead for me?" (and why or why not) would be an interesting question to ask HN regulars, vs the stupidity of trying to decide whether Java is "dead" or "alive" in general. The former leads a personal statement of intent, and consequently there is no real argument about any answer. The latter is undecideable and leads to plenty of unproductive argument. As for me, I just transferred the leadership of an Open Source Java library I maintain to someone else, primarily because I am sick of writing and maintaining Java. That said, it is just a personal decision and I can imagine many scenarios where Java (not just the JVM) use would be appropriate. I just hope I am never part of those situations again! :-) Personally, when I need to build something on the JVM I'll use Scala or Clojure. Else, I'll use Haskell, Python or C as appropriate. Touch Wood.
- prewett 17y agoI've been wondering about this: for personal projects, Python is compelling. But when you start working with multiple developers, the lack of compile time type checking seems like it would lead to a lot of subtle runtime errors. How do multi-person Python projects deal with this?
- steveklabnik 17y agoI'm a Rubyist, not a Pythonista, but the same principles apply. I love really really strongly/statically typed languages (Haskell) and really really weakly/dynamically typed languages (Ruby). Generally, it's not a problem. I have a hard time articlating why, exactly... I guess my code just tends to be short, sweet, and to the point. It's very rare that when I code in C, for example, that I try to do something that the type system wouldn't allow anyway. That's a terrible answer, my apologies. Maybe this would be better: could you provide an example of a situation where you feel that dynamic code would cause a problem? Mabye a bit of back and forth will help me figure out what I'm trying to say.
- prewett 17y agoIs it only you writing the code? If it's just me, generally the names of my variables imply the type ("price" is probably a float, for example). But say you're joining a project with 100 Python classes. How do you write the code so that someone else will know that the arg named "network" is a ip address string and not a network socket or a class, presumably named "Network"?
- steveklabnik 17y agoFunny, my "price" would probably be an integer ;). Maybe it comes down to documentation. If I were to use some sort of function where I wasn't sure what the argument was, I'd look in the docs to see first.
- dasil003 17y agoThis tends not to be a significant problem--if you pass the wrong type you find out the first time you run the code, which is probably not any later than you would have compiled it. A much more common problem are null references, but Java doesn't do anything about those either. Java is great for the enterprise because it's stable, mature, and doesn't leave any room for cleverness to fly over people's heads. However the compile-time checks don't do much to prevent difficult-to-debug errors. A more powerful type system like Haskell is much more interesting in this regard.