Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Why does Java not include enough useful utilities ?

 
Ranch Hand
Posts: 141
5
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many utility functions which could be useful for a large number of people, but Java either does not provide them at all or provides them too late. For example, get the sub-string between two strings that occur in a given string - https://stackoverflow.com/questions/16597303/extract-string-between-two-strings-in-java. Other examples - Joda time library, Lombok (no more boilerplate code for getters and setters !). Google first provided the libraries needed for functional programming with lambdas. But, Java only provided that starting with version 8. I am sure there must be more examples like these.

Why does Java provide such utilities so late or simply never provide them ?
 
Rancher
Posts: 527
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if there were lambdas before java 8.  I'm guessing they'd rather focus on big helpful changes, like lambdas, or referencing with val, instead of adding simple functions that a small library can provide.
 
Marshal
Posts: 25473
67
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One man's "useful utility" is another man's "useless cruft". There may be people who need to find the string which sits between two substrings, but in my opinion there can't be very many of them. I certainly wouldn't expect to find that in the standard API, not unless there were several dozen other similar but not the same methods. And it's about four lines of code if you don't use regex, so you'd think it would take most of those people about one minute to write the code.
 
Saloon Keeper
Posts: 6391
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's only so much you can include and maintain. Java was made extensible for that reason, and 3rd party libraries for all kinds of stuff duly turned up. Sounds good to me.
 
Sheriff
Posts: 4860
317
IntelliJ IDE Python Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tom Joe wrote:Lombok (no more boilerplate code for getters and setters !)


I have a special dislike / distrust of project lombok. To be honest I have a baseline skepticism / distrust of most 3rd party libraries, in fact I don't really like some of the really mainline ones such as Spring and don't get me started on Hibernate.
 
Marshal
Posts: 69035
275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What made you think Java® doesn't provide Joda time?
 
Master Rancher
Posts: 887
22
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMO... because Java is not C#.  Sun did not want to get into a pissing contest with MS after kicking their butts on the Java law suite.  It took Oracle to adopt the MS assembly line type of release schedule that MS has enjoyed and been blasted for all these many years I've been in programming, and rush to become C# like.  BTW: I have on several occasions been employed by MS partner corporations and consulting firms... it has not increased my opinion of them, but rather, has diminished my exuberance for their products as I became all too familiar with them.

Tom Joe wrote:There are many utility functions which could be useful for a large number of people, but Java either does not provide them at all or provides them too late. For example, get the sub-string between two strings that occur in a given string - https://stackoverflow.com/questions/16597303/extract-string-between-two-strings-in-java. Other examples - Joda time library, Lombok (no more boilerplate code for getters and setters !). Google first provided the libraries needed for functional programming with lambdas. But, Java only provided that starting with version 8. I am sure there must be more examples like these.

Why does Java provide such utilities so late or simply never provide them ?

 
Saloon Keeper
Posts: 11923
253
  • Likes 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Les, I work in a software company that builds solutions that tightly integrate with many different Microsoft products. Over the past 5 years I've made two primary observations:

  • Microsoft has made great steps in becoming more open-source, and becoming less evil in general.
  • Microsoft still employs mainly shit programmers and it's horrible to write software that interfaces with their products.
  •  
    Tim Cooke
    Sheriff
    Posts: 4860
    317
    IntelliJ IDE Python Java Linux
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:Microsoft still employs mainly shit programmers and it's horrible to write software that interfaces with their products.


    This actually made me audibly laugh. I think our glorious leader Paul Wheaton will also be amused by it, he has a special dislike of Microsoft.
     
    Saloon Keeper
    Posts: 22011
    151
    Android Eclipse IDE Tomcat Server Redhat Java Linux
    • Likes 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Getting a string from between two strings is a stock task using Regular Expressions. Or, if you'd rather keep your sanity, it can be made into your very own personal utility method by stringing common substring/find functions together. But actually I rarely do that particular operation, and when I do, it's usually something I do with command-line file utilities, not part of an application. Not a good example of Java lacking "useful utilities".

    Java has one of the richest utility compendiums around and, as I'm at the moment having to deal with a much-poorer but venerable alternative language, I miss that stuff.

    As for dumping on Microsoft programmers, that's what happens in large corporations. They get hordes of cheap developers so that they can save money to blow on overpriced and often-useless business systems and consultants.

    The main problem with Microsoft at the moment is a serious lack of quality control. It's been nearly a year since Windows was even trustworthy at the mediocre level that we expect from big-name software products. Every new fix release since then has come with a free game: the "What essential function breaks and renders Windows unbootable?" game.

    I don't think Microsoft loves Windows anymore.
     
    Les Morgan
    Master Rancher
    Posts: 887
    22
    Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Stephan,

    I used work for a Microsoft partner firm and one day we had the MS Engineers down explaining the ins and outs of OLE, object linking and embedding, and it went something like this:

    We have a standard that says you will expose your proprietary interfaces to the view of the world, including all of your competitors, so that we can have a standard that works really nice across all compatible products.

    The engineer then smiled and said: not everyone is forthcoming with their full interface and not everyone gives all of the interface points to make everything work perfectly because after all, business is always trying to get one over on their competition. (my little thoughts here: MS always does that with its partners--keeps them in the dark as much as possible, while exploiting whatever they can from their agreements.

    Les

    BTW: MS's move to be more open, which is a good thing, is self-preservation.  Back when I started MS had about 85%+ of the web, but after Linux and Apache hit the market that soon reversed where everyone else had 85%+ of the market and MS was picking over 15% or less.  It took them a long time to see the writing on the wall that they either had to become more agile across platforms and products or people were jumping ship.  IMO: if the user population, our end-users in business, didn't have the inherent knowledge available from MS release to MS release, which they really messed up in 8 and completely made 9 disappear, Ubuntu would be on all the desktops and MS would be a token in the history of computers.

    Stephan van Hulst wrote:Les, I work in a software company that builds solutions that tightly integrate with many different Microsoft products. Over the past 5 years I've made two primary observations:

  • Microsoft has made great steps in becoming more open-source, and becoming less evil in general.
  • Microsoft still employs mainly shit programmers and it's horrible to write software that interfaces with their products.
  •  
    Ranch Foreman
    Posts: 103
    7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Tom Joe wrote:There are many utility functions which could be useful for a large number of people, but Java either does not provide them at all or provides them too late. For example, get the sub-string between two strings that occur in a given string - https://stackoverflow.com/questions/16597303/extract-string-between-two-strings-in-java. Other examples - Joda time library, Lombok (no more boilerplate code for getters and setters !). Google first provided the libraries needed for functional programming with lambdas. But, Java only provided that starting with version 8. I am sure there must be more examples like these.

    Why does Java provide such utilities so late or simply never provide them ?


    RegEx are a part of SE API since 1.4 wich was released in early 2002, only about 8 years after initial 1.0 release in 1996. And although I don't know I guess there was some lib pretty early on to do such tasks - and then RegEx showed up in 2002.
    RegEx under the hood work no different than searching and substring and splitting and checking for equality. So, if you ask if it was possible to split up a String to get data inside of tags before Java introduced RegEx - sure it was, it just required you to write all what a RegEx does yourself - and the given example would only require a loop for search for the start tag, then for the end tag, and then just substring between the indexes. With some ugly unreadable code this can even be a one-liner. So, in fact, using RegEx is more complex than not for this sample task.
     
    Ranch Hand
    Posts: 33
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:Les, I work in a software company that builds solutions that tightly integrate with many different Microsoft products. Over the past 5 years I've made two primary observations:

  • Microsoft has made great steps in becoming more open-source, and becoming less evil in general.
  • Microsoft still employs mainly shit programmers and it's horrible to write software that interfaces with their products.


  • Can Microsoft make more money by making it hard to interface with their products ? I mean, like being a dominant car maker & designing your cars to require frequent maintenance from authorized repair shops ? If yes, then it is a good strategy until good alternatives start showing up. One can always dip into the huge pile of cash from the good days. Perhaps even do charity with some of that cash.
     
    Greenhorn
    Posts: 7
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:Les, I work in a software company that builds solutions that tightly integrate with many different Microsoft products. Over the past 5 years I've made two primary observations:

  • Microsoft has made great steps in becoming more open-source, and becoming less evil in general.
  • Microsoft still employs mainly shit programmers and it's horrible to write software that interfaces with their products.


  • That is absolutely true things and I am also thinking the Lambda is the only things which is introduced in Java 8.
     
    Tim Holloway
    Saloon Keeper
    Posts: 22011
    151
    Android Eclipse IDE Tomcat Server Redhat Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    When Java was initially designed, Gosling and his crew looked carefully at the features available from other programming languages, especially C++. The goal was to produce a portable, standardized and efficient language environment designed from the ground up for object-oriented design, for security, and for reliability.

    This meant discarding pointers and multiple inheritance, limiting casts, runtime overhead that strained the processors of the day and a lot of other decisions. Some of which have been since regretted. But Java is a living language and its design has been impacted by its usage, by influences from other ecosystems and by advances in understanding. Lambdas, for example, are such a fundamental part of LISP that parameterized functions are almost an afterthought - they're built on lambdas, But traditional procedural and OOP languages rarely implemented lambdas. One of the primary reasons why Java finally adopted lambdas was that in the absence of explicit C-style pointer-based callbacks, a rather clunky mechanism of anonymous inner classes had become necessary to achieve many goals - Swing in particular made heavy use of that mechanism. Lambdas make the process much cleaner.

    Java will continue to grow and evolve. Some ideas are not yet ripe. There is also the need to avoid throwing in every possible concept into the language lest it become cumbersome and hard to learn and use. Like most successful products, it is "good enough", and better than many of its alternatives, and it will continue to address needs as they arise.
     
    We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
    ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
    https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
      Bookmark Topic Watch Topic
    • New Topic