Java: (new URL("http://foo.com")).equals(new URL("http://bar.foo.com")) returns true if they both resolve to the same IP. Not only does that plainly suck, the effects are that a) equality of two URL objects - two names, as it were - is dependent on whether or not you are connected to the Internet, and b) checking an object’s intrinsic identity and comparing it against another’s requires DNS server access. I have no words.
C#: Extensions are like Objective-C categories but different. This is funny because I thought categories would never come to C#. The ‘non-hacking’ use of categories has always been to split up a class definition into several distinct modules, and this was introduced more rigidly in C# 2.0 with partial, which is only allowed for the class within the same namespace in the same assembly (generated binary or general project grouping).
In Java’s defense, they provide both the URI class, which is intended as a purely syntactic structure, and the URL class, which is fundamentally for both syntax and network operations. Offering both types of objects seems reasonable enough.
By david glasser · 2007.01.31 23:25
Even if the URL class is for network operations,
foo.comdoes not equalbar.foo.com! When it comes to network operations, I find it reasonable that a URL does only equal another URL if the same bits will be sent over the wire.(Of course, what bits do get sent over the wire are highly dependent on the application, but it proves that the problem is hard, not that the solution that the URL class provides is at all good.)
By Jesper · 2007.02.01 12:56