|
/ravi
|
|
|
|
|
It's a keeper.
|
|
|
|
|
A police chase in New Zealand was stopped when a farmer herded a big flock of sheep across road:
Police chase stopped by flock of sheep[^]
How do we preserve the wisdom men will need,
when their violent passions are spent?
- The Lost Horizon
modified 22-Jan-16 14:05pm.
|
|
|
|
|
Don't let the Australians hear you got NZ and Australia mixed up!
|
|
|
|
|
Aaaargh! Error corrected. Thanks for the heads-up.
How do we preserve the wisdom men will need,
when their violent passions are spent?
- The Lost Horizon
|
|
|
|
|
We've all been there, being screened by someone who doesn't know tech and looking for textbook answers to questions. I'm just curious what some of you guys say about this little jewel of a question.
Q. Can you explain the three major aspects to OOP?
Here's what I usually say, in a very non-textbook way.
A. Polymorphism, basically something taking more than one form as you need it. For instance method overloading in C++.
Inheritance, in C++ the ability to gain functionality of a parent class in a new child class without having to write that functionality yourself.
Encapsulation, the idea behind creating self-contained reusable code that's hopefully loosely coupled with single points of reference to allow you swap in and out objects as needed or use someone else's work without knowing the inner workings of an object.
Curious to see how everyone else does it.
Jeremy Falcon
modified 22-Jan-16 11:53am.
|
|
|
|
|
1) "Sorry, sorry, didn't mean to do that"
2) "No, no - let me clean it up"
3) "Oh gawd, you went and stepped in it "
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Jeremy Falcon
|
|
|
|
|
Please please make OOP syrup. There are too many sick people out there.
Wonde Tadesse
|
|
|
|
|
Yes Sir, OOP I remember this.
This is a very good "tool" to make a construction where you can change only one bit in the very base class to let crash all derived classes.
modified 19-Jan-21 21:04pm.
|
|
|
|
|
... This was point one, and sir rest of the two have exceptions in them.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Jeremy Falcon wrote: three four major aspects to OOP
The fourth one (first one?) - I got to learn from a candidate I was interviewing, Abstraction.
|
|
|
|
|
To me that's closely tied to encapsulation.
Jeremy Falcon
|
|
|
|
|
In C#, I relate it to Inheritance as in the case of abstract classes.
I say, we stick to three aspects!
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Careful... "Aspects", as in AOP, are totally different than OOP.
|
|
|
|
|
Abstraction is closely tied to encapsulation, but different enough from an architectural viewpoint.
Abstraction is the design of the class to be an abstract representation of some real world object (Person, Car, Critter, etc.). That is how the class interface is designed.
Encapsulation is how the implementation is encapsulated within the class, and not exposed.
I can abstractly represent a car as a Car class. The GasPedalPercentage property or the Start function have code behind the interface elements, which is encapsulated within them to abstractly produce their real world counterpart.
I understand that a lot of programmers may, in practice, do abstraction and encapsulation as one. But for me, it helps to use abstraction in the design work, and encapsulation in the implementation coding work.
|
|
|
|
|
No; there are only the three he listed.
|
|
|
|
|
Your answers are all fair, just remove that C++ tag. Object-oriented is not paradigm of C++ only. Anyways, I would change the routine of that list.
- Encapsulation.
- Inheritance
- Polymorphism.
Because the later one (somewhat) depends on the former one.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
What I really want to say to the interviewer is only n00bs use OOP, functional is where it's at. WTF bro.
Yeah, I'm passed the immature epeen phase, I'd just want to see what they'd say.
Jeremy Falcon
|
|
|
|
|
True words, OOP ain't worth it!*
*Says the person who uses C#, Java and C++ only.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
That means that there's a collission if I find another God-object after the interview.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
There can be only one.
Jeremy Falcon
|
|
|
|
|
Polymorphism: the ability to take on the shape of any person, big or small.
Inheritance: the money I got when great aunt Matilda popped her clogs.
Encapsulation: covering oneself in peanut butter and nutella to hide from the boss.
Abstraction: sorry, I wasn't listening to your inane questions...
|
|
|
|
|
R. Giskard Reventlov wrote: Abstraction: sorry, I wasn't listening to your inane questions... Niiiiiice
Jeremy Falcon
|
|
|
|