The Cartesian coordinate system is not the only way of describing a grid. Another way is the polar coordinate system:
The polar coordinate system is a two-dimensional coordinate system in which we determine each point on the plane by two numbers — the polar angle and the polar radius. The polar coordinate system helps in cases where the relations between points are easier to represent in the form of radii and angles. We can establish such relations only by applying trigonometric equations in more common Cartesian, rectangular, or coordinate systems. (c) Wikipedia
Imagine this situation. We developed a graphic editor like Photoshop and used a library for working with graphic primitives based on the Cartesian coordinate system. At some point, you realize that switching to the polar system will help make everything easier and faster. What price will you have to pay for this change? We have to rewrite almost all the code:
point = {"x": 2, "y": 3}
symmetrical_point = {
"x": -point["x"],
"y": point["y"],
}
It is because your library does not hide the internal structure. Any code that uses points or segments knows how they work inside. It applies to pieces of code that create new primitives and extract the parts from them. It is simple to change the situation and hide the implementation using functions:
point = make_point(3, 4)
symmetrical_point = make_point(-get_x(point), get_y(point))
In the example, we can see three functions: