5 ms·
There are warts in the standard library to be sure, but many of them have already been filled in by third parties like Apache Commons, Google Guava, and Joda-ti
by jpitz 13y ago
There are warts in the standard library to be sure, but many of them have already been filled in by third parties like Apache Commons, Google Guava, and Joda-time. I'm sure there are others I'm not thinking of.
- latchkey 13y agoAgreed ...and jdk8 includes what was effectively joda-time (jsr-310) now. projectlombok.org also makes a lot of the language syntax ugliness quite bearable.
- kevinpet 13y agojdk8 completely breaks the entire value we get out of using joda-time, namely, that instants are unambiguous. It actually recommends using time and date without time zone.
- portmanteaufu 13y agoCould you elaborate on this? I thought that JSR-310 and Jodatime were supposed to be nearly identical. Why would they introduce such a regression?
- grimlck 13y agoIt doesnt recommends using time and date without time zone, it recommends using the right class for the right job. And sometimes the right class doesnt include a timezone Suppose you have a webpage asking users for their birth date. What data type do you store that value in? Hint: You aren't going to prompt the user for the time zone they were born in.
- brown9-2 13y agoIf you like lombok you might also like the Autovalue plugin from Google: https://docs.google.com/document/d/1THRUCIzIPRqFSHb67pHV8KMbo55HphSXqlQcIx9oUiI/edit https://docs.google.com/document/d/1THRUCIzIPRqFSHb67pHV8KMb...
- radiantsand 13y agoThe Lombok stuff is pretty nasty, all kinds of hacks to hook into the compiler internals in unnatural ways. If you want those features just use a language which provides them, rather than awkwardly bolting them onto a language that doesn't.
- bane 13y agoYeah, and I've already come across most of those. Integrating lots of that stuff into the standard libraries that Java ships with would be exactly what I'm thinking of...and jettisoning all the broken GUI frameworks and such. And cleaning up the disaster pile that is I/O. I mean, I think there's still stuff sitting around in javax.* from when I last touched Java 14 years ago. I thought that was supposed to be the experimental branch where things might change without warning? Let's clean that up. I know most IDEs just ship with all that stuff included, but I've found it makes packaging up things to give to somebody else a little more complicated than I'd like...which would be resolved in the standard libraries.
- spullara 13y agoIn javax, the x stands for extension not experimental.
- nicobn 13y agoI was going to reply with exactly the same thing, and I'd add slf4j.
- jrabone 13y agoBecause God knows, Java needs another logging framework. Seriously does ANYONE get any additional value out of the morass of crappy logging systems out there over and above System.out.println? Log4J is PARTICULARLY brain-damaged, with its refrain of "ooh, someone put a log4j.xml in their JAR (one of hundreds), that beats your log4j.properties.". Or SL4Js amazing performance of "1.6 doesn't work with Scala because of ambiguous varargs". Or who can forget the incredible log4j logfile appender with the global lock around the file I/O? Not to mention the interactions between SLF4J and org.whatever-it-is-this-week.Jetty's built-in crappy logging facade. Really, NEVER has so much effort been spent for SO LITTLE REWARD.
- brown9-2 13y agologback is pretty great. I can't take anyone seriously that defers all logging to System.out.println - do you really want the inability to change logging levels between live, test, etc?
- jrabone 13y agoHmm. I've used that feature about once in 20 years of coding professionally. My production systems don't generally log; they're busy serving (I once worked on a hard real-time embedded air traffic control system where production logging was literally a single bit of information - a logic level that went high when the processor was busy, and low on idle - so we could measure our timing safety margin with an oscilloscope) Test systems log at debug except for low level packages that insist on ridiculous logging (Hibernate, http client - and both of those have ANOTHER level of hacks to do wire-level logging in addition to the standard stuff). Logging is just so painful, and not just in Java. Debian switched to rsyslog some time ago and I am still seeing no benefit at all, yet have to learn yet another half-arsed buggy scripting language to achieve simple things like, oh, not having my DHCPD logs showing up in three different files. FFS people.
- bradleyjg 13y agoFiling in the holes is nice, but without actually making it a design choice java embodies TMTOWTDI more than perl ever did. For many common tasks there are 5 or 6 different standard library calls that seem to do the same thing, but 4 of them are to be avoided at all cost, but there's no depreciation tag and the official javadocs don't contain any pointers to the newer classes.
- cgh 13y agoCan you give some examples of standard library calls that are to be avoided at all costs but aren't @deprecated? Curious to know if I'm guilty of using them.
- peterashford 13y agoOh rubbish. What utter FUD.
- tsotha 13y agoThis just isn't true.
- michaelt 13y agoIf you aspire to make Java into the type of language we would arrive at if we redesigned Java from scratch today, it's not just a matter of adding good features but also removing bad ones. For example, you'd go directly to Joda-Time or JSR-310. Date and Calendar wouldn't be present at all. Whether Java should break compatibility to remove all the old cruft I'm not sure. The benefits of the cleaner design might not be worth the costs/inconvenience.
- muteh 13y agoI'm glad you added that last line, because that's basically the whole story. Java is /very/ backwards compatible, and it's got round the...errr...quirks of the early versions by having a massive ecosystem of alternative implementations. Some of these (like Joda-Time) are good enough to get widely accepted as the 'correct' implementation. I don't think anyone will argue when you say that that throws up some barriers to entry, but they're not massive barriers, the standard library does still work. Not having to rewrite your code every six months is much more important.
- brown9-2 13y agoIs there any major language out there that actively removes old/bad parts of it's standard library?
- tormeh 13y agoScala? It's still a very young language, though.
- brown9-2 13y agoWhat have they removed from the standard library? Just curious.
- thescrewdriver 13y agoIt's more a case of replace than remove...