Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java API searching

 
Pal Sudarshan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

My question: How should one search the SUN's API? Say, for example, I want to know if a method already exists in Java API. Then how should I search the Java API? How would I know which class and package that method more likely belongs to?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly, the real answer is experience. The only way to learn your way around is by reading, studying, and using the APIs. There's no magic bullet here.
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google.

If you mean "find a method that does this" then yeah, only way is through experience (or asking someone else with experience)
[ June 25, 2004: Message edited by: Darin Niard ]
 
siva raju
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you could also guess the method name close enough, go to the java api index, and check out the methods. I have been lucky this way sometimes.
 
Nitin Shivaram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using the Java SDK WinHelp, if you know the method name, it's a Walk in the park.

Get Java SDK WinHelp from Here Java SDK WinHelp
 
sever oon
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the risk of engendering hatred aimed at yours truly...I find that sometimes I can actually intuit this sort of thing.

This sounds a LOT more pompous and arrogant than it really is...let me explain. First, you do need a good deal of experience with the basic package structure of the JDK and the most significant classes within those packages. This will not only give you the basic knowledge of the main APIs but a feel for how things are organized. (I admittedly also benefit from having followed the history of the development of these APIs, so I have quite a bit of knowledge that one could probably only attain by having worked with every JDK since 1.0...but I don't think this is that big a factor.)

Second, assume the JDK is perfect and all-encompassing.

Seriously. Assume it does everything you need it to do in the best, most elegant way you can think of, and puts that functionality in the place that makes the most sense to you based on what you know about the JDK packages and classes. Then go there, and expect it to be there. It often is. Sounds crazy, but Java's not that bad once you have the basics down. You will miss a lot at first, but the good thing about doing this is that you are actively engaging the APIs on an intellectual level, which means that your search through the APIs will be driven by logic, which means it will be connected to you at some unconscious, deep-seated emotional level because of the basic human need to be right. And quite often, when you miss, it will be not because the JDK is not perfect, but rather because it's in a more perfect place than you could think of. And when you do learn where it is, and it dawns on you why that's a more perfect place, your knowledge of the APIs is bolstered and you engage in what I believe is called a virtuous cycle.

As opposed to random, brute-force stabs at locating functionality using the function index...which is a vicious cycle of degenerating comprehension because it encourages a view of the APIs that is more library like in structure than OO-like.

sev
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic