Our first priority should be to ensure the correctness of our results. Avoiding duplication means writing less code. It is easy to forget to update all copies of duplicated code. The resulting inconsistency makes it very hard to assess the correctness of results. Much more if a section is forgotten.
Assertions represent formal constraints on the behavior of software systems.
They have been recognized as a powerful tool for the detection of runtime faults, and more recently as a permanent defensive mechanism. In practice, assertions often help catch errors at their source, rather than later on when effects of the errors show up. Object oriented programming has many advantages over traditional techniques primarily increased maintainability , reusability , and modifiability . However, we need to be careful of the granularity at which we define objects. The extreme case of using an object for every weight in the network typically incurs a major performance hit.