chapter one

1 Data Oriented Programming

 

This chapter covers

  • Introducing Data-Oriented programming
  • Data as Data
  • How representation affects our programs

This book is about data. It covers what it is, how to think about it, how to represent it in our code, and all the good things that happen when we do. Programs organized around data are simpler, smaller, and, most importantly, easier to understand.

We’ll learn how to model data “as data” in Java. That means representing it as plain values out in the open, liberated from the confines of private instance state. We’ll still use objects, and object-orientation, but at the core of everything will be data.

We focus on data because it lets us temporarily set aside the usual object-oriented questions about “what does it do?” and instead focus on something more fundamental, bordering on philosophical, the question of “what is it?” When we learn to answer that, a powerful style of programming unlocks.

1.1 Objects in a Data Oriented World

Since we’re all Java programmers, it’s worth clearing this up before we go any further: Data-orientation doesn’t mean giving up objects! Data orientation is not some new paradigm here to replace all the others and shame you for ever having used them. Objects are invaluable tools. I’ve tried programming without them in other languages and I always come crawling back.

1.2 The soul of data-oriented programming in a single line

1.3 Show me your data, and the rest will be obvious

1.4 Orienting around data

1.5 Which version of Java do I need?

1.6 How does this book teach?

1.7 Wrapping up

1.8 Summary