# Data - Object Anti-Symmetry

Last edited: 2026-01-28

Clean Code

Objects hide their data behind abstractions and expose functions that operate on that data. Data structures expose their data and have no meaningful functions.

When we create objects, we should consider whether this is simply a grouping of data or whether variables will be managed internally and should not be directly accessible to external users.

# Hybrids

In Python Index especially, this distinction might seem more like a spectrum than a strict anti-symmetry. However, occupying a middle ground tends to be bad practice and suggests you may have low Cohesion in your code.

# Procedural Programming vs Object Oriented Programming (OOP)

When we programme in a procedural manner—that is, creating Data structures and using functions to extract features—it is easy to add new functions to all objects. This does not require rewriting any of the data structures but will involve handling the cases for each Data structure . However, this does make it hard to add new Data structures as we will need to modify every function that uses them.

On the other hand using an object oriented paradigm makes it really easy to add new objects - as we can just use Inheritance to define the new object. However, if we want to add a new function to all the objects it means we will need to open up each of the objects.

Whilst in both examples we have to write essentially the same function, just placing it in different parts of the code. In larger applications this can have serious consequences. Not least because as other people use and extend your code you will lose ownership of the changes. Suddenly many changes will break Backwards compatibility . Therefore, when making design decisions early on, think about how your code is likely to be extended before choosing which paradigm to work in.