Solved

Java Object, interface, HLD and LLD

Posted on 2010-08-22
11
1,459 Views
Last Modified: 2013-11-23
Hi,
I want to know why Object class is superclass for every class(not performance overhead?), why interfaces, and exact details of what is HLD and LLD.
Thanks,
Aneesh.
0
Comment
Question by:ganeshaneesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 26

Accepted Solution

by:
ksivananth earned 150 total points
ID: 33498646
because Object class has the methods every class need to have!

Interface, there many reasons,

1. When you there can be many different implementation for a behaviour.
2. To bring high level abstraction( for example role based access )
3. In Java, to achive multiple inheritance...

HLD - High level design( provides high level design info )
LLD - Low level design( provides detailed design info )
0
 

Author Comment

by:ganeshaneesh
ID: 33498813
could you exmplain a bit,
"because Object class has the methods every class need to have!"?
and
HLD - High level design( provides high level design info )
LLD - Low level design( provides detailed design info )
0
 
LVL 12

Assisted Solution

by:marklorenz
marklorenz earned 75 total points
ID: 33500203
1. Object has standard methods, like getting hash map (for sorting) and toString (for display).  It is not much overhead - if it was, the entire class hierarchy would have this problem!

2. Interfaces provide common behavior for classes.  I.e. roles that the objects can play.  This allows a collection of different types of objects to be worked on in the same way (w/o "if" statements to check types).  Interfaces also allow needs for multiple inheritance (subclassing multiple superclasses) to be handled in a cleaner, more elegant way.

3. HLD vs LLD is a judgement call.  In general, you go from HLD to LLD when you add in more details to a design. E.g. HLD might stop with some basic relationships and key public methods; LLD would might add in helper classes and some private methods.

HTH, Mark
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 150 total points
ID: 33508141
>>could you exmplain a bit

look at the methods in Object class, they are all needed for each class in one or other context!

HLD, as said highlevel design, it will have limited info on the system as whole. it may talk only high level interfaces, architecture of the app... this will help just understanding the system, less experience programmers may not able to interpret it.

on the other hand LLD will have detailed info on the implementation part( classes and relationship, communication path... etc), can be given to the programmer for coding.
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 75 total points
ID: 33566385
I am not sure what the reason behind "why Object class" has anything to do with HLD and DLD.
Some of the reasons are:
1) It is way by which Java mandates every object in the JVM to expose certain methods and properties, for example, getClass() to get the class of any object, and equals() to check if the current object is equal to a certain object, are those methods which all objects in the JVM is suppose to expose.
2) It is way of saying that objects of all classes in JVM are of TYPE Object.
0
 

Author Comment

by:ganeshaneesh
ID: 33724563
Please close it off.
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 33725835
but have you understood the concept, is your doubt cleared?
0
 

Author Comment

by:ganeshaneesh
ID: 33731883
Actually, my ques is we are not going to use all/few methods of Object class in user class always, though it extends Object class by default. Will not this be a performance hit? What is the key point of extending Object class in user classes?
-Aneesh.
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 33731995
>>Will not this be a performance hit?

what makes you think that?

>>What is the key point of extending Object class in user classes?

as said, methods in Object class are required by all the classes
0
 

Author Comment

by:ganeshaneesh
ID: 33742097
>>what makes you think that?
As I extend a class(default Object class) to my class, though i dont use the methods of its super class, while creating object for my class, it will have the implementions of the Object class also rite? This is a kind of issue with resource utilzation and also access issue(performance overhead) rite?

>>as said, methods in Object class are required by all the classes
Could you tell me why is it(methods of Object class) required?

Aneesh.
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 33742131
>>while creating object for my class, it will have the implementions of the Object class also rite? This is a kind of issue with resource utilzation and also access issue(performance overhead) rite?
>>

no, there is no resource overhead on the additional methods, there will be only if the base class has some attributes/fields for which memory has to be allocated when you creat instance.

>>Could you tell me why is it(methods of Object class) required?

for example, getClass method, every instance of a class should be able to tell what type the instance is
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Read about the ways of improving workplace communication.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Starting up a Project
Suggested Courses

624 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