SlideShare a Scribd company logo
TheJSONArchitecture
An architecture pattern for
data driven functional programming
AboutMe
Constantin Dumitrescu, find me as @dumconstantin on
Ask me about: JS, FP, Docker, Automating things, Development
Tools, Radical Management
Projects: ramda-loader, json-patch-utils, baobab-jsoneditor
Presentations so far:
- The Philosophy and Practice of the Pure Function / 5 Feb,
Cluj
- The JSON Architecture / 11 May, Bucharest :)
TheJSONArchitecture
An architecture pattern for data driven functional
programming - what it is, how did it come about, benefits?
Overview
Part1.DataTransformations
DataTransformation
- The single purpose of computer programs is to move
letters and numbers around
- Why should the computer know what “this” is?
- Unfortunately for them, data transformations should be
data-less
- OOP is when data and transformations are joined in
marriage but always argue about separating - it’s
painful, tedious and consumes a lot of resources
PureFunctions
PureFunctions
- Are like atoms (“that which cannot be split”)
- Probably the most boring thing in the universe
- Always prefer curry-flavored functions
- Pure functions know about the entropy of the input data
- Can eliminate racism between programmers
- Have random powers! (like Quickcheck)
- Are reversible if the input types and output types align
- Compose pure functions!
Observables&Streams
Observables&Streams
*from RX Docs
Observables&Streams
- ... are the combination of CPS(continuation-passing
style), Events, Promises, Futures and Channels
- An Observable is an Array with wristwatches instead of
commas:
- Observables are like springs that create a stream
- Flowing data is immutable
- Now is not the time for errors, catch them later
- Time stops when we stream - OMG! Thinking in 5 dimensions
- Streams Pointfree
- Compose streams!
Part2.PersistentDataTree
*from Redux Docs
PersistentDataTree
- Avoids cyclic dependencies between data, one of the by-
product of OOP in Time Driven systems
- Data trees hold the absolute truth!
- The connection between the data nodes are declared in a
single place (the data tree) instead of a myriad of
objects
- The flow of data is obvious and unidirectional
- The state is copied through reference, no memory leaks!
- Same steps, same state - beat that OOP!
EssentialState
EssentialState
- Like essential amino acids, comes from outside the system
- Like collection items, you and label them
precisely. Also, box them and keep them safe!
- Never use Arrays!
- ?!Has no meaning whatsoever for the program, simply put,
it’s just letters and numbers
- The Actors of the Business Domain create the essentials
- Should be identical in shape and color on the Backend, on
the Frontend, in the Database and everywhere
- Keep the essentials, normalize somewhere else
DerivedandAccidentalState
DerivedandAccidentalState
- Derived state is the combination and transformation of
essential state
- Accidental state is what happens when you don’t live in
an ideal world and when you need to keep a journal
- The Derived state controls the program. Demonstration:
a) The program is controlled by “If Statements” decisions b) Decisions are
derived from the truth d) The truth is the essential state e) “If
Statements” use derived states, thus The Derived state controls the
Program
- Remember, you can always derive a derived a derived
state, so compose the derived state!
Cursors
Cursors
- Use them to see from far away
- Kinda like Channels (CSP Communicating Sequential
Processes)
- You don’t care when something happens, but you’re looking
anyway
- Work on Essential, Derived and Accidental states
- Deliver immutable data
- Use them with streams!
- Compose cursors!
DynamicNodes
DynamicNodes
- Suprise! A dynamic node outputs derived state
- They sit in trees!
- Cursors + Pure functions = a dynamic node
- Lazy, never do processing unless requested
- Use events to signal updates
- Fun fact! Most cursors in your application will watch a
dynamic node
- Compose dynamic nodes!
Part3.Effects
The JSON architecture
Effects&SideEffects
- Effects are the reason you wrote the program in the first
place
- A side effect is: “any unintentional and detrimental
consequence”, e.g. an infinite loop!
- An effect begins where the system ends and the outside
world begins
- Mutating state is not a side effect, that’s just an
intentional bad design
- Any output is an effect: 42 - what was the question?
- Effects should be declared in a declarative way
Part5.
TheOverviewonceagain
JSONData&JSONSchema {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"pattern": "^S+@S+$"
}
},
"required": [
"name",
"email"
]
}
},
"required": [
"user"
]
}
{
"user": {
"name": "John Doe",
"email": "john@doe.com"
}
}
JSONPatch&JSONPointer
let patch = [
{"op": "replace", "path": "/user/name", "value": "Jane Roe"},
{"op": "add", "path": "/user/address", "value": "51 Street"},
{"op": "test", "path": "/user/id", "value": 23}
]
let data = { "user": { "name": "John Doe", "id": 23 } }
let data = { "user": { "name": "Jane Roe", "address": "51 Street", "id": 23 } }
Part6:DemoTime
Opportunities&Benefits
- Real separation of concerns:
1) Controller: How it happens
2) Model: That Thing that something happens on
3) (Effects) View: What the world sees
- Pointfree = Stop writing code! = 1000% increase in
stability and whatever is bugging you...
- Portability!!!! Take your code from one language to the
next with minor syntax changes!
- !!! 5 minute project handover !!!
- Open sourced all the way!
Opportunities&Benefits
- Reuse everything between projects!
- Bulletproof testing in isolation
- Client stack traces no longer needed - just gimme the
state.json file!
- When developing the Effects you don’t need data
transformations! Just modify the state tree as you please
- Democratising Software Architecture
- Focus on the business domain rather than on application
bugs
Whatthemanagementneedstosee
- Better productivity = x2, x3, x4 more $$$
- Better quality (SLA anyone?) = x2, x3, x4 more $$$
- Appealing to investors - long term software without code
decay or legacy code issues ($$$)
- Hassle-free project handover internally or by third party
- Learn once - use everywhere - interoperability between
developers & technologies
- Decrease lifecycle costs of software products $$$
Andfinally,
The JSON Architecture is a postulate for making the life of
developer’s happier, less stressful and more fun so that
they can start contributing, and giving back, to what really
matters:
“The goal of programming is to act as a bridge to
reconnect us, reinventing society and making a
true democracy.”
* anonymous quote from the net
ThankYouverymuch!
I hoped for a Jerry Seinfeld and Morgan Freeman combo...
But, if that didn’t happen, you can reach out and I’ll
answer any questions:
dumconstantin@gmail.com
And @dumconstantin on twitter/github/etc

