# Code design paradigms

You can tell from my [DEV posts](https://dev.to/johnkazer) that I've chosen a functional (declarative) approach to coding, in contrast to a procedural, object oriented etc. philosophy. I can't claim to be a purist or more than scratching the surface ([Ramda ](https://ramdajs.com/)yes, [FantasyLand ](https://github.com/fantasyland/fantasy-land)not yet...).

A functional approach also enables a powerful paradigm, which focusses on data rather than app constructs. This means that user data, app data and app state (e.g. button status) are all defined as data structures to be transformed by functions. This approach may or may not be in contrast to common architectures enabled by [React](https://reactjs.org/), [Vue ](https://vuejs.org/)etc. using [state and props](/core-web-dev-concepts/app/state.md).

In either case, my approach, React and Vue have a common feature - the virtual DOM (see [later content](/core-web-dev-concepts/hyperapp-and-pug-vdom.md)).

There are many articles and books explaining functional programming and why it's useful (and interesting!). I would say that my approach to FP as practiced in [this repository](https://github.com/johnkazer/hyperapp-xstate-demo) can be considered 'level 1' FP, whilst 'level 2' FP uses more advanced concepts. Here are some materials:

* FP 'level 1' includes immutability, pure functions, map, reduce and related concepts:
  * A game, perhaps a more interesting way to see example code <https://cheesecakelabs.com/blog/functional-programming-game-js/>
  * How FP functions might work <https://medium.com/dailyjs/functional-js-with-es6-recursive-patterns-b7d0813ef9e3>
  * A great book to start with <https://github.com/getify/Functional-Light-JS>
  * A slightly more advanced book <https://github.com/MostlyAdequate/mostly-adequate-guide>
  * And this one too is excellent <https://leanpub.com/javascriptallongesix/read>
  * James Sinclair's blog posts **before** the series "*Things I wish someone had explained to me about functional programming*", in particular the "A g*entle introduction to functional Java*S*cript"* <https://jrsinclair.com/web-development/>
* FP 'level 2' includes algebraic structures, fantasy land and related concepts:
  * A great blog series on web development from a functional JavaScript perspective <https://jrsinclair.com/web-development/> (try his series "*Things I wish someone had explained to me about functional programming*" and also his articles on monads)
  * Fantasy land specification <https://github.com/fantasyland/fantasy-land>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://johnkazer.gitbook.io/core-web-dev-concepts/app/code-design-paradigms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
