Skip to main content

What I would want is a better quality of std apis

2 replies [Last post]
schnoffos
Offline
Joined: 2007-07-04
Points: 0

core API's are overly protected against reuse and extensibility. I spend about 1/4 of my Java programming time to write unnecessary glue code.

It happens about once every two programming days that I want to use a functionality that is obviously implemented (file extensions associated with MimeType's to mention what happened a few minutes ago) but not available.

Extending URL's doesn't seem like an illegitimate approach to me. Why is it final? If there's a good reason, why isn't it (decently) possible to add scheme handlers?

Why are there ErrorListeners and ErrorHandlers? Almost identical but incompatible enough so that a single class can't implement both. Most annoying.

Java is really a messy business.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jwenting
Offline
Joined: 2003-12-02
Points: 0

> core API's are overly protected against reuse and
> extensibility. I spend about 1/4 of my Java
> programming time to write unnecessary glue code.
>
hardly.

> It happens about once every two programming days that
> I want to use a functionality that is obviously
> implemented (file extensions associated with
> MimeType's to mention what happened a few minutes
> ago) but not available.
>
if it's implemented it's available. You're contradicting yourself.

> Extending URL's doesn't seem like an illegitimate
> approach to me. Why is it final? If there's a good

to prevent people like you from corrupting it by "making it better".

> Java is really a messy business.

Go back to whatever your favourite language is then, instead of trying to turn Java into it.

schnoffos
Offline
Joined: 2007-07-04
Points: 0

> hardly.

Well I am often told that I'm driving my sense of code aestetics to far. But there a so many people who don't have any aestetics at all, that I feel like one idealist couldn't do much harm.

> if it's implemented it's available. You're contradicting yourself.

Hm. I can not agree to that.

MimeTypes are determined based on file name extensions (FileTypeMap). So there already is a mapping of MimeType's and extensions which is not exposed (at least I didn't find it). Where is the contradiction?

If I have content and a mime type and want to store that in a temp file, I really expect an API using name based recognition to provide me with extensions associated with this type, so that I don't have to store the mime type along with the content.

I wouldn't expect this from JMimeMagic, since this lib doesn't do name based mapping (and doesn't require the presence of a matching filename extension). JMimeMagic on the other hand exposes information about associated extensions, it has however dependencies on several libraries that I don't necessarily want to add to my project.

So why don't I want to use JMimeMagic, remove deps I don't need and customize the source? Well I have no time to maintain the changes and such a kind of library needs maintenance, so I would prefer to use some standard api that is beeing maintained.

Why don't I take a mapping file from the net? Because that actually contradicts the idea of reusing code, doesn't it?

> to prevent people like you from corrupting it by "making it better".

If you want to use URI.relativize() or URI.resolve() on jar resources, they fail because this functionality is not (fully?) implemented. To my knowlege there is no satisfying way to correct this from client code. There are valid URL's that are not supported by URL. If you want to add support and don't know the environment in which your code is executed, you just fail (registering URL handlers is quite a bad idea, because you can't tell what side effects this might have).

What is people like me? (well this is probably asking for flame, but why not ;-)

> Go back to whatever your favourite language is then, instead of trying to turn Java into it.

Well going back would mean meeting either Eiffel or C++. One is a dying language the other one mostly dead. One is a beautiful language the other a really terrible mess. Both is not an option. .Net is more like a side step, not much of a difference, except that the libs are cleaner. But then it's MS and all the enterprise stuff and eclipse would be gone. No.

I'm a developer and I want cleaner and more flexible libraries. I don't see what's wrong with posting that to a forum named "What Developers Want".