Skip to main content
deleted 786 characters in body
Source Link
oopexpert
  • 779
  • 4
  • 7

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see thatEither you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operationsencapsulate mutation into an object and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions inlet the application when you cannot escapeobject preserve consistency OR use immutable data structures and represent any new state (time, persistence). That is why nearly every FP language iswith a HYBRIDnew data structure. If you program OOfollow this then you modelcan mix the things as they are. There is no "simulation". There are NO restrictions at all. Things may getting very very complicated with parallelism in OO. But "complicated" does not mean "impossible"paradigms without breaking the paradigm. You cannot always apply pure FP. You sometimes fall back to a hybrid implementation. With OO there is no problem with that.

You should design well and think about it before you decide when to use what. There are benefits and drawbacks on both sides.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation". There are NO restrictions at all. Things may getting very very complicated with parallelism in OO. But "complicated" does not mean "impossible" without breaking the paradigm. You cannot always apply pure FP. You sometimes fall back to a hybrid implementation. With OO there is no problem with that.

You should design well and think about it before you decide when to use what. There are benefits and drawbacks on both sides.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

Either you encapsulate mutation into an object and let the object preserve consistency OR use immutable data structures and represent any new state with a new data structure. If you follow this then you can mix the paradigms without drawbacks.

added 347 characters in body
Source Link
oopexpert
  • 779
  • 4
  • 7

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation". There are NO restrictions at all. Things may getting very very complicated with parallelism in OO. But "complicated" does not mean "impossible" without breaking the paradigm. You cannot always apply pure FP. You sometimes fall back to a hybrid implementation. With OO there is no problem with that.

You should design well and think about it before you decide when to use what. There are benefits and drawbacks on both sides.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation".

You should design well and think about it before you decide when to use what.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation". There are NO restrictions at all. Things may getting very very complicated with parallelism in OO. But "complicated" does not mean "impossible" without breaking the paradigm. You cannot always apply pure FP. You sometimes fall back to a hybrid implementation. With OO there is no problem with that.

You should design well and think about it before you decide when to use what. There are benefits and drawbacks on both sides.

added 303 characters in body
Source Link
oopexpert
  • 779
  • 4
  • 7

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation".

You should design well and think about it before you decide when to use what.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

You should design well and think about it before you decide when to use what.

OO and functional programming are orthogonal concepts. So if you mix them improperly you won't get the best of both but the worst of both.

Mutating structures with functions is the worst you can do. You have side effects AND you don't know who is the responsible for consistency of the structure.

You should also know that OO is the more general concept. That you can see that you cannot continue pure functional programming if persistence comes along. Persistence will not break the OO paradigm. Functional programming is superior most of the time on transient operations and if you have parallelism.

Of course you can simulate the constructs of OO with FP. But for PURE FP there are inherent restrictions in the application when you cannot escape state (time, persistence). That is why nearly every FP language is a HYBRID. If you program OO you model the things as they are. There is no "simulation".

You should design well and think about it before you decide when to use what.

Source Link
oopexpert
  • 779
  • 4
  • 7
Loading