Well, these types of discussion have been going on for decades:
You have a duck that can both swim and fly. Duck inherits from Bird, so you could add fly and swim to the Bird class. But what about Ostriches which can neither fly nor swim* ?
Here are some options:
A) Add Fly and Swim to the Bird class as virtual methods and override in Orstrich to do nothing.
B) Add Fly and Swim to the Bird class as virtual methods and override in ostrich to throw an exception (making developers check types before calling and breaking polymorphism)
C) Add Fly and Swim to the Bird class and also add CanFly and CanSwim properties to indicate whether these are valid to call.
D) Add IFly and ISwim as interfaces that Duck inherits as well as the Bird base class. (requires developers to perform interface type checking, but can be useful if you need collections of flying or swimming things that may or may not be birds).
E) All of the above. ![]()
Whichever method you choose there are plusses and minises that will only appear when you have started using them. Learn to refactor.
Herbie
* I'm assuming that Ostriches can't swim for the purposes of this argument. I don't actually know whether Ostriches can swim or not. Looks like the PhD in Zoology was a waste of time.
Discussions
-
-
Call me cynical but ...
Perhaps Sophos are trying to boost the popularity of OSX so that it becomes more attractive as a target for virus writers so that the can sell more anti-virus software to Mac users!
Go out there and create a market!
*putting tinfoil hat on*
Herbie
-
Tensor wrote:

Dr Herbie wrote:
Feeling particulary grumpy today for some reason.

Dr Herbie wrote:
Starting to lighten up now.

Dr Herbie wrote:
Ready to skip joyfully through the rest of the day.
Coffee in action.
Tea, actually. Strong sweet tea. Sugar rush .... excuse me, have to make my fourth mug of the morning ...
Herbie
I can give it up any time I like ...
-
sbc wrote:

Dr Herbie wrote: 
W3bbo wrote: 
Dr Herbie wrote:Feeling particulary grumpy today for some reason.
Awww, didn't make the list?
Quality, W3bbo, not quantity
Herbie
Starting to lighten up now.
Your saying W3bbo doesn't do quality posts?
I'm implying that my own posts are of a higher quality.
... and it was a joke. Not a funny joke, but still a joke.
Herbie
Ready to skip joyfully through the rest of the day.
-
W3bbo wrote:

Dr Herbie wrote:Feeling particulary grumpy today for some reason.
Awww, didn't make the list?
Quality, W3bbo, not quantity
Herbie
Starting to lighten up now.
-
Wouldn't worry too much about the terminology, everyone seems to have their own set. Feel free to invent your own. I've never used the expression 'encapsulated behaviour' before, for example.
As long as you get the basic concepts, you'll be fine.
I would say the the setFly, setQuack, quackBehaviour, and flyBehaviours were all virtual, ready to be inherited. If they are abstract, they must be inherited, if they're just virtual they will have a default implementation.
Virtualisation is one way to use polymorphism, and interfaces are another. They both use inheritance.
Importantly, do you understand the purpose of polymorphism? I once saw it explained as a way to simplify code by reducing the number of if statements.
Instead of
if(myitem is type1)
{
(type1)myItem.DoMethod1();
}
else
{
(type2)myItem.DoMethod2();
}
You just get:
myItem.DoPolymorphicMethod();
Don't ever do it the first way, or the OOP police will swoop down and take you away.
I'd rat you out in an instant.
It would be my duty.
I have recently seen professional developers do it the first way. I left that job soon after.
Herbie
-
HumanCompiler wrote:

W3bbo wrote:There is a postcount field in the database, but this isn't shown on the forums, I hear this is because the admins don't want to introduce the "I've got more posts, therefore I'm more important" elitism found on other forums.
Correct...as in...new threads entitled "yippee, my 1000th post, where's my cookie"...yuck...been there, done that...no thanks!
... and finally ...
W3bbo wrote:
w00t
EDIT: What do I get when I reach 10,000? Do I finally get a foam 9Guy?
So what were you saying about not wanting to show this sort of information?
Herbie
Feeling particulary grumpy today for some reason.
-
HumanCompiler wrote:
Think of it this way. When someone is banned, they instantly know they're out and so they do what every good troll does and sign up another account and start posting again. If people just start ignoring them, they don't know when they're being blocked, so at what point will they sign up for another account? That's a major reason why I think an ignore list is overall better (even though it's not perfect).
Makes sense to me.
Could we also have a feature so that each user can see how many posts they have ignored for a given user on their ignore list? It would be nice to see the trolls slowly fading away ... fewer and fewer posts ... until ... eventaully ... *phfffit*...
Herbie
-
I just stumbled onto this page about Conversational Terrorism and recognised a few things from various trolling/flame wars on C9.
I recommend you all read it so that you can troll/flame more effectively.
Alternatively, reply with a link to the page whenever you recognise someone using one of the techniques listed. That would be popular
Herbie
-
Juice is a podcast receiver that seems to download video too. It adds the downloads to a playlist on windows media player too, which is quite handy.
Herbie.