Is it prudent to use several paradigms in a C++ project?

Asked

Viewed 112 times

5

Would it be advantageous to use several paradigms in a project in C++? For example, in a certain part of the code I use reactive Programming, in other parts I use OOP, and in other parts I use functional programming. Anyway, is there a problem in doing this? I could come across any problems in the code in the future?

1 answer

7


Knowing what you’re doing is always, not knowing, using one is already a lot :) And people use several of them all the time. It is common for some teams to prohibit certain patterns and partly paradigms in their code base, especially in C++ people tend to work with a subset of language.

Understand that almost all the time you will be programming imperatively, whether you want to or not. Today C++ has a greater ability to be somewhat functional, and many are opting for this form as well, but it is only auxiliary, it can’t even be fully functional, a language can’t have these two paradigms altogether at the same time.

She has several others secondary paradigms, and today the programming goal not only seems to be the strongest, but is the trend. Object orientation is also used, but there are those who preach that its use is avoided. Are putting contracts, events and reactive programming, just to name a few of the secondary.

The problem is not to use together, is to use without understanding what you are doing, then everything can go wrong in the future.

  • 3

    Just to corroborate with the mix of paradigms, where I work coding in Java and we migrate virtually all our iterations of collections to a more functional model. This allowed to see some important points of optimization that we did not see in the imperative model and allowed a lot of cleaning due to poorly made and extrapolated OO-zismos (besides that, aesthetically, it was more beautiful to read and more pleasurable to write). It also served to correct code fault points that went unnoticed, such as operations on immutable objects without saving the return.

  • But we kept the bulk on the imperative model and where we had a "footprint more OO"

  • 1

    "OO-zismos mischievous and extrapolated" is the most there is in the codes around.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.