|
oh i see what you did.
that's not template specialization. that's method overloading
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
yeah but... it behave quite similarly...
|
|
|
|
|
not really. only in the specific scenario where all you need is method overloading.
and even then it's not the same, because you have two separate classes in your code now instead of one.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
here let me give you an example of where it's not the same
...
FooBase DerivedMethod() {
return BaseMethod()
}
...
FooBase BaseMethod() {
return new FooBase();
}
...
in a specialization there are no base methods, so above would always return the fully derived class
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You shouldn't look at object oriented programming as if you're working with objects. You should look at it objectively.
|
|
|
|
|
i know how to code OO. i just don't like OO because it requires a lot of code to do a little bit.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
When I was growin' up, I was the laziest kid I knew and I knew a lot of people. I'm still one of the laziest devs I know, but I make my deadlines and I know how to code myself out of a job.
Your problem might not be OO, but design patterns that contain more layers than lasagna like MVVM or have dependency injection.
Another issue might be .NET (assuming its what you work in)
I've started playing with python. If you wanted to get stuff done by doing as little as possible as often as possible with maximum results, Python is it.
|
|
|
|
|
In practice I agree with you about python
On principle I refuse to use a language with significant whitespace.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Functional programing even worse.....
But it all started going wrong when we moved away from the abacus!
No one ever hacked my abacus!
Actually not quite true, think someone removed a bead....
|
|
|
|
|
Alan Kay, the father of OOP, says we're doing it all wrong and regrets using the word "object" as it emphasizes the secondary concern of OOP and ignores the primary concern of messaging. Lots of very smart computer scientists say modern OOP makes programming more complex and prone to error rather than simplifying it.
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
i like message/signal based systems but most runtimes don't include some basics that should be "primitives/intrinsics" or otherwise first class, like thread safe priority queues and circular buffers and such. At the very least they should be runtime libraries provided with the base framework.
But I really think if Alan Kay had wanted a message based programming environment it should have been done somewhat differently than OOP.
think something a bit more along lines of parallel programming style constructs and the like, except instead of dealing with iterations of loops you're dealing with signalling.
honestly, it's easy enough to create a domain-specific set of "language extension" style headers in C++ to enable this. I love C++ for that. about 1/3 of the language is the headers and because of the way the preprocessor and template system works you can create your own pseudo language constructs. There's nothing else like it in major programming languages but I really wish their was.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Speaking of Alan Kay and C++...
Quote:
I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind.
-- Alan Kay, OOPSLA '97
If you think 'goto' is evil, try writing an Assembly program without JMP.
|
|
|
|
|
if you're using OOP as your primary paradigm in C++ you're almost certainly Doing It Wrong(TM)
However, C++ is a truly multi-paradigm language and is fully capable of doing OOP programming.
But like I said, if Kay had messaging in mind, OOP probably wasn't the way to go.
You can implement a signal passing psuedo language extension in C++ to elegantly handle messaging passing.
You can implement an OOP system too, but I wouldn't recommend that.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I like object oriented programming.
I view generics as just a limited and difficult-to-type variant of object oriented programming, with a bit of type recursion thrown in so it takes longer to compile.
I've never run into object hierarchies that have the penguin-is-a-kind-of-bird-but-can't-fly problem in practice.
I try to keep object hierarchies I create three layers deep or less. Five for template classes so I can use CRTP.
I've got the visitor pattern if I really need it for aspect-oriented programming.
|
|
|
|
|
that's fair. it sounds like you come from primarily an OO background based on how you view generics.
You're not wrong or anything, i think it's just perspective. When I see a template or a generic i see GP and sometimes AOP potential, with object orientation being secondary because I'm used to looking at things through a C++ lens, and OO just isn't the dominant paradigm there.
I go as deep as I need to and factor on a case by case. I know a lot of people have a lot of hard and fast rules, but I'm a bit more fluid, although I do try to avoid deep hierarchies as a rule.
I'm currently working on a document object model that's deeper than I'd like, but DOMs are kind of their own beast. They're typically nested inheritance-wise to three deep and that's where mine is in 40% of it. The other 60% are Expression elements (binary,unary, etc) so those go deeper.
like i said, case by case for me.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
To be honest it depends on what kind of coding we are talking about. I never did buy entirely into the 'OOP is the cosmos' argument. However, for a coding assignment, whilst a student, I once had to write a C++ app as 'monolithic code'. This was quite a complex database managing app. Later on, we were given a very similar task using OOP in C#. I can honestly say the later was at least two orders of magnitude easier! However, there are many tasks for which OOP is overkill, which is where scripting languages come into their own. Peeps do write complex software in scripting languages, but my preference is for OOP whenever the code starts to exceed a certain complexity. There is a current bakclash against OOP, but in part this is driven by abuses and misunderstandings of OOP. Python, for example, though clearly a powerful language does not support OOP in my opinion, never mind being the 'object-oriented language' some claim it to be. The most central feature to OOP is encapsulation (along with access modifiers). To me this makes a lot of sense. Inheritance is sometimes a useful feature but it is not the most important feature of OOP and I suspect that it is over-used. I don't particularly like OOP that over-uses inheritance or sticks to over-complicated design patterns just to 'look professional'. I do like the way C++ supports OOP but is not itself object-oriented (though I detest the way it 'disembodies' classes). I think of it like this: the real world consists of objects interacting through an interface: to shake somebody's hand you don't need to know how their muscles, nerves and circulatory system works! Nor should you have direct access to these parameters in order to interact with the person! I like OOP because it simulates the real world in so many ways.
|
|
|
|
|
I mean, C# is also easier for a number reasons besides OOP. I can write a purely OOP app in C++ (which I'd only do to prove that it can be done) and it would still be much harder to write than in a garbage collected, managed programming environment like .NET CLI/CLR and C#
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Is HIV just Roman for High Five?
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
H-IV!
You sunk my Nile barge!
|
|
|
|
|
Great! Now to find your Trireme ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
One Roman to another, "Guess how many women I've had sex with."
The other Roman, surprised, "Mmm?"
"Jeez, not that many!"
|
|
|
|
|
I hope your post doesn't go viral!
|
|
|
|
|
Did you create that post with a VI editor?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I guess you had no resistance to that post.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Some of us are immune to his strain of humor.
|
|
|
|