Prev: Korean language broken
Next: Possible easy diagnostic outputting from multiple threads to the one text frame
From: Arne Vajhøj on 14 Jul 2010 21:36 On 14-07-2010 18:02, Tom Anderson wrote: > On Tue, 13 Jul 2010, Andreas Leitgeb wrote: >> Jim Janney <jjanney(a)shell.xmission.com> wrote: >>> Andreas Leitgeb <avl(a)gamma.logic.tuwien.ac.at> writes: >>>> It seems so basic that I can't believe such a feature wasn't in the >>>> standard library >>> >>> http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringUtils.html#leftPad(java.lang.String,%20int,%20char) >>> >> >> My rant was about the Java Standard Library > > The standard library is already freak huge. If it had every item which > anyone couldn't believe wasn't in the standard library, it could be a > very leviathan, a behemoth, a colossus of codes. But this is very basic functionality. ..NET has it. C++ STL has it. Python has it. Ruby has it. Arne
From: Arne Vajhøj on 14 Jul 2010 21:38 On 14-07-2010 11:56, Roedy Green wrote: > On 13 Jul 2010 15:01:35 GMT, Andreas Leitgeb > <avl(a)gamma.logic.tuwien.ac.at> wrote, quoted or indirectly quoted > someone who said : >> It seems so basic that I can't believe such a feature wasn't in >> the standard library: > > it is part of the common11 tools for JDK 1.1+ > http://mindprod.com/products1.html#COMMON11 He is very explicit asking about the standard library. Arne
From: Andreas Leitgeb on 15 Jul 2010 03:10 Stefan Ram <ram(a)zedat.fu-berlin.de> wrote: > Arne Vajhøj <arne(a)vajhoej.dk> writes: >> But this is very basic functionality. > One might ask the OP in which context/case he needs this, > then more answers might be possible, such as solutions > solving his general problem, but not requiring this. The OP (me) did write, that he (I) got to it by the need of custom-char padding some String to a given size. I also wrote that my needs fortunately weren't all that general, so I got by with a couple of stock pad-strings, of which I pick the needed one, append it to the given string, and then do a .substring() on it. (it's the chars '0' and '9' and a max len well below 20 *for my current needs*. So, it's not a matter of "This missing feature impedes me at my attempts to save the world". Anyway, it seems like a very basic building block. Btw., it also took them till 1.6 to add the very useful Arrays.copyOf().
From: Arved Sandstrom on 15 Jul 2010 04:19 Tom Anderson wrote: > On Tue, 13 Jul 2010, Andreas Leitgeb wrote: > >> Jim Janney <jjanney(a)shell.xmission.com> wrote: >>> Andreas Leitgeb <avl(a)gamma.logic.tuwien.ac.at> writes: >>> >>>> It seems so basic that I can't believe such a feature wasn't in the >>>> standard library >>> >>> http://commons.apache.org/lang/api-release/org/apache/commons/lang/StringUtils.html#leftPad(java.lang.String,%20int,%20char) >>> >> >> My rant was about the Java Standard Library > > The standard library is already freak huge. If it had every item which > anyone couldn't believe wasn't in the standard library, it could be a > very leviathan, a behemoth, a colossus of codes. > > What i think we could do with is a sort of Greater Standard Library. > Some way of giving certain packages official blessing, so that if you > built code on top of them, you'd have a reasonable expectation that > someone out there who wanted to run your code would already have them. > This already exists de facto for certain things - log4j, quite a bit of > Apache Commons, JUnit, and so on, but it could be useful to put it on a > more formal, although not completely formal, basis. We could tie this up > with a process for merging different libraries approaching the same > problem, reviewing and improving and integrating things, etc. We would > end up with something like a more comprehensive standard library, but > without the mandarins at Sunacle (or JCP Towers - shudder) having to > decree it. > > Not that i'm volunteering to organise this, of course. > > tom Not the worst idea in the world. I suspect that the list of third-party JARs for very many good-sized reasonably general-purpose applications looks substantially the same; grab the third-party JAR list for a few thousand or a few tens of thousands of realistic apps, store it in an associative array by number of occurrences, and promulgate the list of Top 10 or Top 20 as your Greater Standard Library (GSL). Having such a thing might then help address Andreas' problem, which is that of finding a given functionality; the existence of a GSL would make it more clear than it is now that the JDK falls flat in certain areas, and the types of JARs in the GSL would illustrate *where* the JDK falls flat. An even better metric than simple third-party JAR lists in applications would at least check to see that the JARs are actually in use, and then possibly how much. On a related note I think you'd then find that most of the functionality in such a GSL ought to have been part of the JDK a long time ago. I have no problems in the JDK people being conservative (and often retro-active) when it comes to creating new APIs (although it seems to me that they could have usefully been much more conservative at times), but OTOH some stuff is so obvious that I fault them for not having created those libraries a long time ago. For example, Apache Commons Lang StringUtils is loaded with so much obvious stuff that gets used all the time; would it have been so difficult for the geniuses at Sun to write something like that way back when? I have to admit that I also find it slightly irritating when one's own libraries are subsequently rolled up by official and semi-official (*) API introductions/improvements/upgrades. As a consultant specializing in maintenance of J2EE applications I see an appreciable percentage of code made redundant or obsolete by what are fairly obvious API releases and upgrades by Sun or other major library writers. I don't fault upgrades or additions to APIs that are based on required marketplace exposure to garner feedback; I mean rather corrections to deficient initial releases or after-the-fact initial releases. Before anyone points out that I'm whining, let me point out that many working programmers have neither the time (nor often official approval) to polish up their own libraries and release them to the adoring public. I've also found that there aren't really all *that* many NIMBY programmers out there; most would happily use a fine third-party library rather than write their own code. One largish application that I worked with extensively in the recent past was written by a good core team, quite a few years ago, and it's replete with ?Utils classes, almost all of which express functionality that was not available 5-7 years ago; at least 75% of that functionality is now available in official or semi-official libraries or their improved (read fixed) later versions. Bit late IMHO...since none of it was all that esoteric. AHS * semi-official: unofficial but very common -- We�re surrounded. That simplifies our problem of getting to these people and killing them. -- Lewis B. Puller, North Korea, 1950
From: Roedy Green on 15 Jul 2010 16:10 On Wed, 14 Jul 2010 08:56:38 -0700, Roedy Green <see_website(a)mindprod.com.invalid> wrote, quoted or indirectly quoted someone who said : > private static final String SOMESPACES = " "; for some reason his is displaying improperly. That should be about 40 spaces long. -- Roedy Green Canadian Mind Products http://mindprod.com You encapsulate not just to save typing, but more importantly, to make it easy and safe to change the code later, since you then need change the logic in only one place. Without it, you might fail to change the logic in all the places it occurs.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Korean language broken Next: Possible easy diagnostic outputting from multiple threads to the one text frame |