24 ms·
Ok kids. URL was deprecated in favor of URI before some of you were born. Easy to be a harsh judge now but back when java was first developed the concept of a "
by oldgeek 7y ago
Ok kids. URL was deprecated in favor of URI before some of you were born. Easy to be a harsh judge now but back when java was first developed the concept of a "design pattern" did not even exist. In fact the development design patterns was initially driven primarily by people figuring out good ways of doing things in java.
- dukoid 7y agoIs URL really deprecated -- I thought URL is still used to actually open the connection?
- layer8 7y agoIt’s not deprecated. As you say, it is needed to actually open a connection.
- oldgeek 7y agoI don't mean @deprecated. Just that the recommendation has been to use URI instead of URL wherever possible since URI was introduced. URL is not needed any longer with the new HttpClient stuff in java 11.
- JoeAltmaier 7y agoRevisionist history? The seminal work in Design Patterns (coined the term) came out in 1995 Design Patterns (Elements of Reusable Object-Oriented Software), Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, 1995] Same year Java was invented. Hard to imagine Java inspired it.
- ivan_gammel 7y ago1994 and the book contained examples of code on C++
- oldgeek 7y agoOk, java was influential in a ton of subsequent design patterns. For a long time java was pretty much the test-bed for these ideas. And the other half of the point remains: modern design patterns were not part of the standard toolbox at the time. To be clear, I am not defending the design of the URL class. Just that you need to judge it in context.
- ben509 7y ago> URL was deprecated in favor of URI before some of you were born. It hasn't been deprecated, it's still in use in the standard library[1][2][3] and they don't offer additional classes that accept URIs. > Easy to be a harsh judge now but back when java was first developed... They've made no effort over 11 major versions to diminish its use beyond a brief note that encoding is easier with URIs. There's not even a warning on the equals or hashCode method, let alone the class documentation, it just quietly mentions that it's resolving a name. There's no way people are finding out that you should avoid URL except through lore. [1]: https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/URLClassLoader.html https://docs.oracle.com/en/java/javase/12/docs/api/java.base... [2]: https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/URLStreamHandler.html https://docs.oracle.com/en/java/javase/12/docs/api/java.base... [3]: https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/net/URLConnection.html https://docs.oracle.com/en/java/javase/12/docs/api/java.base...