# Separate code from data

DevFeed: [Separate code from data](<https://devfeed.tech/articles/separate-code-from-data-37569.md>)

Original publisher: [Read original article](<https://blog.klipse.tech/databook/2022/06/22/separate-code-from-data.html>)

Author: Yehonathan Sharvit

Published: 2022-06-22T02:32:24Z

Content type: tutorial

Language: en

Sources: [Klipse](<https://devfeed.tech/sources/klipse.md>)

Topics: [Programming](<https://devfeed.tech/topics/programming.md>), [Object-oriented programming (OOP)](<https://devfeed.tech/topics/oop.md>), [classes](<https://devfeed.tech/topics/classes.md>)

Tags: [behavior](<https://devfeed.tech/tags/behavior.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [d](<https://devfeed.tech/tags/d.md>), [data](<https://devfeed.tech/tags/data.md>), [dop](<https://devfeed.tech/tags/dop.md>), [oop](<https://devfeed.tech/tags/oop.md>), [programming](<https://devfeed.tech/tags/programming.md>)

## AI overview

This article explores the first principle of Data-Oriented Programming: separating code, or behavior, from data. It explains how the principle can be followed or violated in both object-oriented programming and functional programming, including examples involving classes, static methods, and lexical scope.

## Source excerpt

The first principle of Data-Oriented Programming (DOP) is a design principle that recommends a clear separation between code (behavior) and data. This may appear to be a FP principle, but in fact, one can adhere to it or break it either in FP or in OOP: