what is abstraction ?

G

gk

hi,

what is abstraction ?

this is one of the principle of OOPS....right ?

but what it means ?do you have explanation for it ?i need to understand
the meaning in words......no coding here please.


and also does abstraction has any relation with abstract class ?
 
A

Andrew Thompson

gk wrote:
...
what is abstraction ?

this is one of the principle of OOPS....right ?

but what it means ?do you have explanation for it ?i need to understand
the meaning in words......no coding here please.

No worries. No 'coding', just 'hits'.

Andrew T.
 
S

Stefan Ram

gk said:
what is abstraction ?

It means to leave out something.

For example, in Java, abstracting "3" from the expression

2 * 3

gives the method

public static int twice( final int x ){ return x * 3; }

So now, the "2" has been abstracted out of the ... abstraction.
And the abstraction has been "named" (often "abstraction" is
a shorthand for the term "named abstraction").

By naming an abstraction one is lead to the creation of a new concept.

For example, abstracting even the »3«

public static int product( final int x, final int x1 ){ return x * x1; }

yields the concept of multiplication.

Applying an abstraction to arguments yields or expresses something
as in »product( 2, 3 )«.

The abstraction is a means do dissect a text into chunks
so that they can be reused. We abstract the parts that restrict
reuse of something within another context and thus we obtain
a reusable entity, namely the abstraction.

An unnamed abstraction would be the lambda-expression

\x.x·3

where "lambda" was written as "\", but just forget this example,
if you do not know lambda-calculus or read more about it at
Google or Wikipedia.
and also does abstraction has any relation with abstract class ?

The bodies of the methods have been abstracted from such a class.
 
G

gk

Thanks for the mail.

but still i am not clear with your explanation.

you have showed a method which return x*3 when you pass x as a
argument to it.

so, x could be anything x=1,2,4,5, etc ......do you mean as this
method is reusable for any value of x and it will return the
mutiplicative output all the time.....its an example of
abstraction.........is this what you wanted to mean ?


i dont get the idea what you wanted to mean by those example.....how
abstraction is related with that.


However from google search i found "A view of a problem that extracts
the essential information relevant to a particular purpose and ignores
the remainder of the information."

still, its very difficult to percept how and where we use this concept
in programming......i
cant beleve yet that abstract classes are examples of the abstraction
of a class ? is it true ?
 
S

Stefan Ram

gk said:
so, x could be anything x=1,2,4,5, etc ......do you mean as this
method is reusable for any value of x and it will return the
mutiplicative output all the time.....its an example of
abstraction.........is this what you wanted to mean ?

Yes, the value of »x« is left out from the method declaration,
hence, "abstracted".
cant beleve yet that abstract classes are examples of the abstraction
of a class ?

abstraction (i.e., removal) of method bodies.
 
G

gk

you told ............
abstraction (i.e., removal) of method bodies.

ok...so this means when we declare an abstract class ,we declare couple
of abstract methods .....those methods are actually the
abstraction...because we dont put any piece of code threon....its bit
extracted or abstracted or in summarised methods .....and the party who
will use it has to give them the body and have to do their own.

is this all about data abstraction for a class ? its looks simple now.
 
G

gk

and yes, one more thing....i think data abstraction are also exhibited
by java interfaces too......right ? because interfaces are also more
or less similar to abstract classes .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ruby abstraction 16
What is this obfuscation? 1
What is `transaction`event 0
What is Programming? 4
Building my own friend 4
What code is this 2
functional decomposition and abstraction. 10
Look what I found...... 1

Members online

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top