• Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching for Existing Objects to Use  RSS feed

 
Sterling Crapser
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried searching for this question but had no luck. I'm sure this question must have been asked several times before.

The official libraries contain thousands of objects that could perform a specific function in a project instead of writing from scratch. But how does one find them? I doubt anyone is so familiar they just "know". How is this dealt with as the libraries continue to grow in size and scope? Are there any tools available? What do most people do if that is known?

Thanks
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you mean classes, not objects

Generally, I tend to remember what differrent libraries do, not individual classes. I might remember some important, most-used ones, but not all classes. So, I remember that apache-commons has a library for collections, another one has utilities for language support, another one implements a pool, and so on. Once, I need something, I look into the API docs for the most relevant library.

Or sometimes, just reading through the code of Open source projects helps. "I need to generate some java byte code during runtime. I know Spring generates proxies at runtime. I wonder how does spring do it?" Google and read through spring code for 2 hours "Oh Spring uses CGlib to generate proxies. Maybe I can use it too!"

Just don;t try to remember everything. Instead learn/remember things that help you in finding information.

Edit: SOmetimes learning the correct terminology also helps in finding stuff. No offense, but I'm sure if I call classes as objects, I would have hard time finding stuff.
 
Sterling Crapser
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. Classes are what objects are made from.

I find it surprising with all the libraries of classes that a search tool of some sort has not become a popular item with Java developers. I'm sure there are some items that are used frequently and developers learn about them as a matter of course. But eventually it will be necessary to have some way of plowing through the libraries to find if something already exists.
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a search tool of some sort has not become a popular item with Java developers


There are rumors that many Java developers tend to use their favorite search engines not only for general purposes,
but also while programming.

There are specialized tools too (maybe on a more technical level) like this:

jarfinder
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the libraries are well documented. Indeed, documentation is one of the criteria for me for a good library.
Such documentation almost always includes How to/FAQ/Quick starter type of sections with relevant code examples. Once you get a feel of how to go about things, it is a matter of routine to check out the API. Many times class names will be self explanatory. e.g. DocumentParser. Reading the name tells you this would provide a document parsing ability.

If you google enough and/or hang out on forums trying to answer questions, you will always be rewarded with some gem of new information.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sterling Crapser wrote:I find it surprising with all the libraries of classes that a search tool of some sort has not become a popular item with Java developers. I'm sure there are some items that are used frequently and developers learn about them as a matter of course. But eventually it will be necessary to have some way of plowing through the libraries to find if something already exists.

I don't think Java's alone there although, after humpteen years, it's libraries are likely bigger than most. My usual rule of thumb is that, like a writer, I assume that if something's useful, it's probably already been written (the writer's mantra is that if it sounds good, Shakespeare probably already wrote it ).

In many cases you'll have some idea where to start. For example, for a search, I'd probably start out with classes that make up the Java Collections Framework.

But that doesn't always hold true. For example, I almost always use "LinkedHash" classes (eg, LinkedHashMap) when I want a hashed structure now; but it took me about a year to discover them because they're not often mentioned in classes or tutorials.

Winston
 
Sterling Crapser
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found this online:

Finding Java API Methods and Classes

It discusses two tools developed to target methods and classes by popularity.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!