• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

abstraction  RSS feed

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is abstraction please explain in detail
why the class have to be abstraction
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want an answer to this u'll have to anser my question first so that we can draw parallels of this to a program
my question is
if you what to buy a car, think of all the features that you would like it to have.
for eg .,, what make do you like or what color etc. Think of every thing and list them
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Today as a beginner I was reading those chapters , and
it says abstract classes are empty methods or functions
which are only declared. U can call a class and mend it
as per ur requirement, such classes are called abstract class.
I hope i am right, if not please correct me, again I am new
to java.so no ridiculing pls.
------------------
 
anis mistry
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok ms purnima i would like
a bmw which has power sterring power windows atleast 2000cc of engine and above 300 bhp of power silver or black color with mag wheels
now please explain abstraction
thankyou
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider:
abtract class Car has empty methods for steer, drive, playRadio, start, etc. and maybe some not empty methods also like slow(), stop() etc.
It is just an abstract definition of all the things that it takes to be a car - kind of like an outline.
Any real car will need to (must) provide an actual implementation for all of the empty methods in order to be considered a car. The real car has the choice of using the not empty methods of the abstract class or over-riding them with type specific methods.
So:
class BMW extends Car - will have to have completed methods for steering etc. (thank goodness) to be a functional car (not just an abstract idea of what a car should be). If even one of the methods is left empty (not implemented) then what you have defined is not quite yet a functional car and therefore must also be declared abstract.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To know the basics of what actually abstraction is try going thruogh the book "Principle of Programming languages " By Horowitz. It will give you the feel of what abstraction is may be it any programming language.
 
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
being confused on this topic too if you create blank methods, do you override them?
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
Brett Knapik
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
never mind, i read cindy's post a little better and got it.
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
purnima das
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry anis that i had to trouble u. let me explain now.
When I asked you what kind of car u would like to buy, you have given me some reqiurements as to what car u want.
Now, that is the point of view for a customer.
u were the customer and u gave me a list. Assume I gave u the car u want (a bmw which has power sterring power windows atleast 2000cc of engine and above 300 bhp of power silver or black color with mag wheels .)
Now the first thing u do is go for a short drive and test for all that u want. u come back to me and say i'll take it.
Now, u as a consumer/customer are satisfied.
so, u dont care how or where the nuts ,bolts,and other parts are placed. all u will bother about is getting the performance and the look that u expected.
this is abstraction from view point of the customer.
suppose, u ordered for a car that has the steering on the left.
Another customer orders for a car that has the steering on the right.
Now, both of u would tell me give me what i want, i dont care how u do it.
ie..,the customer is abstracted from the details as to how the parts are actually joined or where they came from.
I give an order to a small company to manufacture two steerings. This manufacturer need not know whether the steering will be on the left or to the right or who ordered the car.(ie., abstraction from view of manufacturer of steering wheels)
similarly, the mechanic concentrates on his job(eg., painting the body and need not know the brake mechanism of the car)
.(ie., abstraction from view of mechanic)
Hence , there can be levels to abstration.
.............................................................
Another common episode u would come across :
u've got to pay rent.
u'r landlord comes up to u and says:
"beg, borrow, or steal! I dont care how u get the money so long as u pay u'r rent by this evening."
ie., abstraction from the view of the landlord.
.............................................................

the above two lessons indicate that
abstraction is to ignore the finer details.
this helps us to prioritize our needs.
so abstraction helps us to start somewhere while coding.
it heps us to find the broader view and not get boggged down by details.
it hepls us to concentrate in giving the look the customer wanted.(at various levels)
-----------------------------------------------------------
have i cleared the doubt or have i confused u all the more?
 
purnima das
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear mr ramesh kumar
abstract classes are empty methods or functions
which are only declared.
what a grave mistake u have made.
please look thru' u'r definition and ask u'r self can a class be a method?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!