File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Interview question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interview question" Watch "Interview question" New topic

Interview question

Mala Sharma
Ranch Hand

Joined: Oct 29, 2004
Posts: 76

I had a interview over telephone today where i was asked the difference between a "class" and a "component". To me this question made no sense so i basically told them the difference between class and a object. Is there an answer to the above asked question or was my understanding right (it was probably HR person conducting the interview). Any comments are welcomed.

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

There are a couple of different definitions of "component", but generally, a component is the smallest unit of software reusability. Sometimes it's one class, but usually it's a group of classes, together with published interfaces and documentation. By this definition, Lucene is a component. An EJB that provides credit-card charging is a component.

[Jess in Action][AskingGoodQuestions]
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 659

To add more: You can decide upon the components while you are designing your architecture and classes you do it later.
[ September 14, 2005: Message edited by: Arun Kumarr ]

If you are not laughing at yourself, then you just didn't get the joke.
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Answer: it depends on the context but in general a component is a pluggable service. A component may consist of one or more classes plus any associated configuration resources.
Consider Paul's rocket mass heater.
subject: Interview question
It's not a secret anymore!