Single source of truth (SSOT) is a concept used to ensure that everyone in an organization bases business decisions on the same data. Creating a single source of truth is straightforward. To put an SSOT in place, an organization must provide relevant personnel with one source that stores the data points they need.
A quick skim of Google search results won’t shed much light on what exactly is the “single source of truth” — or the SSOT. Wikipedia defines it as, “_the practice of structuring information models and associated data schema such that every data element is mastered in only one place._” If your reaction was along the lines of, “Wait, what?” then you’re not alone. As a software engineering student, when I first heard this term, I thought it sounded more like a line from a Sci-Fi/Fantasy book series than a computer science concept. It was only until I put this into practice when learning about tables and object associations in Ruby, that I understood why this concept is so crucial.
First, it’s important to clarify that SSOT is an overarching computer science term and can be applied towards many languages. I’ll only concentrate on Ruby for purposes of this article. Using an object-oriented programming language, we (aspiring) engineers and developers build objects (or things, whichever is easier to understand) by first considering what the intended use is, and then by how it interacts with different objects.
Ok…can I get an example?
Let’s use a hypothetical situation from Avatar: The Last Airbender, when Zuko (“Lee”) and Uncle Iroh (“Mushi”) open a tea shop in Ba Sing Se.
Please excuse how uneven the arrows are. Images are not my own.
You would build a class called Shopkeeper and create the instances “Lee” and “Mushi”. Think of a class as a template — it wouldn’t be very time efficient to create a class for every individual object. These two shopkeepers own a tea shop, the Jasmine Dragon. The Jasmine Dragon is such a success that they have repeat customers. Likewise, you’d create a class Shop with the instance “Jasmine Dragon” and create the class Customer for their many repeat customers. It doesn’t matter if they have 5, 50, or even 500 customers. The shopkeepers know their customers and vice versa, because the tea shop is what links them. In Ruby, these three classes would each be their individual tables, and the tea shop is the single source of truth. They can interact with each other through this source.
What happens if we expand our number of classes?
Previously on Avatar, Aang and his friends travel to Chin Village where they are shocked to discover that not only is the Avatar not welcome, but in a previous life, Avatar Kyoshi allegedly killed their founder, Chin the Conqueror. Aang tries to make amends with the village but his attempts fail to win them over.
Day 14 of 30. We're going to solve the famous Fibonacci sequence by taking advantage of features that Ruby offers.
Although we still talk about programming as a standalone career, the dominance of technology in our lives makes it clear that coding is much more than a career path. In my opinion, computer science is more than a college major or a high-paid job; it’s a skill, essential for thriving in a modern-day economy. Whether you work in healthcare, marketing, business, or other fields, you will see more coding and have to deal with a growing number of technologies throughout your entire life.
We're going to play a game: find the missing number in a given array. This first solution will be not that great but we'll get the job done!
Day 16 of 30 - Ruby Coding Challenges in 30 Days. We're going to sum all the even numbers in a given Fibonacci sequence.This is the blog post version of the Youtube video from the 30 Ruby Coding Challenges in 30 Days series
Day 17 of 30 - Ruby Coding Challenges in 30 Days. We're going to sum all the even numbers in a given Fibonacci sequence with a better code design.