Question about newbies and interfaces

J

Joona I Palaste

Many newbies seem to think that variables, whose type is an interface,
not a class, can't hold references to objects with a concrete
implementation. This is of course not true, but this is not what I am
writing about. If it *were* true, then what point do the newbies think
there would *be* to interfaces at all? I'm curious to hear this.
 
B

Bjorn Abelli

"Joona I Palaste" ...
Many newbies seem to think that variables, whose
type is an interface, not a class, can't hold
references to objects with a concrete implementation.
This is of course not true, but this is not what I am
writing about. If it *were* true, then what point do
the newbies think there would *be* to interfaces at
all? I'm curious to hear this.

1. They come from "predeclarative" environments,
such as C, and use interfaces as .h-files...

2. They confuse interfaces with just
another type of type, i.e. as different to
primitive types or classes, as:

a) They missed the lecture on ADT...
b) They missed the lecture on polymorphism...

3. They're just guessing, and don't have a
clue on what they're doing...

// Bjorn A
 
C

Chris Uppal

Joona said:
Many newbies seem to think that variables, whose type is an interface,
not a class, can't hold references to objects with a concrete
implementation. This is of course not true, but this is not what I am
writing about. If it *were* true, then what point do the newbies think
there would *be* to interfaces at all? I'm curious to hear this.

I can't speak for the newbies in this, but I suspect that part of the answer is
that, for a lot of people, when you are learning a new language (or any skill,
I suppose) you don't *expect* everything to make sense. You are aware that
your knowledge is incomplete, you feel confused about a number of issues, and,
while the sensation of uncertainty may not be very pleasant, you just keep
plugging away, trying get some work done, and hoping that it'll all become
clear in the end.

Not all people can work like that -- some people (e.g. me) can find themselves
paralysed when they don't understand things -- but most programmers are willing
to work by a mixture of guesswork, following examples, and blind hope*. (As
proof of this I submit the existence of the C++ language -- if the only people
who used it were the ones that understood it, then it wouldn't have many
users).

-- chris

[*] I should make it plain that I don't think this is a bad thing -- too many
codebases end up in a state where that's the only way that anyone *can* work,
and being able to function effectively maintaining/extending such messes is a
very useful attribute.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top