Data-Oriented programming: Liberate yourself from objects

The main lesson that Clojure teaches its developers is to embrace simplicity.

The secret sauce used by Clojure to embrace simplicity is that it treats data as a first-class citizen that is manipulated with generic functions.

In the Clojure community, we call this secret sauce: Data-Oriented programming.

The good news is that this paradigm is in fact language agnostic, meaning that it is applicable in other programming languages, both OOP and FP, both statically and dynamically typed.

In Data-Oriented programming, we follow 3 principles:

  1. We separate our code from our data
  2. We represent data with generic data structures
  3. We never mutate our data

What does it mean in practice for you to adhere to Data-Oriented programming?

  1. You write your code in stateless functions (or static methods)
  2. You represent your data with hash maps and vectors
  3. You use a library that implement efficient immutable data structures

What do you get from that?

In one word: SIMPLICITY!

In a few sentences:

  1. No more complex UML diagrams!
  2. You benefit from dozens of generic data manipulation functions
  3. You can visualize any part of your system, as it is just data
  4. You liberate your mind from concurrency-related issues.

Curious to see how it looks like in a real production system?

Start reading my book Data-Oriented programming.

Here is a 50% off discount code for you: mlsharvit2. Valid until March 15.

The principles of Data-Oriented programming are explored in greater detail here.

Enjoy!

原文链接:Data-Oriented programming: Liberate yourself from objects

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容