Skip to content

Javascript basics, hacks, best practices, patterns, utils, philosophy

Notifications You must be signed in to change notification settings

sandeepkumaar/learn-js

Repository files navigation

learn-js

Personal reference to learn and understand the js features with real usecases, tips and tricks, examples

Imperative programming

Imperative programming performs an action/mutation/side-effect.It tells the control flow.

Declarative programming

Expresses the logic of a computation without describing its control flow.

Side Effect

A function or expression is said to have side-effects if it modifies some state variables outside it local environment. The outside environment could be browser, i/o service etc

State variable

Variable capable changing the state of the environment.

Side effects are necessary, because thats how app responds. But how to handle them effectively is what different programming differs

Note:

Object-oriented programming makes code understandable by encapsulating moving parts. Functional programming makes code understandable by minizing the moving parts.

Here moving parts is the side-effects and each paradigm handles them differently

  • Encapsulation (OOP)
  • Separate logic from action (Functional)

Key

Imperative - Encapsulation - Declarative.

Encapsulate Imperative code and hack away the logic in to declarative code to minimize the imperativeness

Ref: Wiki

About

Javascript basics, hacks, best practices, patterns, utils, philosophy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published