File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Meaningless Drivel and the fly likes Learning Java (open source) API's - Like a scientist or an end user ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "Learning Java (open source) API Watch "Learning Java (open source) API New topic
Author

Learning Java (open source) API's - Like a scientist or an end user ?

justin smythhe
Ranch Hand

Joined: Jul 06, 2012
Posts: 107
If I see any java API (open source), is it advisable to look at the code of the
classes to learn what the code really does, Or do I only look at the docs and
learn how to use the API ? The latter is what I have been doing.
How have you been doing it ?

Think of it like this -
A car (API) is put before a physicist and a non-physicist.
The physicist might try to find out how the car works and even try to understand
its internals.
The non-physicist might be only interested in driving the car and maybe learning a
thing or two about the internals.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18992
    
    8

You look at the documentation.

If you have to look at the source code, that means that the documentation is a failure. (Which is certainly a possibility -- there's no guarantee that any particular open-source project has good documentation.)

However your analogy is badly chosen. Java programmers are engineers, rather than scientists. And Java classes are (I mean, should be) designed so that their function is completely described by their API documentation. When you read about software engineering (note, not "software science") you'll see lots of references to the "contract" of a class or an interface. That word refers to some documentation which says what the class or interface implementation is supposed to do.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 908
    
    5
justin smythhe wrote:If I see any java API (open source), is it advisable to look at the code of the
classes to learn what the code really does, Or do I only look at the docs and
learn how to use the API ?


I have been happily using Apache Velocity Engine, a free open-source templating engine since many years.
I must admit to have never ever been forced to look into its sources due to its being properly documented.
http://velocity.apache.org/

On the other hand I was once forced to look into the (disassembled) code of an (by the way obfuscated) commercial product in order to find out some not properly documented trait of its behavior.
Mandar Khire
Ranch Hand

Joined: Sep 11, 2007
Posts: 504

justin smythhe, You ask question which arise in my mind also when i see java API (open source) or open source projects also...

Think of it like this -
A car (API) is put before a physicist and a non-physicist.
The physicist might try to find out how the car works and even try to understand
its internals.
The non-physicist might be only interested in driving the car and maybe learning a
thing or two about the internals.

Paul Clapham's one sentence i not understand...
However your analogy is badly chosen. Java programmers are engineers, rather than scientists.

I agree with further statements written by him...
For example i am java programmer i can write program in java. but now i want to know how it works...if we take example of car...like by after starting engine...shifting gear & blah..blah... & car moves...OK
But now as physicist i want to know how actual java program run...then i read about openjdk...bytecode...more & more deep...& so java program run...(till date i not find out way to get debug stack in such deep...)
question is, Engineer study about science or something else?
If java programmer are engineers then should he/she think like 'physicist'(in above quote)...then it wrong?
...software engineering (note, not "software science")...

I know by google i can get lots of info about both...but can in easy words anyone explain here?
I apologized in advance if i wrong some where here...


Millions saw the apple fall, but Newton asked why.
 
permaculture playing cards
 
subject: Learning Java (open source) API's - Like a scientist or an end user ?