Solved

Oop Concepts

Posted on 2002-04-30
3
845 Views
Last Modified: 2013-11-23
what is Abstraction  and Encapsulation w.r.t object oriented langauges..and what is the use of implementing these concepts in programming....please explain with some good examples.??

what difference does it makes if we do use and if we do not use the above mentioned concepts in our programming..??
0
Comment
Question by:yrrm
3 Comments
 
LVL 2

Expert Comment

by:CSuvendra
ID: 6979731
0
 
LVL 1

Accepted Solution

by:
googlyralph earned 75 total points
ID: 6979789
Abstraction:

If you want to get from town A to town B, you would get a map. The map doesnt contain absolutly everything (every tree, blade of grass and insect on the way), but it does give you enough information about how to make your journey, ie foot paths and roads. This is abstraction, you "see" enough to do what you need to.

Encapsulation:

Think of black boxes, you cant see whats inside them (nor do oyu want/need to), you just know that by giving that black box X, then Y gets returned. This means that when somehting changes, you can change the internals of a black box, and no other code need no, beacause as long as the inputs and outputs are the same, no one will ever notice. This means that 10 people working on one project can all work on code, and as long as the design was sound, and each black box works in the way it was origianlly designed.

What difference:

The difference is that is how Java was intended to be used. And every Java programmer knows this, and so it makes it easier for several people to work on a project if you are all going about problems in a similar way. I know that at first it seems backwards and stupid, but as you go deeper into the language you start to see good reasons. When you write big system, you find that these approaches do work, so just stick with them.

GR.
0
 
LVL 35

Expert Comment

by:girionis
ID: 6979799
 Take a look at Sun's excellent tutorial on abstraction, polymorphism and encapsulation: http://java.sun.com/docs/books/tutorial/java/concepts/
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

749 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