Jump to content

  • Log In with Google      Sign In   
  • Create Account

Ryan_001

Member Since 23 Apr 2003
Offline Last Active Yesterday, 08:18 PM

Posts I've Made

In Topic: Is there any reason to prefer procedural programming over OOP

24 June 2016 - 10:19 AM

Considering the amount of religious wars fought about what OO really means

...

No, you don't know what you are talking about.

 

My opinion was not that of my own.  I really don't care what its called, OO, procedural, imperative, all these definitions are useless as far as I'm concerned and just hinder things more than help.  Its what my professors and the books we used in school stated (yes I have a degree, no I don't think it matters).  Its a pretty common notion that OO without inheritance isn't 'true' OO.  Whether you agree or disagree, just shutting down dissenting opinions with nothing other than a 'you're wrong I'm right' isn't constructive.  State why OO doesn't need inheritance, or how OO without inheritance is still OO and not just procedural with structs (and I'm not implying those are the only arguments, or good ones at that).  In computer science the 'why' is always far more important that the 'what'.

 

/sigh...

 

and yet in true gamedev fashion yet another interesting conversation is shut down by the standard 'my way is the right way' argument.  I try... I really do try to get these posts to be more than a simple 'do X not Y' type conversation and to get into why we do what we do.  And yet time and time again I am repeatedly shut down for simply attempting a real conversation.  

 

I will refrain from posting in the future...


In Topic: Is there any reason to prefer procedural programming over OOP

23 June 2016 - 12:35 PM

I disagree. I find that in my modern code inheritance plays a very minor role. Polymorphism is used even less frequently. Runtime polymorphism, that is. Compile time polymorphism happens much more frequently.


Just for kicks, take a look how much inheritance or polymorhism is used in the C++ standard library. There are the streams of course but I would be hard pressed to find another inheritance/polymorphism example quickly. Significant parts of the standard library are intentionally inheritance-unfriendly.

Of course in some domains (for example UI frameworks like Qt) you cannot throw a stone without hitting something polymorphic but that is not true for the general case.

 

Lost a long post... :(

 

Long post made short: I'm sure your code is fantastic, but is probably not true OO.

 

C++ is a rather poor OO language, lacking virtual constructors and multi-dispatch (amongst other things).  Its a multi-paradigm language and any good C++ coder (as I'm sure you are having seen prior posts) leverages multiple paradigms in any non-trivial program.  Not using inheritance in C++ simply means you're not trying to use a hammer where a screwdriver would be better.

 

I think the distinction between paradigms and languages is important, as they serve different purposes.


In Topic: Is there any reason to prefer procedural programming over OOP

23 June 2016 - 10:12 AM

It really depends on what you consider OO vs. what you consider Procedural.  I've met people who claim that in order to have OOP, you must have Inheritance, Encapsulation, and Polymorphism.  Basically, in their view, a class without any inheritance (subclass or superclass) isn't actually OOP at all.

 

That's a ridiculously strict definition, but if you follow that, OOP is usually pretty garbage, and you should do most of your code procedurally.  On the other hand, if you see OOP, like I do, as globs of packed data called objects being interacted upon by functions that know how to handle those objects, OOP is actually pretty awesome, and you should do very little of your code procedurally.

 

I think in terms of a definition its not a bad thing.  Inheritance is a very critical part of OO and I would argue without it you're probably not doing OO.  Likewise functional programming with explicit state is really not functional programming.

 

But as far as coding goes, whatever works, don't get bent out of shape over 'strict' definitions.  I've seen extensive OO code done in C, have personally coded a lot of procedural code in java, and done large amounts of pure functional in C++ (the fun of meta-programming with templates, a pure functional language wrapped in the worse syntax imaginable).  A definition and a language serve two completely different purposes.  A language is there to actually get a completed program out and done, where-as a definition is primarily there as proof for papers and to teach concepts.


In Topic: Work queue with condition variable - design issue

15 June 2016 - 12:15 PM

edit: never mind I think there was a mistake in my post (it was older code after all)...


In Topic: Visual Studio 2015 Secretly Inserts Telemetry Code

12 June 2016 - 11:27 AM

So should I not get the VS 2015 update 2?  Wait till 3?  Or is it still lurking around in update 1?


PARTNERS