More Related Content

PDF
Egl Rui Ajax World
PDF
The JSON Architecture - BucharestJS / July
PPTX
Functional Augmented State Transfer (FAST) architecture
PPTX
Functional Architecture - goto copenhagen 2012
PDF
Service-Oriented Integration With Apache ServiceMix
PDF
Parquet Strata/Hadoop World, New York 2013
PPTX
HATEOAS 101 - Opinionated Introduction to a REST API Style
PPTX
Why you shouldnt use django for that
Egl Rui Ajax World
The JSON Architecture - BucharestJS / July
Functional Augmented State Transfer (FAST) architecture
Functional Architecture - goto copenhagen 2012
Service-Oriented Integration With Apache ServiceMix
Parquet Strata/Hadoop World, New York 2013
HATEOAS 101 - Opinionated Introduction to a REST API Style
Why you shouldnt use django for that

Similar to The JSON architecture (20)

PDF
Application architecture
PPTX
Domain oriented development
PDF
HLayer / Cloud Native Best Practices
PDF
End-to-end working of Apache Spark
PPTX
Brownfield Domain Driven Design
PDF
Onion (clean) architecture
PPTX
Evolving your api architecture with the strangler pattern
PPTX
Rethinking Best Practices
PPTX
Legacy Lowdown - Options When Migrating Solaris Applications
PDF
Chaos Engineering Without Observability ... Is Just Chaos
PPTX
Analysis Result Manager (ARM)
PPTX
L23 Summary and Conclusions
PPTX
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
PPTX
Software development
PDF
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
PDF
Thinking Functionally
PPTX
"Hints" talk at Walchand College Sangli, March 2017
PDF
Functional Programming with Immutable Data Structures
PPTX
Let's talk about... Microservices
PDF
The Hitchhiker's Guide to Machine Learning with Python & Apache Spark
Application architecture
Domain oriented development
HLayer / Cloud Native Best Practices
End-to-end working of Apache Spark
Brownfield Domain Driven Design
Onion (clean) architecture
Evolving your api architecture with the strangler pattern
Rethinking Best Practices
Legacy Lowdown - Options When Migrating Solaris Applications
Chaos Engineering Without Observability ... Is Just Chaos
Analysis Result Manager (ARM)
L23 Summary and Conclusions
[DSC Europe 23] Igor Ilic - Redefining User Experience with Large Language Mo...
Software development
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Thinking Functionally
"Hints" talk at Walchand College Sangli, March 2017
Functional Programming with Immutable Data Structures
Let's talk about... Microservices
The Hitchhiker's Guide to Machine Learning with Python & Apache Spark
Ad

Recently uploaded (20)

PPT
Ethics in Information System - Management Information System
DOCX
Unit-3 cyber security network security of internet system
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
innovation process that make everything different.pptx
PPTX
Mathew Digital SEO Checklist Guidlines 2025
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
Internet___Basics___Styled_ presentation
PPTX
newyork.pptxirantrafgshenepalchinachinane
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
E -tech empowerment technologies PowerPoint
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Introduction to cybersecurity and digital nettiquette
PPTX
Database Information System - Management Information System
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
artificial intelligence overview of it and more
PPTX
Funds Management Learning Material for Beg
Ethics in Information System - Management Information System
Unit-3 cyber security network security of internet system
Tenda Login Guide: Access Your Router in 5 Easy Steps
innovation process that make everything different.pptx
Mathew Digital SEO Checklist Guidlines 2025
INTERNET------BASICS-------UPDATED PPT PRESENTATION
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
Internet___Basics___Styled_ presentation
newyork.pptxirantrafgshenepalchinachinane
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Exploring VPS Hosting Trends for SMBs in 2025
E -tech empowerment technologies PowerPoint
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
presentation_pfe-universite-molay-seltan.pptx
Introduction to cybersecurity and digital nettiquette
Database Information System - Management Information System
Sims 4 Historia para lo sims 4 para jugar
Unit-1 introduction to cyber security discuss about how to secure a system
artificial intelligence overview of it and more
Funds Management Learning Material for Beg
Ad

The JSON architecture

  • 1. TheJSONArchitecture An architecture pattern for data driven functional programming
  • 2. AboutMe Constantin Dumitrescu, find me as @dumconstantin on Ask me about: JS, FP, Docker, Automating things, Development Tools, Radical Management Projects: ramda-loader, json-patch-utils, baobab-jsoneditor Presentations so far: - The Philosophy and Practice of the Pure Function / 5 Feb, Cluj - The JSON Architecture / 11 May, Bucharest :)
  • 3. TheJSONArchitecture An architecture pattern for data driven functional programming - what it is, how did it come about, benefits?
  • 6. DataTransformation - The single purpose of computer programs is to move letters and numbers around - Why should the computer know what “this” is? - Unfortunately for them, data transformations should be data-less - OOP is when data and transformations are joined in marriage but always argue about separating - it’s painful, tedious and consumes a lot of resources
  • 8. PureFunctions - Are like atoms (“that which cannot be split”) - Probably the most boring thing in the universe - Always prefer curry-flavored functions - Pure functions know about the entropy of the input data - Can eliminate racism between programmers - Have random powers! (like Quickcheck) - Are reversible if the input types and output types align - Compose pure functions!
  • 11. Observables&Streams - ... are the combination of CPS(continuation-passing style), Events, Promises, Futures and Channels - An Observable is an Array with wristwatches instead of commas: - Observables are like springs that create a stream - Flowing data is immutable - Now is not the time for errors, catch them later - Time stops when we stream - OMG! Thinking in 5 dimensions - Streams Pointfree - Compose streams!
  • 13. PersistentDataTree - Avoids cyclic dependencies between data, one of the by- product of OOP in Time Driven systems - Data trees hold the absolute truth! - The connection between the data nodes are declared in a single place (the data tree) instead of a myriad of objects - The flow of data is obvious and unidirectional - The state is copied through reference, no memory leaks! - Same steps, same state - beat that OOP!
  • 15. EssentialState - Like essential amino acids, comes from outside the system - Like collection items, you and label them precisely. Also, box them and keep them safe! - Never use Arrays! - ?!Has no meaning whatsoever for the program, simply put, it’s just letters and numbers - The Actors of the Business Domain create the essentials - Should be identical in shape and color on the Backend, on the Frontend, in the Database and everywhere - Keep the essentials, normalize somewhere else
  • 17. DerivedandAccidentalState - Derived state is the combination and transformation of essential state - Accidental state is what happens when you don’t live in an ideal world and when you need to keep a journal - The Derived state controls the program. Demonstration: a) The program is controlled by “If Statements” decisions b) Decisions are derived from the truth d) The truth is the essential state e) “If Statements” use derived states, thus The Derived state controls the Program - Remember, you can always derive a derived a derived state, so compose the derived state!
  • 19. Cursors - Use them to see from far away - Kinda like Channels (CSP Communicating Sequential Processes) - You don’t care when something happens, but you’re looking anyway - Work on Essential, Derived and Accidental states - Deliver immutable data - Use them with streams! - Compose cursors!
  • 21. DynamicNodes - Suprise! A dynamic node outputs derived state - They sit in trees! - Cursors + Pure functions = a dynamic node - Lazy, never do processing unless requested - Use events to signal updates - Fun fact! Most cursors in your application will watch a dynamic node - Compose dynamic nodes!
  • 24. Effects&SideEffects - Effects are the reason you wrote the program in the first place - A side effect is: “any unintentional and detrimental consequence”, e.g. an infinite loop! - An effect begins where the system ends and the outside world begins - Mutating state is not a side effect, that’s just an intentional bad design - Any output is an effect: 42 - what was the question? - Effects should be declared in a declarative way
  • 27. JSONData&JSONSchema { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "user": { "type": "object", "properties": { "name": { "type": "string" }, "email": { "type": "string", "pattern": "^S+@S+$" } }, "required": [ "name", "email" ] } }, "required": [ "user" ] } { "user": { "name": "John Doe", "email": "john@doe.com" } }
  • 28. JSONPatch&JSONPointer let patch = [ {"op": "replace", "path": "/user/name", "value": "Jane Roe"}, {"op": "add", "path": "/user/address", "value": "51 Street"}, {"op": "test", "path": "/user/id", "value": 23} ] let data = { "user": { "name": "John Doe", "id": 23 } } let data = { "user": { "name": "Jane Roe", "address": "51 Street", "id": 23 } }
  • 30. Opportunities&Benefits - Real separation of concerns: 1) Controller: How it happens 2) Model: That Thing that something happens on 3) (Effects) View: What the world sees - Pointfree = Stop writing code! = 1000% increase in stability and whatever is bugging you... - Portability!!!! Take your code from one language to the next with minor syntax changes! - !!! 5 minute project handover !!! - Open sourced all the way!
  • 31. Opportunities&Benefits - Reuse everything between projects! - Bulletproof testing in isolation - Client stack traces no longer needed - just gimme the state.json file! - When developing the Effects you don’t need data transformations! Just modify the state tree as you please - Democratising Software Architecture - Focus on the business domain rather than on application bugs
  • 32. Whatthemanagementneedstosee - Better productivity = x2, x3, x4 more $$$ - Better quality (SLA anyone?) = x2, x3, x4 more $$$ - Appealing to investors - long term software without code decay or legacy code issues ($$$) - Hassle-free project handover internally or by third party - Learn once - use everywhere - interoperability between developers & technologies - Decrease lifecycle costs of software products $$$
  • 33. Andfinally, The JSON Architecture is a postulate for making the life of developer’s happier, less stressful and more fun so that they can start contributing, and giving back, to what really matters: “The goal of programming is to act as a bridge to reconnect us, reinventing society and making a true democracy.” * anonymous quote from the net
  • 34. ThankYouverymuch! I hoped for a Jerry Seinfeld and Morgan Freeman combo... But, if that didn’t happen, you can reach out and I’ll answer any questions: dumconstantin@gmail.com And @dumconstantin on twitter/github/etc