It seems there is a lot of discussion on the web about the differences between these two paradigms, and how OOP is somewhat better than structured programming.

But aren't they complementary? From my point of view one could organize his application following OOP principles and implement its logic using structured programming, couldn't he?

  • 3
    OOP builds on Structured Programming, and structured programming principles are still used in OOP methods. So, yes. – Robert Harvey Jun 6 '13 at 1:47

You can argue that OOP builds upon structured programming in general - so yes they are complementary in that sense.

Remember that programming paradigms are mostly about what you don't do:

  • Structured programming removes unconstrained branching and jumping (so that code executes in well-defined structured blocks such as while loops)
  • OOP removes polymorphism via function pointers (instead relying on object methods and virtual dispatch to achieve polymorphism)

You could theoretically conceive of a language that encourages unconstrained branching and jumping but uses objects and OOP-style method dispatch. It would then be OOP but not structured... however it would be a very strange language. I'm not aware of anything like it.

  • 1
    BASIC with labels instead of line numbers :) Oh, wait, that's VB6/VBA. Although you could argue that's really object-based, not object-oriented. – Robert Harvey Jun 6 '13 at 2:02
  • Most of the BASICs I knew never had virtual method dispatch? But yes, it would certainly have that kind of feel.... – mikera Jun 6 '13 at 2:03
  • I think COM had virtual method dispatch. Not sure, though. – Robert Harvey Jun 6 '13 at 2:05
  • 2
    Hmmm Visual Basic and COM... I thought I had blanked that horror from my mind, but now it returns :-) – mikera Jun 6 '13 at 2:07
  • VB6/VBA is a structured language, it does definitely not encourage unconstrained branching. And it supports polymorphism (through dynamic binding), but no inheritance. – Doc Brown Jun 6 '13 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.