DEV Community

loading...

Discussion on: A simple way to reduce complexity of Information Systems

Collapse
viebel profile image
Yehonathan Sharvit Author

The DOP approach is to decouple schema validation from data typing.
In other words:

  1. Data is represented as generic data structures (e.g. nested associative arrays)
  2. We define a schema for the important pieces of data as a separate construct (e.g. JSON schema).

The developer is then free to decide what pieces of data should have a schema and what functions should validate their input.

Collapse
jessekphillips profile image
Jesse Phillips • Edited

I think this discrbes a technique I use with json data. I read the json into the library's generic storage, then define types which pull out the data of interest, using the libraries object conversion. It is kind of like network masking where the IP address does not change but I'm only going to look at...

Collapse
dakujem profile image
Andrej Rypo

@viebel The only online references I found on "data oriented programming" are yours :-)

The problem I see with this design is that it seems like just another tradeoff. You trade classes for schema validators. You design immutable structures to mitigate errors and sacrifice performance, as every mutation creates a copy of the previous data.

It reminds me of what happens on every REST API request - you map the xml/json to arrays/objects, then validate the schema, then do stuff with the validated data. I usually map it to internal data structures (DTOs) or ORM classes, depending on use-case. I can't really imagine how I write a schema+validator for every part of my application, every service interacting with the data (services, controllers, background jobs, etc.). I can see flexibility, but I can't see the reduction in complexity mentioned.

Could you point me to some sample code? Prefereably something heavier than a hello-world app.

Also, I can see you mention the paradigm is language-agnostic, but which language do you think would benefit most? (Seeing the tags in this article, would it be Java or JavaScript?)