This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
justin smythhe
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 569
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic