by metadat · 2y ago · 0 comments
Still, as far as sharp edges go these are nothing compared to Java.
See the discussion from:
Common I/O Tasks in Modern Java
https://news.ycombinator.com/item?id=41142737
House of horrors, especially the URL equality triggering DNA requests.
I agree it can be confusing, as the URL also can act as a client that performs actual connections. The documentation actually mentions that URI is a better choice when you want only a representation
In general I don't think the other examples are that bad. The reason why there are so many different ways of performing I/O, is because Java is evolving and adding better solutions, but can't really remove older stuff like "URL" because it is widely used.
I see similar issues with other languages as they evolve, and I think Java has managed it well. The IDEs are also often good at making suggestions on how to replace outdated code.