|
|
|
|
|
by Bahamut
3823 days ago
|
|
Disagree with the DI/IoC comments - for more complex projects, it allows dependencies to be pulled in in a nice terse and readable fashion. Runtime complexity also can be harder to manage, as it often ends up in a spaghetti of knowledge in scattered code. DI isn't a particularly complex construct to grasp. The benefits of mocking are often understated - it is not only to isolate logic, but for longer term maintenance, it is for also easily being able to detect what change breaks what part of the code. When people write more integration tests than unit tests (I have found many developers guilty of this), what often ends up happening is that when someone breaks one of those tests due to having to change behavior of code from new business requirements or maintenance (i.e. abstracting out common behavior), it can become very tricky to untangle what exactly broke, and how to fix it. Not that there isn't value in those types of tests, but without being paired with more controlled unit tests, there is a huge con that hampers productivity of teams. Ideally, one should have the ability to easily mock and make testing each piece painless & clear, so that finding bugs/breaking changes can be made clearly and consciously. Not all tests need to mock, but having that level of control greatly helps on stable & quick iteration of code. |
|