Solved

Java OO Design  - general knowledge

Posted on 2012-04-11
7
464 Views
Last Modified: 2012-04-12
Hi,

First, this is not an assignment.

What is the best answer if people ask you what is OO Design in Java?

You guys are Java experts, how do you tell people what is OO Design in Java if you have a job interview? I know this is a very common question when I do a google search, but not sure what is the best answer for this..

Thankyou in advance
0
Comment
Question by:unistudent
  • 3
  • 2
  • 2
7 Comments
 
LVL 23

Expert Comment

by:basicinstinct
ID: 37835505
I explain it as creating "black box" reusable components. Each black box has a known interface which other code can reuse without knowing what's inside the box.

I go on to liken it to having two teams making hardware - one team builds headphones, the other builds iPhones. Neither team cares about the inner workings of the other hardware. Instead they both design to a known interface, in this case the headphone jack.
0
 

Author Comment

by:unistudent
ID: 37835619
Thanks. basicinstinct.

This sounds like a abstract class for me, isn't it? Please advise
Doesn't the following example I gave you, can tell this is a OO Design? Please advise.
For example,
like building a employee record, an employee can be a management role with different salary rank, also, an employee can be a worker with different salary range and applied for penalty rates.

abstract class employee{
  private  string name;
  public   integer emplyeeId;
  abstract  double salary ()
}

class management extend employee {
   double salary() {
   }

}

class worker extend employee {
   double salary () {

  }
   
}
0
 
LVL 23

Expert Comment

by:basicinstinct
ID: 37835979
Well in my example above I didn't really cover class vs object... Everything in my example was an object.

I normally explain classes vs objects either like baking:

A class is a (cake) recipe.
An object is a cake.

Or construction:
A class is a blueprint.
An object is a building.

Your example seems sound.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:unistudent
ID: 37836280
Thanks for advice.

my last question. let's say when i explain to people what is Java OO design, should I just give them this example?

 I should tell them I create employee abstract class and two subclasses linked to their assoicated super class. isn't it?

Yes. I do realise even I can write java OO program, but I am confused and dont know how to explain to people the difference in between class and object. and how OO design used these two technical term..

Thanks
0
 
LVL 12

Accepted Solution

by:
Sharon Seth earned 500 total points
ID: 37836391
Class and Object are OO concepts . They simply relate to things in the real world . Just like in the posts above , blueprint , buildgin , cake and recipes - all there are real world things . OO design allows you to model s/w components in line with the real world objects.

Coming to your question - When ppl ask you what is java OO design , you got to tell them about more than just classes and objects . You got to tell how each of the OO concepts(abstraction , inheritance and so on) can be implemented in  Java
0
 

Author Comment

by:unistudent
ID: 37836463
Thank you.
Now it is clear now. So next time if people ask me about java OO design I will mention about abstraction and inheritance in writing OO Java program.
0
 
LVL 12

Expert Comment

by:Sharon Seth
ID: 37836936
Not just abstraction and inheritance . I meant all the OO concepts
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now