Results 1 to 7 of 7

Thread: Abstraction

  1. #1
    anurag is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default Abstraction

    hey,
    i am unable to understand the practical implementation of Abstraction in Java. Will you please explain and implement Abstraction with a suitable and simple example.

  2. #2
    mchammer11 is offline Member
    Join Date
    Apr 2010
    Posts
    14
    Rep Power
    0

    Default

    See the link below...

    Let me google that for you

  3. #3
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default A simple use for abstract classes

    Abstract classes all share one useless quality:
    They cannot be 'instanciated' into an object.

    You can create an abstract class by placing
    within any class an incomplete method. When you
    do this the compiler will complain that either
    a method has be found that does not implement
    code, and you should either add some code or
    make the class abstract.

    So, you decide to make it asbtract just for kicks.
    We are back at the original question: what good
    is it?

    Here is one purpose.
    An abstract classe is used as a 'blueprint' of the
    type of object someone would like someone else
    to create. Think of it as a management tool
    which informs a programmer how to begin the
    design of an object he is assigned to complete.

    Think also of a team of programmers being assigned
    to work from the same blueprint (extend from the
    same abstract class.) All of these programmers
    will be forced to adopt certain variables and
    methods within the abstract class, bringing a certain
    order to the project and making management happy.

    Some programmers find abstract classes useful
    for organizing their thoughts before commiting
    to specific code.

    Another use for an abstract class on a smaller
    scale is for some who have the forsight to see
    that common parts of several objects can
    be grouped together. For example, an abstract
    class "Animal". All animals can move, eat, reproduce,
    are self-aware, etc. The Animal.class should not
    specify how an animal will move, but it can contain
    X, Y, Z coordinated of its position. Classes extended
    from "Animal" can specify movement methods
    like swim(), fly(), crawl(), etc. to update the
    X, Y, Z values within its abstract core.

    This last example sounds a lot like inheritence.
    I think it is.
    I'll have to remind myself to investigate if there
    is any difference here.
    Last edited by paul pasciak; 05-14-2010 at 11:14 PM.

  4. #4
    anurag is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    a very good explanation..
    so, it means that abstract classes and abstraction(pillar of Java) are same..
    is abstraction is implemented in terms of abstract classes?

  5. #5
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by anurag View Post
    a very good explanation..
    so, it means that abstract classes and abstraction(pillar of Java) are same..
    is abstraction is implemented in terms of abstract classes?
    As far as I understand, abstraction in OOP languages such as Java is a very general concept, and while abstract classes allow for one type of abstraction, they are not equivalent of abstraction nor interchangeable. There are other ways to accomplish abstraction than abstract classes and in fact several types of categories of abstraction possible. Wikipedia has a decent article on this.
    Last edited by curmudgeon; 05-15-2010 at 05:15 AM.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

  7. #7
    paul pasciak is offline Senior Member
    Join Date
    Jul 2008
    Posts
    125
    Rep Power
    0

    Default Abstraction vs. Abstract Class

    I see how a suffix can make a difference.
    Still, I hope I scored much higher than if
    I advised the OP to search Google
    for a "Java Abstract Example."

    EDIT:
    I've just scanned through several sites
    on Abstract vs. Abstraction and found
    almost no difference in the two, But I
    thought the investigation was the
    responsible thing to do.

    Why am I bothering with this edit?

    Because terminology can become
    confusing in Java. For example, "final"
    and "finally" must be approximately the
    same topic in Java right? Wrong, of
    course. Or maybe "Graphic User's Interface"
    might be some form of "Interface," but
    it's not.

    I learned somethings new in my investigation.
    There is always study to be found in the
    details of a subject.

    When I see a request to make a
    topic clear, using plain terms, I think
    some contributors show a lack of
    consideration when advising someone
    to "look it up on Google." Odds are
    they already have, and possibly they
    have found too much information, and
    it all looks very confusing, or they are
    following the wrong leads.

    The educated programmers who review
    this site know, eventually, when
    they are being shnookered into doing
    more work than is neccesary when
    providing help.
    Last edited by paul pasciak; 05-15-2010 at 07:23 PM.

Similar Threads

  1. [SOLVED] Abstraction: Pillar of OOP?
    By leiferouis in forum New To Java
    Replies: 7
    Last Post: 01-31-2009, 08:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •