문제

Redux is essentially functional programming, and it makes a lot of sense. As I move back to a non-javascript OOP language in a different project I would like to apply the same principles such as single state object, reducers which act on parts of that state, a business layer of semantic actions to modify the state.

My project is in C++ and I want to know if it makes sense to try and apply a functional, redux style approach to designing the application. Performance isn't super critical for this app, but maintainability is.

What difficulties would I face designing my app like this?


I should add that this is not a GUI app. And thinking about that more, maybe redux has reduced benefit in a non GUI application since there isn't some direct visual effect of the application state updating.

도움이 되었습니까?

해결책

Functional styles of programming tend to be somewhat reusable just about anywhere with the right mindset. The general idea of applying paradigms cross languages is what Steve McConnell refers to in Code Complete as "programming into a language". I mostly wanted to point out that the desire to apply lessons learned cross-language and cross-paradigm is truly the mark of someone who sees the language as an expression medium. It is amazing how many developers never reach this point.

As you point out, Redux's philosophy is targeted at UI development. It is hard to envision too many scenarios where the delta tracking of state is useful in non-UI environments. It really depends on your problem, though. If the approach makes the overall solution easier to understand and maintain, then it is probably a good one. The general approach that Redux takes feels a lot like the transaction journal in most RDBMSes, so it may well be true that the approach existed before JavaScript.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 softwareengineering.stackexchange
scroll top