DEV Community

Discussion on: Single Source of Truth

Collapse
 
efpage profile image
Eckehard • Edited

The Principle of Single Source of Truth was a main driver behind the concept of OOP: If a "family" is built upon the same grandparents, the whole family can share some elements. This is a bit like using functions, but functions need data to work on. Classes in OOP form a unity, so they are the "truth".

Some core concepts of the Web make it very hard to build a "single source of truth", as you cannot write a singel code to do all the work. If you build a functional unit in HTML, this will need some changes in CSS, and possibly some Javascript, that fits to your HTML and CSS.

SPOT is not soemthing you do for fun, it can make your life easier. Assume, you have a large codebase and you need to change some really complex element? If things are spread up over a bunch of code elements, you will probably forget to change something. If things are in a single spot, it is far easier. But as mentioned, this is not a core principle of the web...