So we all know that learning a programming language is a tiny portion of getting productive on a platform. It takes far longer to learn the Java libraries than it takes to learn the Java Programming Language, same goes for C#, JavaScript, Python, Ruby ... etc.
As programmers we can easily make the observation that a for loop or an array is a for loop or an array in any programming language. Once you learn the concept you don't need to re-learn it sure the syntax is different but zero effort is spent re-learning the concept. Obviously this is not the case with standard libraries, which means we have to re-learn how do common tasks such as files manipulation, talking to a database, doing networking on every platform that we use, this is inefficient and painful, there must be a better way out there.
The W3C DOM is an example of a cross language library that is supposed to have the same function names and the same semantics no matter the programming language. W3C DOM is hard to use but at least once you learn it in one language/platform it is the same in others.
Is there a set of cross language libraries defined anywhere for the most common tasks that a developer circa 2011 would care about.
Clarification: I am not interested in APIs that are bound to current platform like .NET or the JVM because those are tied to a single company and in many cases they APIs are showing their age and if they were re-designed today would be much cleaner/better. Also being primarily a Java developer watching Oracle take over Java sue Google has been a true horror show. I really don't want the hours that I invest in mastering a platform to be tied to controlled by a single entity, but rather be some sort of open source project, where the best designs win.
Clarification: I am looking for APIs that are the same in lots of different languages not tied to a single language. For example consider reading the contents of a text file. I have to open the file, read the contents, ... etc I would be looking for an API where function had exactly the same name in all the various languages, the same parameters, in the same order, with the same return data, same error handling semantics. I am aware of different programming paradigms so I am okay with an OO version of the API, a functional version ... etc.
An interesting question... I think that there is greater opportunity for libraries that perform more specialized functions to be developed with multiple language bindings (and you are starting to see this with various web services). Unfortunately, the abstractions provided tend to be fairly simplistic and often feel "alien" despite the efforts of developers to make the language bindings as natural as possible. Perhaps a better way to say it is that they tend to be unidiomatic. The low level POSIX APIs, for example, do in fact represent a kind of lowest common denominator for a standard library, but the challenge is that different languages (can) approach even these basic abstractions very differently in their quest to make them "natural" for that language. Another problem (as alluded to in previous posts) is that by their very nature, standard libraries have to be agreed upon and this can be extremely challenging by itself. Unfortunately this process often leads to APIs that really satisfy no-one. (for example... do we REALLY have to support 36 bit words or the Coptic Calendar? Depends on your point of view. Should the API be object oriented, functional or something else like streams? Also depends on your point of view. Just pointing out that this is perhaps a more complicated issue than one would think.
It should be noted that there have been efforts to provide better (at least more consistent) APIs for standard things. One example is Plan9, an operating system in which EVERYTHING is a file. Overall, reviews have been mixed.
That's a good question. Such library will be a good asset for every developer, but it can not be standard, because standard libraries are very conservative, and it takes time for the ideal API to settle down. There is also a problem with backward compatibility that once code is entered standard library, it can not change. In Python community there is a joke that good modules enter standard library to die.
This library can start, not as a library though, but as a community/recipe site that will concentrate on the collaboration process, because it's not easy for one man to persuade all others that the chosen API is the best. You really have to convince everybody.
I can not say for other languages, but in Python community there is a concern about moving stdlib out of the core so that it could evolve more rapidly. There is an proposal labelled PEP 413, but it is not enough. The plan could be to:
So, the answer is - there is no such cross-language library. Because there is insufficient communication between parties. Because there is no intuitive platform to do this.
Yes, there are a few. Windows, MacOS X, Linux... :)
More seriously, the .Net and Java runtimes both support many languages, so if you stay within the set of languages they support, then you can keep your library knowledge.
The following things come to one's mind:
Microsoft .NET - rather tightly bound to the Microsoft ecosystem (but keep Mono in mind), has bindings to many languages, design is somewhat Java-inspired. Does most of the things you've listed.
Qt - roots very firmly in C++, has bindings to other languages, not as heavyweight as .NET, but does not feel as alien on *nix and MacOS. Database support is very primitive, crypto support is nonexistent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With