3 ms·
The core difference is in testing. With the later, you need to get your class into the right state to preform the test. You might even need a mock or two. With
by djsumdog 7y ago
The core difference is in testing. With the later, you need to get your class into the right state to preform the test. You might even need a mock or two. With the non-OOP approach, you set the entire state of the function and see the results.
- Ididntdothis 7y agoIs that even true? In the end it’s all the same code. You can write classes that need a lot of context but the same can happen with functions.
- jayd16 7y agoIf the method needs just as much state in a struct as you would on a class then its equivalent.
- Double_a_92 7y ago> you set the entire state And how would you easily create that state?
- Ididntdothis 7y agoYou create a mock :)
- aidenn0 7y agoYou are wrong. You need to create just as much state in fooStruct as fooClass in the example GP gives.