From 87b4fa2abf74c586c19eb2fa2ecba38ef2670964 Mon Sep 17 00:00:00 2001 From: Nishant Painter Date: Fri, 14 Jul 2023 08:08:09 +0530 Subject: [PATCH] Updates --- 404.html | 2 +- 404/index.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 ...f823524d24.js => page-f1a11f58620b0c94.js} | 2 +- about/index.html | 2 +- about/index.txt | 2 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- blogs/functional-programming-arity/index.html | 2 +- blogs/functional-programming-arity/index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../functional-programming-currying/index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 4 +- .../index.txt | 6 +- blogs/index.html | 2 +- blogs/index.txt | 2 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- .../index.html | 2 +- .../index.txt | 4 +- blogs/the-twelve-factor-app/index.html | 2 +- blogs/the-twelve-factor-app/index.txt | 4 +- contact/index.html | 2 +- contact/index.txt | 2 +- index.html | 2 +- index.txt | 2 +- projects/index.html | 2 +- projects/index.txt | 2 +- publications/index.html | 2 +- publications/index.txt | 2 +- sitemap.xml | 62 +++++++++---------- 68 files changed, 123 insertions(+), 123 deletions(-) rename _next/static/{0n5_zcz2RTFdycq49C9tJ => ERVd5qtTCl8tx_BzWHNag}/_buildManifest.js (100%) rename _next/static/{0n5_zcz2RTFdycq49C9tJ => ERVd5qtTCl8tx_BzWHNag}/_ssgManifest.js (100%) rename _next/static/chunks/app/blogs/[slug]/{page-58c72bf823524d24.js => page-f1a11f58620b0c94.js} (96%) diff --git a/404.html b/404.html index b1769e7..d97f245 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/404/index.html b/404/index.html index b1769e7..d97f245 100644 --- a/404/index.html +++ b/404/index.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/_next/static/0n5_zcz2RTFdycq49C9tJ/_buildManifest.js b/_next/static/ERVd5qtTCl8tx_BzWHNag/_buildManifest.js similarity index 100% rename from _next/static/0n5_zcz2RTFdycq49C9tJ/_buildManifest.js rename to _next/static/ERVd5qtTCl8tx_BzWHNag/_buildManifest.js diff --git a/_next/static/0n5_zcz2RTFdycq49C9tJ/_ssgManifest.js b/_next/static/ERVd5qtTCl8tx_BzWHNag/_ssgManifest.js similarity index 100% rename from _next/static/0n5_zcz2RTFdycq49C9tJ/_ssgManifest.js rename to _next/static/ERVd5qtTCl8tx_BzWHNag/_ssgManifest.js diff --git a/_next/static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js b/_next/static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js similarity index 96% rename from _next/static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js rename to _next/static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js index 87724df..7ef2abc 100644 --- a/_next/static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js +++ b/_next/static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[688],{7802:function(e,t,n){Promise.resolve().then(n.t.bind(n,3898,23)),Promise.resolve().then(n.t.bind(n,8423,23)),Promise.resolve().then(n.t.bind(n,2109,23)),Promise.resolve().then(n.t.bind(n,7322,23)),Promise.resolve().then(n.bind(n,6831))},6831:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var i=n(4587),r=n(476),o=n(4382),l=n(8179),s=n(6819),c=n(4124),a=n(9041),u=n(4513),h=n(4100),d=n(6047),m=n(9213),p=n(12),f=n(7113),g=n(6990),x=n(7185);let v=(0,d.ZP)(m.Z)({textDecoration:"none"}),b=e=>{let{content:t}=e,[n,o]=(0,r.useState)(!1),s=(0,r.useRef)(null),c=e=>{var n;(null==s?void 0:s.current)&&clearTimeout(s.current),null==navigator||null===(n=navigator.clipboard)||void 0===n||n.writeText(t),o(!0),s.current=setTimeout(()=>o(!1),5e3)};return(0,r.useEffect)(()=>()=>{(null==s?void 0:s.current)&&clearTimeout(s.current)},[]),(0,i.jsx)(l.Z,{component:p.Z,onClick:c,position:"absolute",top:1,right:1,zIndex:1,color:"inherit",children:(0,i.jsx)(f.Z,{in:!0,children:n?(0,i.jsx)(x.Z,{}):(0,i.jsx)(g.Z,{})},String(n))})},j=e=>{let{children:t,...n}=e,o=(0,r.useRef)(),[s,c]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{var e,t;let n=(null==o?void 0:null===(e=o.current)||void 0===e?void 0:null===(t=e.parentElement)||void 0===t?void 0:t.tagName)==="PRE";n&&c(!0)},[]),(0,i.jsxs)(l.Z,{component:"code",position:"relative",...n,ref:o,children:[t,s&&(0,i.jsx)(b,{content:t})]})},Z=["h1","h2","h3","h4","h5","h6","p","small"].reduce((e,t)=>({...e,[t]:{component:l.Z,props:{component:t}}}),{}),k={pre:{component:l.Z,props:{borderRadius:"8px",component:"pre"}},code:{component:j}},w=e=>{let{src:t,alt:n,caption:r}=e;return(0,i.jsxs)(l.Z,{component:"figure",display:"flex",flexDirection:"column",alignItems:"center",children:[(0,i.jsx)(l.Z,{src:t,alt:n,component:"img",display:"block",boxShadow:5,sx:{borderRadius:12},maxWidth:"100%",height:"auto"}),(0,i.jsx)(c.Z,{mt:1,component:"figcaption",variant:"caption",children:r})]})},y={...Z,a:{component:v,props:{color:"primary"}},...k,Figure:{component:w}},C={overrides:y};function P(e){let{markdown:t}=e;return(0,i.jsx)(h.Z,{options:C,children:t})}var R=n(193),T=n(1935);function E(e){let{blog:t}=e,n=(0,o.useRouter)(),{isDarkMode:h}=(0,u.useThemeContext)(),d=(e,t)=>{e.stopPropagation(),n.push("/blogs/?search=".concat(t))};return(0,r.useEffect)(()=>{R.Z.highlightAll()},[]),(0,i.jsx)(l.Z,{component:s.Z,fixed:!0,minHeight:"100%",children:(0,i.jsxs)(l.Z,{component:"main",display:"flex",flexDirection:"column",rowGap:2,pt:5,pb:2,children:[(0,i.jsx)(c.Z,{variant:"h4",component:"h1",children:(0,i.jsx)("b",{children:t.title})}),(0,i.jsx)(a.Rj,{items:t.categories,onClick:d,darkMode:h}),(0,i.jsx)(P,{markdown:t.content})]})})}n(4436),R.Z.registerLanguage("javascript",T.Z)},9041:function(e,t,n){"use strict";n.d(t,{Rj:function(){return c},TR:function(){return p},I_:function(){return d}});var i=n(4587);n(476);var r=n(7730),o=n(8179),l=n(6953);let s=Object.values(l);function c(e){let{items:t=[],colorful:n=!0,onClick:l,darkMode:c}=e,a=e=>{if(!n)return{};let t=function(e){if(!e)return;let t=0;for(let n=0;n(0,i.jsx)(r.Z,{clickable:!0,label:e,onClick:t=>null==l?void 0:l(t,e),color:"default",...a(e)},e))})}var a=n(2215),u=n.n(a);let h={sm:{height:25,width:25},md:{height:35,width:35}};function d(e){let{size:t="sm",darkMode:n,...r}=e;return(0,i.jsx)(o.Z,{display:"flex",columnGap:1,...r,children:[{title:"Github",href:"https://github.com/nishantpainter",alt:"Image for social site github",img:"/img/social/".concat(n?"github-white":"github",".svg")},{title:"Linkedin",href:"https://in.linkedin.com/in/nishant-painter-31388582",alt:"Image for social site linkedin",img:"/img/social/".concat(n?"linkedin-white":"linkedin",".svg")},{title:"Stackoverflow",href:"https://stackoverflow.com/users/13841339/nishant-painter",alt:"Image for social site stackoverflow",img:"/img/social/".concat(n?"so-white":"so",".svg")},{title:"Medium",href:"https://medium.com/@nishantpainter",alt:"Image for social site medium",img:"/img/social/".concat(n?"medium-white":"medium",".svg")}].map(e=>{let{href:n,title:r,alt:o,img:l}=e;return(0,i.jsx)("a",{href:n,title:r,target:"_blank",children:(0,i.jsx)(u(),{...h[t],src:l,alt:o})},n)})})}var m=n(4124);function p(e){let{darkMode:t}=e;return(0,i.jsx)(o.Z,{p:.5,border:"3px solid ".concat(t?"white":"black"),borderRadius:1,children:(0,i.jsx)(m.Z,{variant:"h5",letterSpacing:-.3,children:(0,i.jsx)("b",{children:"NP"})})})}},4513:function(e,t,n){"use strict";n.r(t),n.d(t,{Theme:function(){return h},inter:function(){return o.a},useThemeContext:function(){return d}});var i=n(4587),r=n(2891),o=n.n(r),l=n(476),s=n(7979),c=n(7766),a=n(3675);let u=(0,l.createContext)({}),h=e=>{let{children:t}=e,[n,r]=(0,l.useState)("light"),h=(0,l.useCallback)(()=>{r(e=>"light"===e?"dark":"light")},[]),d=(0,s.Z)({palette:{mode:n},typography:{fontFamily:o().style.fontFamily},components:{MuiToolbar:{styleOverrides:{root:{height:60}}}}}),m=(0,l.useMemo)(()=>({mode:n,isDarkMode:"dark"===n,toggleMode:h}),[n,h]);return(0,i.jsx)(u.Provider,{value:m,children:(0,i.jsxs)(c.Z,{theme:d,children:[(0,i.jsx)(a.ZP,{}),t]})})},d=()=>(0,l.useContext)(u);t.default=h}},function(e){e.O(0,[519,49,215,861,17,1,802,664,744],function(){return e(e.s=7802)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[688],{8682:function(e,t,n){Promise.resolve().then(n.t.bind(n,3898,23)),Promise.resolve().then(n.t.bind(n,8423,23)),Promise.resolve().then(n.t.bind(n,7322,23)),Promise.resolve().then(n.t.bind(n,2109,23)),Promise.resolve().then(n.bind(n,6831))},6831:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return E}});var i=n(4587),r=n(476),o=n(4382),l=n(8179),s=n(6819),c=n(4124),a=n(9041),u=n(4513),h=n(4100),d=n(6047),m=n(9213),p=n(12),f=n(7113),g=n(6990),x=n(7185);let v=(0,d.ZP)(m.Z)({textDecoration:"none"}),b=e=>{let{content:t}=e,[n,o]=(0,r.useState)(!1),s=(0,r.useRef)(null),c=e=>{var n;(null==s?void 0:s.current)&&clearTimeout(s.current),null==navigator||null===(n=navigator.clipboard)||void 0===n||n.writeText(t),o(!0),s.current=setTimeout(()=>o(!1),5e3)};return(0,r.useEffect)(()=>()=>{(null==s?void 0:s.current)&&clearTimeout(s.current)},[]),(0,i.jsx)(l.Z,{component:p.Z,onClick:c,position:"absolute",top:1,right:1,zIndex:1,color:"inherit",children:(0,i.jsx)(f.Z,{in:!0,children:n?(0,i.jsx)(x.Z,{}):(0,i.jsx)(g.Z,{})},String(n))})},j=e=>{let{children:t,...n}=e,o=(0,r.useRef)(),[s,c]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{var e,t;let n=(null==o?void 0:null===(e=o.current)||void 0===e?void 0:null===(t=e.parentElement)||void 0===t?void 0:t.tagName)==="PRE";n&&c(!0)},[]),(0,i.jsxs)(l.Z,{component:"code",position:"relative",...n,ref:o,children:[t,s&&(0,i.jsx)(b,{content:t})]})},Z=["h1","h2","h3","h4","h5","h6","p","small"].reduce((e,t)=>({...e,[t]:{component:l.Z,props:{component:t}}}),{}),k={pre:{component:l.Z,props:{borderRadius:"8px",component:"pre"}},code:{component:j}},w=e=>{let{src:t,alt:n,caption:r}=e;return(0,i.jsxs)(l.Z,{component:"figure",display:"flex",flexDirection:"column",alignItems:"center",children:[(0,i.jsx)(l.Z,{src:t,alt:n,component:"img",display:"block",boxShadow:5,sx:{borderRadius:12},maxWidth:"100%",height:"auto"}),(0,i.jsx)(c.Z,{mt:1,component:"figcaption",variant:"caption",children:r})]})},y={...Z,a:{component:v,props:{color:"primary"}},...k,Figure:{component:w}},C={overrides:y};function P(e){let{markdown:t}=e;return(0,i.jsx)(h.Z,{options:C,children:t})}var R=n(193),T=n(1935);function E(e){let{blog:t}=e,n=(0,o.useRouter)(),{isDarkMode:h}=(0,u.useThemeContext)(),d=(e,t)=>{e.stopPropagation(),n.push("/blogs/?search=".concat(t))};return(0,r.useEffect)(()=>{R.Z.highlightAll()},[]),(0,i.jsx)(l.Z,{component:s.Z,fixed:!0,minHeight:"100%",children:(0,i.jsxs)(l.Z,{component:"main",display:"flex",flexDirection:"column",rowGap:2,pt:5,pb:2,children:[(0,i.jsx)(c.Z,{variant:"h4",component:"h1",children:(0,i.jsx)("b",{children:t.title})}),(0,i.jsx)(a.Rj,{items:t.categories,onClick:d,darkMode:h}),(0,i.jsx)(P,{markdown:t.content})]})})}n(4436),R.Z.registerLanguage("javascript",T.Z)},9041:function(e,t,n){"use strict";n.d(t,{Rj:function(){return c},TR:function(){return p},I_:function(){return d}});var i=n(4587);n(476);var r=n(7730),o=n(8179),l=n(6953);let s=Object.values(l);function c(e){let{items:t=[],colorful:n=!0,onClick:l,darkMode:c}=e,a=e=>{if(!n)return{};let t=function(e){if(!e)return;let t=0;for(let n=0;n(0,i.jsx)(r.Z,{clickable:!0,label:e,onClick:t=>null==l?void 0:l(t,e),color:"default",...a(e)},e))})}var a=n(2215),u=n.n(a);let h={sm:{height:25,width:25},md:{height:35,width:35}};function d(e){let{size:t="sm",darkMode:n,...r}=e;return(0,i.jsx)(o.Z,{display:"flex",columnGap:1,...r,children:[{title:"Github",href:"https://github.com/nishantpainter",alt:"Image for social site github",img:"/img/social/".concat(n?"github-white":"github",".svg")},{title:"Linkedin",href:"https://in.linkedin.com/in/nishant-painter-31388582",alt:"Image for social site linkedin",img:"/img/social/".concat(n?"linkedin-white":"linkedin",".svg")},{title:"Stackoverflow",href:"https://stackoverflow.com/users/13841339/nishant-painter",alt:"Image for social site stackoverflow",img:"/img/social/".concat(n?"so-white":"so",".svg")},{title:"Medium",href:"https://medium.com/@nishantpainter",alt:"Image for social site medium",img:"/img/social/".concat(n?"medium-white":"medium",".svg")}].map(e=>{let{href:n,title:r,alt:o,img:l}=e;return(0,i.jsx)("a",{href:n,title:r,target:"_blank",children:(0,i.jsx)(u(),{...h[t],src:l,alt:o})},n)})})}var m=n(4124);function p(e){let{darkMode:t}=e;return(0,i.jsx)(o.Z,{p:.5,border:"3px solid ".concat(t?"white":"black"),borderRadius:1,children:(0,i.jsx)(m.Z,{variant:"h5",letterSpacing:-.3,children:(0,i.jsx)("b",{children:"NP"})})})}},4513:function(e,t,n){"use strict";n.r(t),n.d(t,{Theme:function(){return h},inter:function(){return o.a},useThemeContext:function(){return d}});var i=n(4587),r=n(2891),o=n.n(r),l=n(476),s=n(7979),c=n(7766),a=n(3675);let u=(0,l.createContext)({}),h=e=>{let{children:t}=e,[n,r]=(0,l.useState)("light"),h=(0,l.useCallback)(()=>{r(e=>"light"===e?"dark":"light")},[]),d=(0,s.Z)({palette:{mode:n},typography:{fontFamily:o().style.fontFamily},components:{MuiToolbar:{styleOverrides:{root:{height:60}}}}}),m=(0,l.useMemo)(()=>({mode:n,isDarkMode:"dark"===n,toggleMode:h}),[n,h]);return(0,i.jsx)(u.Provider,{value:m,children:(0,i.jsxs)(c.Z,{theme:d,children:[(0,i.jsx)(a.ZP,{}),t]})})},d=()=>(0,l.useContext)(u);t.default=h}},function(e){e.O(0,[519,49,215,861,17,1,802,664,744],function(){return e(e.s=8682)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/about/index.html b/about/index.html index 32cd84e..091a1d9 100644 --- a/about/index.html +++ b/about/index.html @@ -1 +1 @@ -About | Nishant Painter
NP

About

A dedicated and competent full stack software engineer with years of experience in various application development. Detail oriented and organised lead developer with creative mindset and strong project management abilities. Leader of cross-functional teams adhering to quality output and best practices. An overall impeccable academic record consisting of double gold medal in both graduation and post graduation, university topper.


Experience
  • AxelorTech lead 
    ( Apr 2021 - Current Date )

    Surat, Gujarat, India

  • AxelorSr. System Engineer 
    ( Feb 2018 - Mar 2021 )

    Surat, Gujarat, India

  • VidillionDeveloper 
    ( Jan 2017 - Nov 2017 )

    Surat, Gujarat, India


Technologies and Tools
HTML
CSS
JavaScript
TypeScript
SQL
PostgresSQL
NOSQL
MongoDB
NodeJS
Socket
Docker
GIT
React
NextJS
Remix
Express
NestJS
REST
Loopback
Swagger
Firebase
AppScript

Education
  • Master of Engineering CGPA 9.69 
    ( Sep 2014 - Jul 2016 )

    SCET, Surat, Gujarat, India

  • Bachelor of Engineering CGPA 9.19 
    ( Sep 2009 - Jun 2013 )

    SCET, Surat, Gujarat, India


Awards and Achievements
  • Gold Medal - Master of Engineering
    ( University Topper - All Engineering Streams )

    Gujarat Technological University

  • Gold Medal - Master of Engineering
    ( University Topper - Computer Engineering )

    Gujarat Technological University

  • Gold Medal - Bachelor of Engineering
    ( Institute Topper - All Engineering Streams )

    SCET

  • Gold Medal - Bachelor of Engineering
    ( Institute Topper - Computer Engineering )

    SCET

  • Shri Dewant Mehta IT Awards

    NASSCOM - Certificate of Excellence


Publications
  • Machine-Learning-Based Android Malware Detection Techniques—A Comparative Analysis
    Link

    SPRINGER LNNS book series

  • Comparative Analysis of Android Malware Detection Techniques
    Link

    SPRINGER AISC book series

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +About | Nishant Painter
NP

About

A dedicated and competent full stack software engineer with years of experience in various application development. Detail oriented and organised lead developer with creative mindset and strong project management abilities. Leader of cross-functional teams adhering to quality output and best practices. An overall impeccable academic record consisting of double gold medal in both graduation and post graduation, university topper.


Experience
  • AxelorTech lead 
    ( Apr 2021 - Current Date )

    Surat, Gujarat, India

  • AxelorSr. System Engineer 
    ( Feb 2018 - Mar 2021 )

    Surat, Gujarat, India

  • VidillionDeveloper 
    ( Jan 2017 - Nov 2017 )

    Surat, Gujarat, India


Technologies and Tools
HTML
CSS
JavaScript
TypeScript
SQL
PostgresSQL
NOSQL
MongoDB
NodeJS
Socket
Docker
GIT
React
NextJS
Remix
Express
NestJS
REST
Loopback
Swagger
Firebase
AppScript

Education
  • Master of Engineering CGPA 9.69 
    ( Sep 2014 - Jul 2016 )

    SCET, Surat, Gujarat, India

  • Bachelor of Engineering CGPA 9.19 
    ( Sep 2009 - Jun 2013 )

    SCET, Surat, Gujarat, India


Awards and Achievements
  • Gold Medal - Master of Engineering
    ( University Topper - All Engineering Streams )

    Gujarat Technological University

  • Gold Medal - Master of Engineering
    ( University Topper - Computer Engineering )

    Gujarat Technological University

  • Gold Medal - Bachelor of Engineering
    ( Institute Topper - All Engineering Streams )

    SCET

  • Gold Medal - Bachelor of Engineering
    ( Institute Topper - Computer Engineering )

    SCET

  • Shri Dewant Mehta IT Awards

    NASSCOM - Certificate of Excellence


Publications
  • Machine-Learning-Based Android Malware Detection Techniques—A Comparative Analysis
    Link

    SPRINGER LNNS book series

  • Comparative Analysis of Android Malware Detection Techniques
    Link

    SPRINGER AISC book series

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/about/index.txt b/about/index.txt index 9e8e84a..ef78024 100644 --- a/about/index.txt +++ b/about/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["about",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/blogs/design-patterns-how-to-write-a-design-pattern/index.html b/blogs/design-patterns-how-to-write-a-design-pattern/index.html index 986c75d..d070fbd 100644 --- a/blogs/design-patterns-how-to-write-a-design-pattern/index.html +++ b/blogs/design-patterns-how-to-write-a-design-pattern/index.html @@ -1,2 +1,2 @@ Design Patterns - How to write a design pattern
NP

Design Patterns - How to write a design pattern

Programming
Design Patterns

How to write a Design Pattern

A pattern is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the natural process of pattern formation, -elements of a pattern and general guidelines.

Prior to writing a design pattern, an individual should get familiar with existing patterns descriptions and grasp their underlying features. The structure and semantic of available patterns should be carefully understood, on the basis of its interaction and context, thereby deriving the principles that aid in assembling patterns for different arrangements. Thereafter, one can decide upon creating a new pattern or improving an existing pattern.

In writing a design pattern, it is essential to consider that it is a design which is being abstracted from a specific solution and found to be applicable to a number of other solutions. Given a solution, a creator must extract the design beneath and record it in general terms which has wider applicability.

It should also be noted while writing a pattern that a body of code that simply follows good principles and design practices must not be considered as a pattern. A pattern, apart from involving aforementioned characteristics, must also involve interaction and set of defined rules.

Natural process of pattern formation

The process of creating new patterns, most of the time, is associated with discovery rather than creation. As discussed, designs approximated by having a wider range of applicability instead of specific implementation are noted in general terms thereby forming a pattern. An author who registers design in this manner is often called a pattern discoverer or describer. Rarely does an author devise a completely new solution for a given problem, codify it in general terms and get credited as an author or creator of the new pattern.

Moreover, implementation and design appear before identifying it as a pattern. They are accepted as a proven solution to a problem before getting recorded in general description and considered as a pattern. Hence, as a natural process the creator should keenly observe solutions available in the wild, estimate their wider use and qualify them as a pattern.

Elements of a pattern

It is of critical importance to understand the fundamental elements of a pattern before writing a new or improving an existing one. These factors include problem, solution, context and examples.

Problem Statement

Patterns should provide answers for common problems or repeated problems occurring in designing software. A problem statement should clearly and unambiguously define the issue a pattern is trying to solve.

Solution Statement

This statement explains how a given problem is solved using a pattern. It is a set of steps and assumptions that provide solutions to underlying issues. This must be a tried and tested solution, instead of speculations, and should be reliable.

Context

Context or scope is a description that defines the area within which a pattern is successful in solving the issue. It sometimes also defines the area where the pattern is not useful.

Example

Patterns must provide examples of its design and implementation. The example should cover broad usage and properly describe the good design principle of the pattern.

General guidelines

Writing a design pattern should capture all the essential elements of the pattern along with providing the end user with sufficient information about using the pattern. Certain guidelines which can be helpful in writing pattern is as follows :

  • User-centric : Pattern should not alter or force change in the behaviour of the user adapting it. It must cover what user already perceives and understands.

  • Experience agnostic : Pattern should be transparent and favourable to users of any experience level.

  • Practicality : Patterns should produce result by describing proven solution instead of providing speculating solution.

  • Best practice and principles : Design must be decided based on the principles derived from incorporating best practices.

  • Strong examples : A pattern must showcase a broad range of examples to support various use-cases. It should describe good practices and principles while showing pattern usage.

  • Discovery over creativity : Identify the wider application of existing solutions in the wild instead of creating new pattern.

  • Originality is not the key : It’s fine to not be the original discoverer of a pattern, even though a pattern has minor overlapping with existing pattern it can be accepted based upon its broad usage.

  • Patterns can be derived : Various patterns can be combined to create a new pattern. The configuration of mixing must be carefully decided by the creator.

Conclusion

Writing a pattern is balancing between creating a design which is general as well as specific. The pattern should be general enough to cover a wide range of applications along with being specific in ensuring that all it’s design principles are enclosed within its implementation.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +elements of a pattern and general guidelines.

Prior to writing a design pattern, an individual should get familiar with existing patterns descriptions and grasp their underlying features. The structure and semantic of available patterns should be carefully understood, on the basis of its interaction and context, thereby deriving the principles that aid in assembling patterns for different arrangements. Thereafter, one can decide upon creating a new pattern or improving an existing pattern.

In writing a design pattern, it is essential to consider that it is a design which is being abstracted from a specific solution and found to be applicable to a number of other solutions. Given a solution, a creator must extract the design beneath and record it in general terms which has wider applicability.

It should also be noted while writing a pattern that a body of code that simply follows good principles and design practices must not be considered as a pattern. A pattern, apart from involving aforementioned characteristics, must also involve interaction and set of defined rules.

Natural process of pattern formation

The process of creating new patterns, most of the time, is associated with discovery rather than creation. As discussed, designs approximated by having a wider range of applicability instead of specific implementation are noted in general terms thereby forming a pattern. An author who registers design in this manner is often called a pattern discoverer or describer. Rarely does an author devise a completely new solution for a given problem, codify it in general terms and get credited as an author or creator of the new pattern.

Moreover, implementation and design appear before identifying it as a pattern. They are accepted as a proven solution to a problem before getting recorded in general description and considered as a pattern. Hence, as a natural process the creator should keenly observe solutions available in the wild, estimate their wider use and qualify them as a pattern.

Elements of a pattern

It is of critical importance to understand the fundamental elements of a pattern before writing a new or improving an existing one. These factors include problem, solution, context and examples.

Problem Statement

Patterns should provide answers for common problems or repeated problems occurring in designing software. A problem statement should clearly and unambiguously define the issue a pattern is trying to solve.

Solution Statement

This statement explains how a given problem is solved using a pattern. It is a set of steps and assumptions that provide solutions to underlying issues. This must be a tried and tested solution, instead of speculations, and should be reliable.

Context

Context or scope is a description that defines the area within which a pattern is successful in solving the issue. It sometimes also defines the area where the pattern is not useful.

Example

Patterns must provide examples of its design and implementation. The example should cover broad usage and properly describe the good design principle of the pattern.

General guidelines

Writing a design pattern should capture all the essential elements of the pattern along with providing the end user with sufficient information about using the pattern. Certain guidelines which can be helpful in writing pattern is as follows :

  • User-centric : Pattern should not alter or force change in the behaviour of the user adapting it. It must cover what user already perceives and understands.

  • Experience agnostic : Pattern should be transparent and favourable to users of any experience level.

  • Practicality : Patterns should produce result by describing proven solution instead of providing speculating solution.

  • Best practice and principles : Design must be decided based on the principles derived from incorporating best practices.

  • Strong examples : A pattern must showcase a broad range of examples to support various use-cases. It should describe good practices and principles while showing pattern usage.

  • Discovery over creativity : Identify the wider application of existing solutions in the wild instead of creating new pattern.

  • Originality is not the key : It’s fine to not be the original discoverer of a pattern, even though a pattern has minor overlapping with existing pattern it can be accepted based upon its broad usage.

  • Patterns can be derived : Various patterns can be combined to create a new pattern. The configuration of mixing must be carefully decided by the creator.

Conclusion

Writing a pattern is balancing between creating a design which is general as well as specific. The pattern should be general enough to cover a wide range of applications along with being specific in ensuring that all it’s design principles are enclosed within its implementation.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/design-patterns-how-to-write-a-design-pattern/index.txt b/blogs/design-patterns-how-to-write-a-design-pattern/index.txt index d472383..70722e7 100644 --- a/blogs/design-patterns-how-to-write-a-design-pattern/index.txt +++ b/blogs/design-patterns-how-to-write-a-design-pattern/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","design-patterns-how-to-write-a-design-pattern","d"],{"children":["__PAGE__?{\"slug\":\"design-patterns-how-to-write-a-design-pattern\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","design-patterns-how-to-write-a-design-pattern","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"design-patterns-how-to-write-a-design-pattern\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","design-patterns-how-to-write-a-design-pattern","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Design Patterns - How to write a design pattern"}],["$","meta",null,{"name":"description","content":"A design pattern is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the natural process of pattern formation,elements of a pattern and general guidelines."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Design Patterns - How to write a design pattern"}],["$","meta",null,{"property":"og:description","content":"A design pattern is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the natural process of pattern formation,elements of a pattern and general guidelines."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/design-patterns-how-to-write-a-design-pattern"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/design-patterns-how-to-write-a-design-pattern.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Design Patterns - How to write a design pattern"}],["$","meta",null,{"name":"twitter:description","content":"A design pattern is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the natural process of pattern formation,elements of a pattern and general guidelines."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/design-patterns-how-to-write-a-design-pattern.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Design Patterns - How to write a design pattern","date":"$D2021-09-21T00:00:00.000Z","content":"\n## How to write a Design Pattern\n\nA [pattern](/blogs/design-patterns-what-are-design-patterns) is a proven solution to a commonly occurring problem in software design. Writing a design pattern is a critical task and demands considering various vital aspects such as the _natural process of pattern formation_,\n_elements of a pattern_ and _general guidelines_.\n\nPrior to writing a design pattern, an individual should get familiar with existing patterns descriptions and grasp their underlying features. The structure and semantic of available patterns should be carefully understood, on the basis of its interaction and context, thereby deriving the principles that aid in assembling patterns for different arrangements. Thereafter, one can decide upon creating a new pattern or improving an existing pattern.\n\nIn writing a design pattern, it is essential to consider that it is a _design_ which is being abstracted from a specific solution and found to be applicable to a number of other solutions. Given a solution, a creator must extract the design beneath and record it in general terms which has wider applicability.\n\nIt should also be noted while writing a pattern that a body of code that simply follows good principles and design practices must not be considered as a pattern. A pattern, apart from involving aforementioned characteristics, must also involve _interaction_ and _set of defined rules_.\n\n## Natural process of pattern formation\n\nThe process of creating new patterns, most of the time, is associated with _discovery_ rather than creation. As discussed, designs approximated by having a wider range of applicability instead of specific implementation are noted in general terms thereby forming a pattern. An author who registers design in this manner is often called a _pattern discoverer_ or _describer_. Rarely does an author devise a completely new solution for a given problem, codify it in general terms and get credited as an _author_ or _creator_ of the new pattern.\n\nMoreover, implementation and design appear before identifying it as a pattern. They are accepted as a proven solution to a problem before getting recorded in general description and considered as a pattern. Hence, as a natural process the creator should keenly observe solutions available in the wild, estimate their wider use and qualify them as a pattern.\n\n## Elements of a pattern\n\nIt is of critical importance to understand the fundamental elements of a pattern before writing a new or improving an existing one. These factors include _problem_, _solution_, _context_ and _examples_.\n\n### Problem Statement\n\nPatterns should provide answers for common problems or repeated problems occurring in designing software. A problem statement should clearly and unambiguously define the issue a pattern is trying to solve.\n\n### Solution Statement\n\nThis statement explains how a given problem is solved using a pattern. It is a set of steps and assumptions that provide solutions to underlying issues. This must be a tried and tested solution, instead of speculations, and should be reliable.\n\n### Context\n\nContext or scope is a description that defines the area within which a pattern is successful in solving the issue. It sometimes also defines the area where the pattern is not useful.\n\n### Example\n\nPatterns must provide examples of its design and implementation. The example should cover broad usage and properly describe the good design principle of the pattern.\n\n## General guidelines\n\nWriting a design pattern should capture all the essential elements of the pattern along with providing the end user with sufficient information about using the pattern. Certain guidelines which can be helpful in writing pattern is as follows :\n\n- _User-centric_ : Pattern should not alter or force change in the behaviour of the user adapting it. It must cover what user already perceives and understands.\n\n- _Experience agnostic_ : Pattern should be transparent and favourable to users of any experience level.\n\n- _Practicality_ : Patterns should produce result by describing proven solution instead of providing speculating solution.\n\n- _Best practice and principles_ : Design must be decided based on the principles derived from incorporating best practices.\n\n- _Strong examples_ : A pattern must showcase a broad range of examples to support various use-cases. It should describe good practices and principles while showing pattern usage.\n\n- _Discovery over creativity_ : Identify the wider application of existing solutions in the wild instead of creating new pattern.\n\n- _Originality is not the key_ : It’s fine to not be the original discoverer of a pattern, even though a pattern has minor overlapping with existing pattern it can be accepted based upon its broad usage.\n\n- _Patterns can be derived_ : Various patterns can be combined to create a new pattern. The configuration of mixing must be carefully decided by the creator.\n\n## Conclusion\n\nWriting a pattern is balancing between creating a design which is general as well as specific. The pattern should be general enough to cover a wide range of applications along with being specific in ensuring that all it’s design principles are enclosed within its implementation.\n","categories":["Programming","Design Patterns"]}}] diff --git a/blogs/design-patterns-what-are-design-patterns/index.html b/blogs/design-patterns-what-are-design-patterns/index.html index 999642c..7955d37 100644 --- a/blogs/design-patterns-what-are-design-patterns/index.html +++ b/blogs/design-patterns-what-are-design-patterns/index.html @@ -1 +1 @@ -Design Patterns - What are Design Patterns ?
NP

Design Patterns - What are Design Patterns ?

Programming
Design Patterns

What are Design Patterns ?

Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software.

It can also be considered as a specification or a template, for solving repeated problems, that can be implemented in multiple ways depending upon the situation.

Why should we use Design Patterns ?

These patterns are proven solutions to an issue, which assure optimal handling of the problem on hand and speed up the development process by overcoming current issues and minimizing future problems in software design.

Such patterns are robust and can be reused, which also acts as a communication medium between two developers familiar with them. By having patterns understanding one can easily comprehend current code which implements certain patterns and quickly append required changes.

Categories of Design Patterns

Based upon the situation where the pattern can be used they can be broadly classified into three type Creational, Structural and Behavioural. Furthermore, it can be divided into class based and object based depending upon its applicability.


Creational Design Patterns

It deals with problems related to instantiation of either class or object. These patterns adhere to class and object creation to make effective use of inheritance and delegation.

Class Based

Factory Method : Create an instance of several derived classes considering the interface information.

Object Based

Abstract Factory : Creates instances from various categories of classes without describing concrete implementation.

Builder : Helps create the same type of object by separating its construction process from its representation.

Prototype : Copying or cloning fully initialized instance.

Singleton : For creating a class which will have only a single instance.


Structural Design Patterns

These design patterns deal with the composition of classes and objects. It makes use of inheritance to compose interfaces and methods for adding new functionality.

Class Based

Adapter : Act as a connector between classes having incompatible interfaces.

Object Based

Adapter : Connector as above mentioned class based.

Decorator : Update object functionality dynamically.

Composite : Composing several objects to enhance its capability.

Bridge : It isolates the object interface from its implementation to promote decoupling.

Facade : Class that hides details of underlying subsystems and offers minimal public exposure.

Proxy : An object representing some other object acting as its placeholder.

Flyweight : An instance created for sharing information stored elsewhere.


Behavioural Design Patterns

These patterns offer solutions for convenient communication across classes or objects. It is based upon how things act together.

Class Based

Template : Create a template for a sequence of steps in a method and delegate the exact step to a subclass.

Interpreter : Provide means to include certain language grammar within the program and process it.

Object Based

Command : Encapsulation command requests such as logging and queuing requests in the form of an object. Also providing error-handling for unhandled requests.

Memento : Create snapshot of object internal state for future use.

Mediator : Creating a mediator object for communication instead of allowing objects to communicate directly with each other.

Iterator : Access collection without knowing it’s details.

Visitor : Defines a new operation to a class without changing it.

State : Change object behaviour based on its state.

Observer : Means of broadcasting change across several objects ensuring consistency between them.

Chain of responsibility : Passing some request through a chain of objects to an appropriate object for handling it.

Strategy : Encapsulate algorithms within class isolating selection and implementation.


What is an Anti-Pattern ?

Anti-Patterns are counterparts to design patterns, which describe commonly occurring solutions for a problem often having negative consequences and are highly counterproductive. Though initially appearing to be an appropriate and effective solution to a problem, it has relatively more negative consequences than positive.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Design Patterns - What are Design Patterns ?
NP

Design Patterns - What are Design Patterns ?

Programming
Design Patterns

What are Design Patterns ?

Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software.

It can also be considered as a specification or a template, for solving repeated problems, that can be implemented in multiple ways depending upon the situation.

Why should we use Design Patterns ?

These patterns are proven solutions to an issue, which assure optimal handling of the problem on hand and speed up the development process by overcoming current issues and minimizing future problems in software design.

Such patterns are robust and can be reused, which also acts as a communication medium between two developers familiar with them. By having patterns understanding one can easily comprehend current code which implements certain patterns and quickly append required changes.

Categories of Design Patterns

Based upon the situation where the pattern can be used they can be broadly classified into three type Creational, Structural and Behavioural. Furthermore, it can be divided into class based and object based depending upon its applicability.


Creational Design Patterns

It deals with problems related to instantiation of either class or object. These patterns adhere to class and object creation to make effective use of inheritance and delegation.

Class Based

Factory Method : Create an instance of several derived classes considering the interface information.

Object Based

Abstract Factory : Creates instances from various categories of classes without describing concrete implementation.

Builder : Helps create the same type of object by separating its construction process from its representation.

Prototype : Copying or cloning fully initialized instance.

Singleton : For creating a class which will have only a single instance.


Structural Design Patterns

These design patterns deal with the composition of classes and objects. It makes use of inheritance to compose interfaces and methods for adding new functionality.

Class Based

Adapter : Act as a connector between classes having incompatible interfaces.

Object Based

Adapter : Connector as above mentioned class based.

Decorator : Update object functionality dynamically.

Composite : Composing several objects to enhance its capability.

Bridge : It isolates the object interface from its implementation to promote decoupling.

Facade : Class that hides details of underlying subsystems and offers minimal public exposure.

Proxy : An object representing some other object acting as its placeholder.

Flyweight : An instance created for sharing information stored elsewhere.


Behavioural Design Patterns

These patterns offer solutions for convenient communication across classes or objects. It is based upon how things act together.

Class Based

Template : Create a template for a sequence of steps in a method and delegate the exact step to a subclass.

Interpreter : Provide means to include certain language grammar within the program and process it.

Object Based

Command : Encapsulation command requests such as logging and queuing requests in the form of an object. Also providing error-handling for unhandled requests.

Memento : Create snapshot of object internal state for future use.

Mediator : Creating a mediator object for communication instead of allowing objects to communicate directly with each other.

Iterator : Access collection without knowing it’s details.

Visitor : Defines a new operation to a class without changing it.

State : Change object behaviour based on its state.

Observer : Means of broadcasting change across several objects ensuring consistency between them.

Chain of responsibility : Passing some request through a chain of objects to an appropriate object for handling it.

Strategy : Encapsulate algorithms within class isolating selection and implementation.


What is an Anti-Pattern ?

Anti-Patterns are counterparts to design patterns, which describe commonly occurring solutions for a problem often having negative consequences and are highly counterproductive. Though initially appearing to be an appropriate and effective solution to a problem, it has relatively more negative consequences than positive.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/design-patterns-what-are-design-patterns/index.txt b/blogs/design-patterns-what-are-design-patterns/index.txt index 37f7489..5fcacc6 100644 --- a/blogs/design-patterns-what-are-design-patterns/index.txt +++ b/blogs/design-patterns-what-are-design-patterns/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","design-patterns-what-are-design-patterns","d"],{"children":["__PAGE__?{\"slug\":\"design-patterns-what-are-design-patterns\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","design-patterns-what-are-design-patterns","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"design-patterns-what-are-design-patterns\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","design-patterns-what-are-design-patterns","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Design Patterns - What are Design Patterns ?"}],["$","meta",null,{"name":"description","content":"Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Design Patterns - What are Design Patterns ?"}],["$","meta",null,{"property":"og:description","content":"Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/design-patterns-what-are-design-patterns"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/design-patterns-what-are-design-patterns.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Design Patterns - What are Design Patterns ?"}],["$","meta",null,{"name":"twitter:description","content":"Design patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/design-patterns-what-are-design-patterns.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Design Patterns - What are Design Patterns ?","date":"$D2021-09-15T00:00:00.000Z","content":"\n# What are Design Patterns ?\n\nDesign patterns are the code constructs irrespective of programming language, that offer solutions to the commonly occurring problems which are faced while developing a software.\n\nIt can also be considered as a specification or a template, for solving repeated problems, that can be implemented in multiple ways depending upon the situation.\n\n## Why should we use Design Patterns ?\n\nThese patterns are proven solutions to an issue, which assure optimal handling of the problem on hand and speed up the development process by overcoming current issues and minimizing future problems in software design.\n\nSuch patterns are robust and can be reused, which also acts as a communication medium between two developers familiar with them. By having patterns understanding one can easily comprehend current code which implements certain patterns and quickly append required changes.\n\n## Categories of Design Patterns\n\nBased upon the situation where the pattern can be used they can be broadly classified into three type Creational, Structural and Behavioural. Furthermore, it can be divided into class based and object based depending upon its applicability.\n\n---\n\n### Creational Design Patterns\n\nIt deals with problems related to instantiation of either class or object. These patterns adhere to class and object creation to make effective use of inheritance and delegation.\n\n_Class Based_\n\n**Factory Method** : Create an instance of several derived classes considering the interface information.\n\n_Object Based_\n\n**Abstract Factory** : Creates instances from various categories of classes without describing concrete implementation.\n\n**Builder** : Helps create the same type of object by separating its construction process from its representation.\n\n**Prototype** : Copying or cloning fully initialized instance.\n\n**Singleton** : For creating a class which will have only a single instance.\n\n---\n\n### Structural Design Patterns\n\nThese design patterns deal with the composition of classes and objects. It makes use of inheritance to compose interfaces and methods for adding new functionality.\n\n_Class Based_\n\n**Adapter** : Act as a connector between classes having incompatible interfaces.\n\n_Object Based_\n\n**Adapter** : Connector as above mentioned class based.\n\n**Decorator** : Update object functionality dynamically.\n\n**Composite** : Composing several objects to enhance its capability.\n\n**Bridge** : It isolates the object interface from its implementation to promote decoupling.\n\n**Facade** : Class that hides details of underlying subsystems and offers minimal public exposure.\n\n**Proxy** : An object representing some other object acting as its placeholder.\n\n**Flyweight** : An instance created for sharing information stored elsewhere.\n\n---\n\n### Behavioural Design Patterns\n\nThese patterns offer solutions for convenient communication across classes or objects. It is based upon how things act together.\n\n_Class Based_\n\n**Template** : Create a template for a sequence of steps in a method and delegate the exact step to a subclass.\n\n**Interpreter** : Provide means to include certain language grammar within the program and process it.\n\n_Object Based_\n\n**Command** : Encapsulation command requests such as logging and queuing requests in the form of an object. Also providing error-handling for unhandled requests.\n\n**Memento** : Create snapshot of object internal state for future use.\n\n**Mediator** : Creating a mediator object for communication instead of allowing objects to communicate directly with each other.\n\n**Iterator** : Access collection without knowing it’s details.\n\n**Visitor** : Defines a new operation to a class without changing it.\n\n**State** : Change object behaviour based on its state.\n\n**Observer** : Means of broadcasting change across several objects ensuring consistency between them.\n\n**Chain of responsibility** : Passing some request through a chain of objects to an appropriate object for handling it.\n\n**Strategy** : Encapsulate algorithms within class isolating selection and implementation.\n\n---\n\n## What is an Anti-Pattern ?\n\nAnti-Patterns are counterparts to design patterns, which describe commonly occurring solutions for a problem often having negative consequences and are highly counterproductive. Though initially appearing to be an appropriate and effective solution to a problem, it has relatively more negative consequences than positive.\n","categories":["Programming","Design Patterns"]}}] diff --git a/blogs/functional-programming-abstraction/index.html b/blogs/functional-programming-abstraction/index.html index c00b7e4..91ac80a 100644 --- a/blogs/functional-programming-abstraction/index.html +++ b/blogs/functional-programming-abstraction/index.html @@ -14,4 +14,4 @@ return f(f(n)); } -applyTwice(2, square); // 16
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +applyTwice(2, square); // 16
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-abstraction/index.txt b/blogs/functional-programming-abstraction/index.txt index dcf5379..150d0e0 100644 --- a/blogs/functional-programming-abstraction/index.txt +++ b/blogs/functional-programming-abstraction/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-abstraction","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-abstraction\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-abstraction","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-abstraction\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-abstraction","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Abstraction"}],["$","meta",null,{"name":"description","content":"Abstraction is the process of defining general format for different methods in a program."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Abstraction"}],["$","meta",null,{"property":"og:description","content":"Abstraction is the process of defining general format for different methods in a program."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-abstraction"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-abstraction.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Abstraction"}],["$","meta",null,{"name":"twitter:description","content":"Abstraction is the process of defining general format for different methods in a program."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-abstraction.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Abstraction","date":"$D2021-02-20T00:00:00.000Z","content":"\n# Abstraction\n\nAbstraction is the process of defining general format for different methods in a program.\n\nFor example if we consider the following program that applies the square twice on a given number, we can create an abstraction for that function in the described manner compare to creating a method which apply the same function twice on a given number.\n\n```\nfunction square(n) {\n return n * n;\n}\n\nfunction applySquareTwice(n) {\n return square(square(n));\n}\n\napplySquareTwice(2); // 16\n\n// Abstracted Function\n\nfunction applyTwice(n, f) {\n return f(f(n));\n}\n\napplyTwice(2, square); // 16\n\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-arity/index.html b/blogs/functional-programming-arity/index.html index 3b3adfd..296831a 100644 --- a/blogs/functional-programming-arity/index.html +++ b/blogs/functional-programming-arity/index.html @@ -1,3 +1,3 @@ Functional Programming - Arity
NP

Functional Programming - Arity

Programming
Functional Programming

Arity

The number of parameters a function consumes is called as the Arity of that function.

The arity of the add function below is two since it uses two parameters.

function add(a, b) {
   return a + b;
-}

A function that accepts single parameter is unary, the one that accepts two parameters is binary, three is ternary and n paramters is n-ary.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

A function that accepts single parameter is unary, the one that accepts two parameters is binary, three is ternary and n paramters is n-ary.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-arity/index.txt b/blogs/functional-programming-arity/index.txt index 7acc65d..496f78b 100644 --- a/blogs/functional-programming-arity/index.txt +++ b/blogs/functional-programming-arity/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-arity","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-arity\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-arity","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-arity\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-arity","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Arity"}],["$","meta",null,{"name":"description","content":"The number of parameters a function consumes is called as the Arity of that function."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Arity"}],["$","meta",null,{"property":"og:description","content":"The number of parameters a function consumes is called as the Arity of that function."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-arity"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-arity.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Arity"}],["$","meta",null,{"name":"twitter:description","content":"The number of parameters a function consumes is called as the Arity of that function."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-arity.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Arity","date":"$D2021-03-09T00:00:00.000Z","content":"\n# Arity\n\nThe number of parameters a function consumes is called as the Arity of that function.\n\nThe arity of the add function below is two since it uses two parameters.\n\n```\nfunction add(a, b) {\n return a + b;\n}\n```\n\nA function that accepts single parameter is `unary`, the one that accepts two parameters is `binary`, three is `ternary` and `n` paramters is `n-ary`.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-composition/index.html b/blogs/functional-programming-composition/index.html index 6973315..25933a6 100644 --- a/blogs/functional-programming-composition/index.html +++ b/blogs/functional-programming-composition/index.html @@ -18,4 +18,4 @@ ); doubleOfSquareOf(2) // 8 -doubleOfSquareOf(3) // 18
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +doubleOfSquareOf(3) // 18
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-composition/index.txt b/blogs/functional-programming-composition/index.txt index 4a69cf7..c316788 100644 --- a/blogs/functional-programming-composition/index.txt +++ b/blogs/functional-programming-composition/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-composition","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-composition\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-composition","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-composition\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-composition","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Composition"}],["$","meta",null,{"name":"description","content":"Composition is the process of combining two or more functions to get a new function or result required."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Composition"}],["$","meta",null,{"property":"og:description","content":"Composition is the process of combining two or more functions to get a new function or result required."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-composition"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-composition.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Composition"}],["$","meta",null,{"name":"twitter:description","content":"Composition is the process of combining two or more functions to get a new function or result required."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-composition.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Composition","date":"$D2021-02-26T00:00:00.000Z","content":"\n# Composition\n\nComposition is the process of combining two or more functions to get a new function or result required.\n\nFor example, we can compose a function to get double of a square of a given number. In order to do this we can create a new function by composing the result of a square function and double function.\n\n```\nfunction compose(f, g) {\n return function(x) {\n return f(g(x));\n };\n}\n\nfunction square(x) {\n return x * x;\n}\n\nfunction double(x) {\n return 2 * x;\n}\n\nconst doubleOfSquareOf = compose(\n double,\n square\n);\n\ndoubleOfSquareOf(2) // 8\ndoubleOfSquareOf(3) // 18\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-currying/index.html b/blogs/functional-programming-currying/index.html index a321da4..52a5d8c 100644 --- a/blogs/functional-programming-currying/index.html +++ b/blogs/functional-programming-currying/index.html @@ -12,4 +12,4 @@ }; } -curryingAdd(1)(2)(3); // 6
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +curryingAdd(1)(2)(3); // 6
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-currying/index.txt b/blogs/functional-programming-currying/index.txt index 7b8f0ce..6b978b2 100644 --- a/blogs/functional-programming-currying/index.txt +++ b/blogs/functional-programming-currying/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-currying","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-currying\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-currying","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-currying\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-currying","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Currying"}],["$","meta",null,{"name":"description","content":"Currying is an approach to divide a function with n number of arguments into n number of functions with one argument."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Currying"}],["$","meta",null,{"property":"og:description","content":"Currying is an approach to divide a function with n number of arguments into n number of functions with one argument."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-currying"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-currying.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Currying"}],["$","meta",null,{"name":"twitter:description","content":"Currying is an approach to divide a function with n number of arguments into n number of functions with one argument."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-currying.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Currying","date":"$D2021-03-04T00:00:00.000Z","content":"\n# Currying\n\nCurrying is an approach to divide a function with n number of arguments into n number of functions with one argument.\n\nFor example, a function to add three numbers `function add(a,b,c)` can be changed to 3 functions with one argument `a`, `b`, and `c`.\n\n```\nfunction add(a, b, c) {\n return a + b + c;\n}\n\nadd(1, 2, 3); // 6\n\nfunction curryingAdd(a) {\n return function(b) {\n return function(c) {\n return a + b + c;\n };\n };\n}\n\ncurryingAdd(1)(2)(3); // 6\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-decomposition/index.html b/blogs/functional-programming-decomposition/index.html index 9cb613b..4a1d587 100644 --- a/blogs/functional-programming-decomposition/index.html +++ b/blogs/functional-programming-decomposition/index.html @@ -12,4 +12,4 @@ const fetchData = () => stimulatePromise(); -fetchData().then(filterResponse).then(transformResponse);
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +fetchData().then(filterResponse).then(transformResponse);
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-decomposition/index.txt b/blogs/functional-programming-decomposition/index.txt index 46ade16..ddb35a5 100644 --- a/blogs/functional-programming-decomposition/index.txt +++ b/blogs/functional-programming-decomposition/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-decomposition","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-decomposition\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-decomposition","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-decomposition\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-decomposition","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Decomposition"}],["$","meta",null,{"name":"description","content":"Decomposition is the process of breaking complex task into smaller simple tasks."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Decomposition"}],["$","meta",null,{"property":"og:description","content":"Decomposition is the process of breaking complex task into smaller simple tasks."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-decomposition"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-decomposition.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Decomposition"}],["$","meta",null,{"name":"twitter:description","content":"Decomposition is the process of breaking complex task into smaller simple tasks."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-decomposition.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Decomposition","date":"$D2023-06-23T00:00:00.000Z","content":"\n# Decomposition\n\nDecomposition is the process of breaking complex task into smaller simpler tasks. It makes it easier to understand, manage and extend the software over a period of time. These smaller steps will be then combined and deliver a complete solution.\n\nIn example below we are stimulating asynchronous request call to fetch data and breaking the response handler into smaller tasks with distinguished purpose. \n\nWe implemented a `transformation` and `filtering` handler to process the response instead of one single handler to do all the work.\n\n```\nconst stimulatePromise = (value = [], timeout = 1500) => {\n return new Promise((res, rej) => {\n setTimeout(() => {\n res(value);\n }, timeout);\n });\n};\n\nconst filterResponse = (response) => response.filter((i) => true);\n\nconst transformResponse = (response) => response.map((i) => i);\n\nconst fetchData = () => stimulatePromise();\n\nfetchData().then(filterResponse).then(transformResponse);\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-first-class-function/index.html b/blogs/functional-programming-first-class-function/index.html index 447f0b6..3ee0fcf 100644 --- a/blogs/functional-programming-first-class-function/index.html +++ b/blogs/functional-programming-first-class-function/index.html @@ -7,4 +7,4 @@ return postTransform(y); } -transform(1, square); // 4
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +transform(1, square); // 4
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-first-class-function/index.txt b/blogs/functional-programming-first-class-function/index.txt index 5c62a83..e781524 100644 --- a/blogs/functional-programming-first-class-function/index.txt +++ b/blogs/functional-programming-first-class-function/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-first-class-function","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-first-class-function\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-first-class-function","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-first-class-function\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-first-class-function","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - First Class Function"}],["$","meta",null,{"name":"description","content":"Functions which behaves and can be used like any other variable in the program are called as first class functions."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - First Class Function"}],["$","meta",null,{"property":"og:description","content":"Functions which behaves and can be used like any other variable in the program are called as first class functions."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-first-class-function"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-first-class-function.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - First Class Function"}],["$","meta",null,{"name":"twitter:description","content":"Functions which behaves and can be used like any other variable in the program are called as first class functions."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-first-class-function.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - First Class Function","date":"$D2021-03-06T00:00:00.000Z","content":"\n# First Class Function\n\nFunctions which behaves and can be used like any other variable in the program are called as first class functions. For example a function can be an argument to some function call like any other variable passed as any agrument.\n\nHere function square is passed as an argument to the transform function.\n\n```\nfunction square(x) {\n return x * x;\n}\n\nfunction transform(x, postTransform) {\n const y = x + 1;\n return postTransform(y);\n}\n\ntransform(1, square); // 4\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-higher-order-function/index.html b/blogs/functional-programming-higher-order-function/index.html index ea3f294..6c3723b 100644 --- a/blogs/functional-programming-higher-order-function/index.html +++ b/blogs/functional-programming-higher-order-function/index.html @@ -14,4 +14,4 @@ const identity = compose(squareRoot, square); -identity(7) // 7

Here compose function accept functions are it's argument and return a function as a result.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +identity(7) // 7

Here compose function accept functions are it's argument and return a function as a result.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-higher-order-function/index.txt b/blogs/functional-programming-higher-order-function/index.txt index c9515b5..fc9ef54 100644 --- a/blogs/functional-programming-higher-order-function/index.txt +++ b/blogs/functional-programming-higher-order-function/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-higher-order-function","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-higher-order-function\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-higher-order-function","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-higher-order-function\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-higher-order-function","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Higher Order Function"}],["$","meta",null,{"name":"description","content":"Function that accepts function as their argument or return any function as a result are called as higher order function."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Higher Order Function"}],["$","meta",null,{"property":"og:description","content":"Function that accepts function as their argument or return any function as a result are called as higher order function."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-higher-order-function"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-higher-order-function.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Higher Order Function"}],["$","meta",null,{"name":"twitter:description","content":"Function that accepts function as their argument or return any function as a result are called as higher order function."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-higher-order-function.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Higher Order Function","date":"$D2021-03-08T00:00:00.000Z","content":"\n# Higher Order Function\n\nFunction that accepts function as their argument or return any function as a result are called as higher order function. Such functions are useful for applying wrapper logic over existing functions.\n\n```\nfunction compose(f, g) {\n return function (x) {\n return f(g(x));\n };\n}\n\nfunction square(x){\n return x * x;\n}\n\nfunction squareRoot(x){\n return Math.sqrt(x)\n}\n\nconst identity = compose(squareRoot, square);\n\nidentity(7) // 7\n\n```\n\nHere compose function accept functions are it's argument and return a function as a result.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-immutability/index.html b/blogs/functional-programming-immutability/index.html index 3b68682..3c01f8b 100644 --- a/blogs/functional-programming-immutability/index.html +++ b/blogs/functional-programming-immutability/index.html @@ -2,4 +2,4 @@ Object.freeze(obj); // Making the object restricted to change. -obj.foo = 'foobar'; // Cannot be changed because the object is immutable
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +obj.foo = 'foobar'; // Cannot be changed because the object is immutable
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-immutability/index.txt b/blogs/functional-programming-immutability/index.txt index 0d1417b..ca4f8f7 100644 --- a/blogs/functional-programming-immutability/index.txt +++ b/blogs/functional-programming-immutability/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-immutability","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-immutability\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-immutability","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-immutability\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-immutability","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Immutability"}],["$","meta",null,{"name":"description","content":"It refers to an approach where an object, or any other reference in the system, value or state is not changed once it is created."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Immutability"}],["$","meta",null,{"property":"og:description","content":"It refers to an approach where an object, or any other reference in the system, value or state is not changed once it is created."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-immutability"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-immutability.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Immutability"}],["$","meta",null,{"name":"twitter:description","content":"It refers to an approach where an object, or any other reference in the system, value or state is not changed once it is created."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-immutability.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Immutability","date":"$D2021-03-13T00:00:00.000Z","content":"\n# Immutability\n\nIt refers to an approach where an object, or any other reference in the system, value or state is not changed once it is created. Such an object is called as an `immutable object`. On the contrary, a `mutable object` is an object whose value can be modified.\n\nIt is required to impose a strict control on the data and prevent it from unwanted modification. Moreover, it also makes the code more predictable and easy to debug.\n\nFor example in JavaScript, an object can be made immutable by an inbuilt `Object.freeze` method.\n\n```\nvar obj = { foo: \"bar\" };\n\nObject.freeze(obj); // Making the object restricted to change.\n\nobj.foo = 'foobar'; // Cannot be changed because the object is immutable\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-memoization/index.html b/blogs/functional-programming-memoization/index.html index ae8c267..ff457e7 100644 --- a/blogs/functional-programming-memoization/index.html +++ b/blogs/functional-programming-memoization/index.html @@ -35,4 +35,4 @@ fibonacci(3); // Cache HIT fibonacci(2); // Cache HIT fibonacci(1); // Cache HIT -fibonacci(0); // Cache HIT

To summarize, Memoization is an optimization technique to speed up program execution by caching results of expensive computation and returning cached results when the function is called when already known inputs.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +fibonacci(0); // Cache HIT

To summarize, Memoization is an optimization technique to speed up program execution by caching results of expensive computation and returning cached results when the function is called when already known inputs.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-memoization/index.txt b/blogs/functional-programming-memoization/index.txt index aa8aa6b..a5c0d23 100644 --- a/blogs/functional-programming-memoization/index.txt +++ b/blogs/functional-programming-memoization/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-memoization","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-memoization\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-memoization","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-memoization\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-memoization","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Memoization"}],["$","meta",null,{"name":"description","content":"Memoization is a technique used to store the result of the expensive function call in a cache and return them when the same input is used again rather than a fresh computation."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Memoization"}],["$","meta",null,{"property":"og:description","content":"Memoization is a technique used to store the result of the expensive function call in a cache and return them when the same input is used again rather than a fresh computation."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-memoization"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-memoization.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Memoization"}],["$","meta",null,{"name":"twitter:description","content":"Memoization is a technique used to store the result of the expensive function call in a cache and return them when the same input is used again rather than a fresh computation."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-memoization.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Memoization","date":"$D2023-06-25T00:00:00.000Z","content":"\n# Memoization\n\nIt is a technique of storing results and returning them instead of computing them afresh each time. Function calls can be expensive and its computation can be time consuming. In order to speed up the process, memoization is used to store the result of the expensive function call in a cache and return them when the same input is used again rather than a fresh computation. \n\nMemoization speeds up program execution and optimizes computation, thereby improving CPU performance. It is also sometimes referred to as _tabling_.\n\nFor example, A _Fibonacci Sequence_ is a series of numbers starting from zero, followed by one, and progressing on the rule that the next number in the series is the summation of preceding two numbers.\n\n```\n[0,1,1,2,3,5,8,13,21,...]\n```\n\nBelow mentioned is a simple program to get the _nth element_ of the fibonacci series starting from the zeroth index.\n\n```\nconst fibonacci = (n) => {\n  return n === 0 ? 0 : n === 1 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);\n};\n\nfibonacci(3) // 1\nfibonacci(4) // 2\nfibonacci(5) // 3\nfibonacci(6) // 5\n```\n\nIt will often be the case when the value of _n_ will be repeated, and each time a computation will be performed to get the _nth element_. This can be time consuming if the value of _n_ is a higher number.\n\nThe computation speed in such cases can be easily speed up using memoization. The program works by computing fibonacci of intermediate values and their summation to get the nth index. Using memoization the result of input can be cached and returned instantly when provided with the same input again.\n\nA pure memoization function can be implemented as below :\n\n```\nconst memoize = (f) => {\n  f.cache = f.cache || {};\n\n  return (...args) => {\n    const key = 'key_' + args.join('');\n\n    if (!f.cache[key]) {\n      f.cache[key] = f(...args);\n    }\n\n    return f.cache[key];\n  };\n};\n```\n\nUsing this function, fibonacci program can be memoized as mentioned below :\n\n```\nconst memoizedFibonacci = memoize(fibonacci);\n\nmemoizedFibonacci(5); // Computation\nmemoizedFibonacci(5); // Cache HIT\n```\n\nConsider computing the _5th element_ in the fibonacci series. It will compute and store caches for indexes, _[0,1,2,3,4]_. Next time when we try to compute the _6th element_ in fibonacci series, instead of fresh computation, the previous nth element for indices _[0,1,2,3,4]_ will be returned instantly and improves performance and reduces time.\n\n```\nmemoizedFibonacci(5);\n\nfibonacci(4); // Computation\nfibonacci(3); // Computation\nfibonacci(2); // Computation\nfibonacci(1); // Computation\nfibonacci(0); // Computation\n\nmemoizedFibonacci(6);\n\nfibonacci(5); // Computation\nfibonacci(4); // Cache HIT\nfibonacci(3); // Cache HIT\nfibonacci(2); // Cache HIT\nfibonacci(1); // Cache HIT\nfibonacci(0); // Cache HIT\n```\n\nTo summarize, *Memoization* is an optimization technique to speed up program execution by caching results of expensive computation and returning cached results when the function is called when already known inputs.","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-partial-application/index.html b/blogs/functional-programming-partial-application/index.html index fa208ba..b3782b5 100644 --- a/blogs/functional-programming-partial-application/index.html +++ b/blogs/functional-programming-partial-application/index.html @@ -25,4 +25,4 @@ makeBrew("coffee"); makeBrew("beer"); makeJuice("orange"); -makeJuice("apple");
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +makeJuice("apple");
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-partial-application/index.txt b/blogs/functional-programming-partial-application/index.txt index 91d8519..3d0f0fb 100644 --- a/blogs/functional-programming-partial-application/index.txt +++ b/blogs/functional-programming-partial-application/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-partial-application","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-partial-application\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-partial-application","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-partial-application\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-partial-application","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Partial Application"}],["$","meta",null,{"name":"description","content":"It is a process of converting a function with multiple parameters into number of functions with one or more argument already set."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Partial Application"}],["$","meta",null,{"property":"og:description","content":"It is a process of converting a function with multiple parameters into number of functions with one or more argument already set."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-partial-application"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-partial-application.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Partial Application"}],["$","meta",null,{"name":"twitter:description","content":"It is a process of converting a function with multiple parameters into number of functions with one or more argument already set."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-partial-application.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Partial Application","date":"$D2023-06-24T00:00:00.000Z","content":"\n# Partial Application\n\nIt is a process of converting a function with multiple parameters into a number of functions with one or more arguments already set. The function returns a new function by applying the argument in the returned function, thereby reducing the [arity](/blogs/functional-programming-arity) in the returned function. Partial application is also useful in the scenario when its required to supply some but not all arguments to a function.\n\nIn the example below, we have a function named `greet` that takes four arguments namely `salutation`, `title`, `firstname` and `lastname`. Using partial application we create a new function `greetHello` by fixing the first argument i.e `salutation` to `Hello`, reducing it's arity to three. We can use `greetHello` as a wrapper of `greet` with `salutation` set to `Hello`.\n\nWe then created one more function `greetHelloToMrs` by partially applygin the `title` argument in `greetHello` to `Mrs`, which was created on top of `greet`, thereby reducing the arity to two.\n\n```\nconst greet = (salutation, title, firstname, lastname) => {\n return `${salutation}, ${title} ${firstname} ${lastname}.`;\n};\n\ngreet(\"Hi\", \"Mr.\", \"John\", \"Doe\"); // Hi, Mr. John Doe.\n\nconst greetHello = greet.bind(null, \"Hello\");\n\ngreetHello(\"Mr.\", \"John\", \"Doe\"); // Hello, Mr. John Doe.\n\nconst greetHelloToMrs = greetHello.bind(null, \"Mrs.\");\n\ngreetHelloToMrs(\"Maria\", \"Doe\"); // Hello, Mrs. Maria Doe\n```\n\nPartial application is also referred to as delaying the instantiation of some of the parameters of a function. It may be useful when we need to parameter some processes for a later use.\n\n```\n// without partial application\nconst drink = (verb, drinkName) => `I am ${verb} ${drinkName}`;\ndrink(\"brewing\", \"coffee\");\ndrink(\"brewing\", \"beer\");\ndrink(\"juicing\", \"orange\");\ndrink(\"juicing\", \"apple\");\n\n// partially applying argument\nconst makeDrink = (verb) => (drinkName) => `I am ${verb} ${drinkName}`;\nconst makeBrew = makeDrink(\"brewing\");\nconst makeJuice = makeDrink(\"juicing\");\n\nmakeBrew(\"coffee\");\nmakeBrew(\"beer\");\nmakeJuice(\"orange\");\nmakeJuice(\"apple\");\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-pure-function/index.html b/blogs/functional-programming-pure-function/index.html index 50fccbb..efaa538 100644 --- a/blogs/functional-programming-pure-function/index.html +++ b/blogs/functional-programming-pure-function/index.html @@ -18,4 +18,4 @@ function double(x){ return x * 2; -}

To summarise, a pure function follow the below mentioned characteristics :

  • Produce same output for given same input value everytime
  • Have no side effects
  • Do not mutate the arguments
  • Should not depend upon external state
  • Should return a value which is consumed thenafter
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

To summarise, a pure function follow the below mentioned characteristics :

  • Produce same output for given same input value everytime
  • Have no side effects
  • Do not mutate the arguments
  • Should not depend upon external state
  • Should return a value which is consumed thenafter
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-pure-function/index.txt b/blogs/functional-programming-pure-function/index.txt index b2a5834..a183248 100644 --- a/blogs/functional-programming-pure-function/index.txt +++ b/blogs/functional-programming-pure-function/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-pure-function","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-pure-function\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-pure-function","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-pure-function\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-pure-function","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Pure Function"}],["$","meta",null,{"name":"description","content":"Function is a relation that maps input value to output. Provided with certain value of input, it returns the output considering the mapping."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Pure Function"}],["$","meta",null,{"property":"og:description","content":"Function is a relation that maps input value to output. Provided with certain value of input, it returns the output considering the mapping."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-pure-function"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-pure-function.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Pure Function"}],["$","meta",null,{"name":"twitter:description","content":"Function is a relation that maps input value to output. Provided with certain value of input, it returns the output considering the mapping."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-pure-function.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Pure Function","date":"$D2021-02-27T00:00:00.000Z","content":"\n# Pure Function\n\nFunction is a relation that maps input value to output. Provided with certain value of input, it returns the output considering the mapping.\n\nFor example a function that doubles the value will map the input to it's double value\n\n`1 -> 2`\n\n`2 -> 4`\n\n`3 -> 6`\n\nPure function are those relationship mappings which produces same output everytime when provided with the given same input.\n\nFor example the above function to double the value will always return the same output for a given input value. Input value 1 will always return 2 and like wise for all the other input it will have a fixed output value.\n\n```\nPure function because it will always return same output for a given input\n\nfunction square(x){\n return x * x;\n}\n```\n\nMoreover, such functions do not produce or execute any side effect. A side effect is an action that changes any state of the system. For example consoling the value to the output, generating random value, fetching remote data etc.\n\n```\nImpure function since it will return different value on each call.\n\nfunction getRandom(){\n return Math.random();\n}\n```\n\nMoreover, it is not dependent on any external factors for example, the current state of the system. All the required value are passed as the arguments to the function instead of refering them directly.\n\n```\nImpure function because it cosume name from scope outside this function\n\nfunction printName(){\n console.log(this.name);\n}\n```\n\nAlso, it should not mutate the mutate the arguments provided to it. For example it must not change the value of any property in the object passed to it as an argument.\n\n```\nImpure because it mutates the tax property of product argument\n\nfunction calculateTax(product){\n product.tax = product.price * 0.1;\n}\n```\n\nAnother common notion for identifying an impure function is those function are called without there return value being used.\n\n```\nPure because it's returing a value which will be consumed by the calling side\n\nfunction double(x){\n return x * 2;\n}\n```\n\nTo summarise, a pure function follow the below mentioned characteristics :\n\n- Produce same output for given same input value everytime\n- Have no side effects\n- Do not mutate the arguments\n- Should not depend upon external state\n- Should return a value which is consumed thenafter\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-recursion/index.html b/blogs/functional-programming-recursion/index.html index 5c68c27..386730e 100644 --- a/blogs/functional-programming-recursion/index.html +++ b/blogs/functional-programming-recursion/index.html @@ -19,4 +19,4 @@ } console.log(n); printReverse(n-1); -}

The important part of recursion includes a termination condition, reaching to the termination condition and recursive calls.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

The important part of recursion includes a termination condition, reaching to the termination condition and recursive calls.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-recursion/index.txt b/blogs/functional-programming-recursion/index.txt index fc87e67..6969ed6 100644 --- a/blogs/functional-programming-recursion/index.txt +++ b/blogs/functional-programming-recursion/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-recursion","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-recursion\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-recursion","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-recursion\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-recursion","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Recursion"}],["$","meta",null,{"name":"description","content":"It is an approach to solve a given problem by iteratively calling the solution on the smaller instances for the same problem until it's reaches a termination condition."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Recursion"}],["$","meta",null,{"property":"og:description","content":"It is an approach to solve a given problem by iteratively calling the solution on the smaller instances for the same problem until it's reaches a termination condition."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-recursion"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-recursion.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Recursion"}],["$","meta",null,{"name":"twitter:description","content":"It is an approach to solve a given problem by iteratively calling the solution on the smaller instances for the same problem until it's reaches a termination condition."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-recursion.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Recursion","date":"$D2021-03-05T00:00:00.000Z","content":"\n# Recursion\n\nIt is an approach to solve a given problem by iteratively calling the solution on the smaller instances for the same problem until it's reaches a termination condition.\n\nFor example, the factorial of a given number can be computed by calling the factorial of a given number by multiplying the number with the factorial of number one less than it. This should be continued until we reach a base condition, in this case 1.\n\n```\nfact(5);\n5 * fact(4);\n5 * fact(4) * fact(3);\n5 * fact(4) * fact(3) * fact(2);\n5 * fact(4) * fact(3) * fact(2) * fact(1);\n5 * fact(4) * fact(3) * fact(2) * 1;\n5 * fact(4) * fact(3) * 2;\n5 * fact(4) * 6;\n5 * 24\n120\n```\n\nProgram to calcuate the factorial of a given number\n\n```\nfunction fact(n) {\n if (n === 1) {\n return 1;\n }\n\n return n * fact(n - 1);\n}\n```\n\nProgram to print number in reverse starting from n\n\n```\nfunction printReverse(n){\n if(n===1){\n console.log(1);\n }\n console.log(n);\n printReverse(n-1);\n}\n```\n\nThe important part of recursion includes a termination condition, reaching to the termination condition and recursive calls.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-referential-transparency/index.html b/blogs/functional-programming-referential-transparency/index.html index 4f7ed76..3c14363 100644 --- a/blogs/functional-programming-referential-transparency/index.html +++ b/blogs/functional-programming-referential-transparency/index.html @@ -4,4 +4,4 @@ const x = add(2, 2); // 4 -const x = 4; // 4

Even if we replace the function call with the actual result the program will still behave the same.

The function has to be pure and without side effect for being referentially transparent.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +const x = 4; // 4

Even if we replace the function call with the actual result the program will still behave the same.

The function has to be pure and without side effect for being referentially transparent.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-referential-transparency/index.txt b/blogs/functional-programming-referential-transparency/index.txt index dbfc38a..df4c788 100644 --- a/blogs/functional-programming-referential-transparency/index.txt +++ b/blogs/functional-programming-referential-transparency/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-referential-transparency","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-referential-transparency\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-referential-transparency","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-referential-transparency\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-referential-transparency","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Referential Transparency"}],["$","meta",null,{"name":"description","content":"It is an ability of a function such that its invocation can be replaced with actual result without changing the overall behaviour of the sytem."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Referential Transparency"}],["$","meta",null,{"property":"og:description","content":"It is an ability of a function such that its invocation can be replaced with actual result without changing the overall behaviour of the sytem."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-referential-transparency"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-referential-transparency.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Referential Transparency"}],["$","meta",null,{"name":"twitter:description","content":"It is an ability of a function such that its invocation can be replaced with actual result without changing the overall behaviour of the sytem."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-referential-transparency.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Referential Transparency","date":"$D2021-03-05T00:00:00.000Z","content":"\n# Referential Transparency\n\nIt is an ability of a function such that its invocation can be replaced with actual result without changing the overall behaviour of the sytem.\n\nFor example, the add invocation can be replaced directly with the result without affecting anything else in the system\n\n```\nfunction add(a, b) {\n return a + b;\n}\n\nconst x = add(2, 2); // 4\n\nconst x = 4; // 4\n\n```\n\nEven if we replace the function call with the actual result the program will still behave the same.\n\nThe function has to be pure and without side effect for being referentially transparent.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-shared-state/index.html b/blogs/functional-programming-shared-state/index.html index a8f1d7a..f01dbe4 100644 --- a/blogs/functional-programming-shared-state/index.html +++ b/blogs/functional-programming-shared-state/index.html @@ -16,4 +16,4 @@ function square(value){ return value * value; -}

Avoiding shared state will now enable the function to have consistent output for given input, thereby making them more predictable and easy to debug.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

Avoiding shared state will now enable the function to have consistent output for given input, thereby making them more predictable and easy to debug.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-shared-state/index.txt b/blogs/functional-programming-shared-state/index.txt index 21153a3..182f961 100644 --- a/blogs/functional-programming-shared-state/index.txt +++ b/blogs/functional-programming-shared-state/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-shared-state","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-shared-state\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-shared-state","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-shared-state\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-shared-state","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Shared State"}],["$","meta",null,{"name":"description","content":"It refers to any variable, including both primitive and reference type, that exists in global scope or scope which is shared across different functions."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Shared State"}],["$","meta",null,{"property":"og:description","content":"It refers to any variable, including both primitive and reference type, that exists in global scope or scope which is shared across different functions."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-shared-state"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-shared-state.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Shared State"}],["$","meta",null,{"name":"twitter:description","content":"It refers to any variable, including both primitive and reference type, that exists in global scope or scope which is shared across different functions."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-shared-state.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Shared State","date":"$D2021-03-14T00:00:00.000Z","content":"\n# Shared State\n\nIt refers to any variable, including both primitive and reference type, that exists in global scope or scope which is shared across different functions. In procedural and object oriented programming the value of the variable is often changed by the function accessing it. On the other end, functional programming avoid the use of shared state and changing its value. It promotes returning a new data derived from old data along with applying required changes.\n\nWith shared state, in order to understand behaviour of a particular function one has to trace the entire changes applied on the variable prior to calling that function. Moreover, functions which utilizes shared state are often dependent upon a fix sequence of operation or function calls for reaching certain input value which is then used within the function itself for performing its calculation. This restrict the functions to be invoked in a definite manner to reach certain output, any change in this order will break the sole purpose of the function.\n\n```\nconst value = 1;\n\nfunction double(){\n return value * 2;\n}\n\nfunction square(){\n return value * value;\n}\n\n```\n\n```\ndouble();\nsquare();\nconsole.log(value); // 4\n```\n\n```\nsquare();\ndouble();\nconsole.log(value) // 2\n```\n\nThe output depends upon the order in which the functions are called. Moreover, the output of function are not the same on each call.\n\nThese functions can restrict the use of shared state to achieve order independence and improve readability.\n\n```\nfunction double(value){\n return value * 2;\n}\n\nfunction square(value){\n return value * value;\n}\n```\n\nAvoiding shared state will now enable the function to have consistent output for given input, thereby making them more predictable and easy to debug.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-side-effect/index.html b/blogs/functional-programming-side-effect/index.html index b37fb9f..916f045 100644 --- a/blogs/functional-programming-side-effect/index.html +++ b/blogs/functional-programming-side-effect/index.html @@ -10,4 +10,4 @@ function fetchData() { return fetch('http://example.com'); // Side effect -}

In presence of side effects, a program behaviour depends upon the histories of changes / order of evaluation ( since its modifying a shared variable ) and requires the knowledge about existing context for understanding the program. However in the absence of which, the program is easy to debug and understand.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

In presence of side effects, a program behaviour depends upon the histories of changes / order of evaluation ( since its modifying a shared variable ) and requires the knowledge about existing context for understanding the program. However in the absence of which, the program is easy to debug and understand.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-side-effect/index.txt b/blogs/functional-programming-side-effect/index.txt index e8814e3..f408ad5 100644 --- a/blogs/functional-programming-side-effect/index.txt +++ b/blogs/functional-programming-side-effect/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-side-effect","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-side-effect\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-side-effect","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-side-effect\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-side-effect","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Side Effect"}],["$","meta",null,{"name":"description","content":"Side effect is any operation that is perform by a function, besides returning a value, which modifies a value outside the local scope of that function affecting current behaviour of the overall system."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Side Effect"}],["$","meta",null,{"property":"og:description","content":"Side effect is any operation that is perform by a function, besides returning a value, which modifies a value outside the local scope of that function affecting current behaviour of the overall system."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-side-effect"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-side-effect.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Side Effect"}],["$","meta",null,{"name":"twitter:description","content":"Side effect is any operation that is perform by a function, besides returning a value, which modifies a value outside the local scope of that function affecting current behaviour of the overall system."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-side-effect.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Side Effect","date":"$D2021-03-17T00:00:00.000Z","content":"\n# Side Effect\n\nSide effect is any operation that is perform by a function, besides returning a value, which modifies a value outside the local scope of that function affecting current behaviour of the overall system.\n\nSome of the common side effect includes :\n\n- Changing global state\n- Logging / writing to screen / file\n- Network requests\n- Invoking functions already having side effects\n\n```\nvar counter = 0;\n\nfunction incrementCounter() {\n counter = counter + 1; // Side effect\n}\n\nfunction logTime() {\n console.log(new Date()); // Side effect\n}\n\nfunction fetchData() {\n return fetch('http://example.com'); // Side effect\n}\n\n```\n\nIn presence of side effects, a program behaviour depends upon the histories of changes / order of evaluation ( since its modifying a shared variable ) and requires the knowledge about existing context for understanding the program. However in the absence of which, the program is easy to debug and understand.\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/functional-programming-tail-call-optimization/index.html b/blogs/functional-programming-tail-call-optimization/index.html index 1c56b2d..81cfbd6 100644 --- a/blogs/functional-programming-tail-call-optimization/index.html +++ b/blogs/functional-programming-tail-call-optimization/index.html @@ -1,4 +1,4 @@ -Functional Programming - Tail Call Optimization
NP

Functional Programming - Tail Call Optimization

Programming
Functional Programming

Tail Call Optimization

It is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution.

For example, in the following factorial computation, instead of returning the arithmetic operation it call be replaced with functional call for optimization.

function factorial(n) {
+Functional Programming - Tail Call Optimization
NP

Functional Programming - Tail Call Optimization

Programming
Functional Programming

Tail Call Optimization

It is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution.

For example, in the following factorial computation, instead of returning the arithmetic operation it can be replaced with functional call for optimization.

function factorial(n) {
   if (n === 1) {
     return 1;
   }
@@ -10,4 +10,4 @@
   }
 
   return tailOptimizedFactorial(n - 1, n * tail);
-}
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/functional-programming-tail-call-optimization/index.txt b/blogs/functional-programming-tail-call-optimization/index.txt index c07eaba..f80bd5d 100644 --- a/blogs/functional-programming-tail-call-optimization/index.txt +++ b/blogs/functional-programming-tail-call-optimization/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","functional-programming-tail-call-optimization","d"],{"children":["__PAGE__?{\"slug\":\"functional-programming-tail-call-optimization\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","functional-programming-tail-call-optimization","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"functional-programming-tail-call-optimization\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","functional-programming-tail-call-optimization","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Functional Programming - Tail Call Optimization"}],["$","meta",null,{"name":"description","content":"It is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Functional Programming - Tail Call Optimization"}],["$","meta",null,{"property":"og:description","content":"It is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/functional-programming-tail-call-optimization"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/functional-programming-tail-call-optimization.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Functional Programming - Tail Call Optimization"}],["$","meta",null,{"name":"twitter:description","content":"It is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/functional-programming-tail-call-optimization.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} -b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Tail Call Optimization","date":"$D2021-03-07T00:00:00.000Z","content":"\n# Tail Call Optimization\n\nIt is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution.\n\nFor example, in the following factorial computation, instead of returning the arithmetic operation it call be replaced with functional call for optimization.\n\n```\nfunction factorial(n) {\n if (n === 1) {\n return 1;\n }\n // Creates extra entry on call stack for each calls\n return n * factorial(n - 1);\n}\n```\n\n```\nfunction tailOptimizedFactorial(n, tail = 1) {\n if (n === 1) {\n return tail;\n }\n\n return tailOptimizedFactorial(n - 1, n * tail);\n}\n```\n","categories":["Programming","Functional Programming"]}}] +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} +b:["$","$Ld",null,{"blog":{"title":"Functional Programming - Tail Call Optimization","date":"$D2021-03-07T00:00:00.000Z","content":"\n# Tail Call Optimization\n\nIt is a technique for preventing adding extra entries on call stack or stack frame by calling a sub routine or recursive call to same function at the end of function execution.\n\nFor example, in the following factorial computation, instead of returning the arithmetic operation it can be replaced with functional call for optimization.\n\n```\nfunction factorial(n) {\n if (n === 1) {\n return 1;\n }\n // Creates extra entry on call stack for each calls\n return n * factorial(n - 1);\n}\n```\n\n```\nfunction tailOptimizedFactorial(n, tail = 1) {\n if (n === 1) {\n return tail;\n }\n\n return tailOptimizedFactorial(n - 1, n * tail);\n}\n```\n","categories":["Programming","Functional Programming"]}}] diff --git a/blogs/index.html b/blogs/index.html index 971e039..a18fa81 100644 --- a/blogs/index.html +++ b/blogs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/blogs/index.txt b/blogs/index.txt index 293bfd1..cf60d41 100644 --- a/blogs/index.txt +++ b/blogs/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["blogs",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/blogs/programming-paradigms-functional-programming/index.html b/blogs/programming-paradigms-functional-programming/index.html index bbe610f..3432625 100644 --- a/blogs/programming-paradigms-functional-programming/index.html +++ b/blogs/programming-paradigms-functional-programming/index.html @@ -1,4 +1,4 @@ Programming Paradigms - Functional Programming
NP

Programming Paradigms - Functional Programming

Programming
Programming Paradigms
Functional Programming

Functional Programming

Functional Programming is a Declarative style of Programming Paradigm for writing computer programs.

But, What are Functions ?

Functions in general, applies computation on given input and returns the output. It relates input to an output.

f(x) = x + 2;
 
 f(1) = 1 + 2 = 3;
-f(2) = 2 + 2 = 4;

Above mentioned is a simple function that adds 2 to the input value and returns output. It relates value [1,2] => [3,4]. Similarly, a function in computer programming is a block of instruction that performs computation on given input and returns the output.

Functional Programming is such a style of writing computer programs using these tiny functions that works together and perform required computation.

Functions in Functional Programming

The philosophy of functional programming is to maintain certain characteristics while writing functions in a computer program. These characteristics are the fundamental nature of functional programming that describe what shall be the behaviour of a function. These are as follows :

Declarative

A function must be declarative, it simply tells what to compute, without specifying how to compute it.

f(x) = x * 4; 👍

Declarative function that tells to multiply input by 4;

f(x) = { y = x + x; z = x + x; return y + z;} 👎

Non-Declarative function that specify how to multiply input by 4;

Pure

A function must give the same output for a given input value, at any period of time. It is not dependent upon anything outside the function definition.

f(x) = It's never too late; 👍

Pure function that will always return It's never too late

f(x) = If today's Friday or Saturday then It's never too late else It's late. 👎

Impure function that consider day for returning value. The value is not predictable. It can change. So a function that performs anything which is unpredictable is not a pure function. The condition or the execution is dynamic or unfixed in an impure function.

Immutable (Must not change the input provided)

A function must not change the value that is provided as input. Instead it must return a complete new value wherever changes are required; by cloning the input value then making required changes and returning the value.

For example consider the function whose input is a list of numbers and it replaces the first element ( at position 0 ) in the list with value 1 .

f([x]) = { x[0] = 1; return x;} 👎

This function is mutating the input value, by directly changing the value at position 0 and returning the value.

f([x]) = { y = new [x]; y[0] = 1; return y;} 👍

This function is not changing the input value, it instead creates a new list y , does the required changes or replaces the first element with 1 and returns the output.

First-Class

A function can be passed as an input to a function or can be returned as an output from a function. Such functions that take or return a function are also called a Higher-order Functions.

g(x) = x + 2;

f(x, g) = g(x) + 2;

Here f(x, g) is a higher order function that takes g(x) as an input. g(x) is a function that adds 2 to the input and returns the value. f(x, g) will first apply g(x) to the input and then add 2 to it’s value and return. For example f(2) = ( 2 + 2 ) + 2 = 6;

Recursion

A function calling itself is called a recursion. Recursive calls are made until some condition is reached that terminates this cycle.

g(x) = if x === 0 then return 0 else return x + g(x-1);

The above function will call itself until it reaches the value 0

g(5) = 5 + g(4) = 5 + 4 + g(3) =....= 5 + 4 + 3 + 2 + 1 + 0 = 15;

Why do we need Functional Programming ?

Functional programming resembles mathematics for solving problems. The functions are defined clearly and precise that describe its purpose by itself without mentioning any context. And since it’s not dependent on anything outside the function, the context is not required. This helps us get a quick overview about how the system is working and increases readability.

Also, there are no changes to the input of a function, so it won’t introduce any unwanted state changes in the system. So there is a low risk of introducing error while making changes or extending systems.

The functions are precise and can be composed in different ways to solve a problem that increases the Modularity and Composability of the system.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +f(2) = 2 + 2 = 4;

Above mentioned is a simple function that adds 2 to the input value and returns output. It relates value [1,2] => [3,4]. Similarly, a function in computer programming is a block of instruction that performs computation on given input and returns the output.

Functional Programming is such a style of writing computer programs using these tiny functions that works together and perform required computation.

Functions in Functional Programming

The philosophy of functional programming is to maintain certain characteristics while writing functions in a computer program. These characteristics are the fundamental nature of functional programming that describe what shall be the behaviour of a function. These are as follows :

Declarative

A function must be declarative, it simply tells what to compute, without specifying how to compute it.

f(x) = x * 4; 👍

Declarative function that tells to multiply input by 4;

f(x) = { y = x + x; z = x + x; return y + z;} 👎

Non-Declarative function that specify how to multiply input by 4;

Pure

A function must give the same output for a given input value, at any period of time. It is not dependent upon anything outside the function definition.

f(x) = It's never too late; 👍

Pure function that will always return It's never too late

f(x) = If today's Friday or Saturday then It's never too late else It's late. 👎

Impure function that consider day for returning value. The value is not predictable. It can change. So a function that performs anything which is unpredictable is not a pure function. The condition or the execution is dynamic or unfixed in an impure function.

Immutable (Must not change the input provided)

A function must not change the value that is provided as input. Instead it must return a complete new value wherever changes are required; by cloning the input value then making required changes and returning the value.

For example consider the function whose input is a list of numbers and it replaces the first element ( at position 0 ) in the list with value 1 .

f([x]) = { x[0] = 1; return x;} 👎

This function is mutating the input value, by directly changing the value at position 0 and returning the value.

f([x]) = { y = new [x]; y[0] = 1; return y;} 👍

This function is not changing the input value, it instead creates a new list y , does the required changes or replaces the first element with 1 and returns the output.

First-Class

A function can be passed as an input to a function or can be returned as an output from a function. Such functions that take or return a function are also called a Higher-order Functions.

g(x) = x + 2;

f(x, g) = g(x) + 2;

Here f(x, g) is a higher order function that takes g(x) as an input. g(x) is a function that adds 2 to the input and returns the value. f(x, g) will first apply g(x) to the input and then add 2 to it’s value and return. For example f(2) = ( 2 + 2 ) + 2 = 6;

Recursion

A function calling itself is called a recursion. Recursive calls are made until some condition is reached that terminates this cycle.

g(x) = if x === 0 then return 0 else return x + g(x-1);

The above function will call itself until it reaches the value 0

g(5) = 5 + g(4) = 5 + 4 + g(3) =....= 5 + 4 + 3 + 2 + 1 + 0 = 15;

Why do we need Functional Programming ?

Functional programming resembles mathematics for solving problems. The functions are defined clearly and precise that describe its purpose by itself without mentioning any context. And since it’s not dependent on anything outside the function, the context is not required. This helps us get a quick overview about how the system is working and increases readability.

Also, there are no changes to the input of a function, so it won’t introduce any unwanted state changes in the system. So there is a low risk of introducing error while making changes or extending systems.

The functions are precise and can be composed in different ways to solve a problem that increases the Modularity and Composability of the system.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-functional-programming/index.txt b/blogs/programming-paradigms-functional-programming/index.txt index 8f34b3a..b4cc246 100644 --- a/blogs/programming-paradigms-functional-programming/index.txt +++ b/blogs/programming-paradigms-functional-programming/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-functional-programming","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-functional-programming\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-functional-programming","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-functional-programming\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-functional-programming","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - Functional Programming"}],["$","meta",null,{"name":"description","content":"Functional Programming is a Declarative style of Programming Paradigm for writing computer programs."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - Functional Programming"}],["$","meta",null,{"property":"og:description","content":"Functional Programming is a Declarative style of Programming Paradigm for writing computer programs."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-functional-programming"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-functional-programming.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - Functional Programming"}],["$","meta",null,{"name":"twitter:description","content":"Functional Programming is a Declarative style of Programming Paradigm for writing computer programs."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-functional-programming.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - Functional Programming","date":"$D2020-07-20T00:00:00.000Z","content":"\n# Functional Programming\n\nFunctional Programming is a [Declarative](/blogs/programming-paradigms-imperative-and-declarative-programming) style of [Programming Paradigm](/blogs/programming-paradigms-what-are-programming-paradigms) for writing computer programs.\n\n## But, What are Functions ?\n\nFunctions in general, applies computation on given input and returns the output. It relates input to an output.\n\n```\nf(x) = x + 2;\n\nf(1) = 1 + 2 = 3;\nf(2) = 2 + 2 = 4;\n```\n\nAbove mentioned is a simple function that adds 2 to the input value and returns output. It relates value `[1,2] => [3,4]`. Similarly, a function in computer programming is a block of instruction that performs computation on given input and returns the output.\n\n> Functional Programming is such a style of writing computer programs using these tiny functions that works together and perform required computation.\n\n## Functions in Functional Programming\n\nThe philosophy of functional programming is to maintain certain characteristics while writing functions in a computer program. These characteristics are the fundamental nature of functional programming that describe what shall be the behaviour of a function. These are as follows :\n\n### Declarative\n\nA function must be declarative, it simply tells what to compute, without specifying how to compute it.\n\n`f(x) = x * 4; 👍`\n\nDeclarative function that tells to multiply input by 4;\n\n`f(x) = { y = x + x; z = x + x; return y + z;} 👎`\n\nNon-Declarative function that specify how to multiply input by 4;\n\n### Pure\n\nA function must give the same output for a given input value, at any period of time. It is not dependent upon anything outside the function definition.\n\n`f(x) = It's never too late; 👍`\n\nPure function that will always return It's never too late\n\n`f(x) = If today's Friday or Saturday then It's never too late else It's late. 👎`\n\nImpure function that consider day for returning value. The value is not predictable. It can change. So a function that performs anything which is unpredictable is not a pure function. The condition or the execution is dynamic or unfixed in an impure function.\n\n### Immutable (Must not change the input provided)\n\nA function must not change the value that is provided as input. Instead it must return a complete new value wherever changes are required; by cloning the input value then making required changes and returning the value.\n\nFor example consider the function whose input is a list of numbers and it replaces the first element ( at position 0 ) in the list with value 1 .\n\n`f([x]) = { x[0] = 1; return x;} 👎`\n\nThis function is mutating the input value, by directly changing the value at position 0 and returning the value.\n\n`f([x]) = { y = new [x]; y[0] = 1; return y;} 👍`\n\nThis function is not changing the input value, it instead creates a new list y , does the required changes or replaces the first element with 1 and returns the output.\n\n### First-Class\n\nA function can be passed as an input to a function or can be returned as an output from a function. Such functions that take or return a function are also called a _Higher-order Functions_.\n\n`g(x) = x + 2;`\n\n`f(x, g) = g(x) + 2;`\n\nHere `f(x, g)` is a higher order function that takes `g(x)` as an input. `g(x)` is a function that adds 2 to the input and returns the value. `f(x, g)` will first apply `g(x)` to the input and then add 2 to it’s value and return. For example `f(2) = ( 2 + 2 ) + 2 = 6`;\n\n### Recursion\n\nA function calling itself is called a recursion. Recursive calls are made until some condition is reached that terminates this cycle.\n\n`g(x) = if x === 0 then return 0 else return x + g(x-1);`\n\nThe above function will call itself until it reaches the value 0\n\n`g(5) = 5 + g(4) = 5 + 4 + g(3) =....= 5 + 4 + 3 + 2 + 1 + 0 = 15;`\n\n## Why do we need Functional Programming ?\n\nFunctional programming resembles mathematics for solving problems. The functions are defined clearly and precise that describe its purpose by itself without mentioning any context. And since it’s not dependent on anything outside the function, the context is not required. This helps us get a quick overview about how the system is working and increases **_readability_**.\n\nAlso, there are no changes to the input of a function, so it won’t introduce any unwanted state changes in the system. So there is a **_low risk of introducing_** error while making changes or extending systems.\n\nThe functions are precise and can be composed in different ways to solve a problem that increases the **_Modularity and Composability_** of the system.\n","categories":["Programming","Programming Paradigms","Functional Programming"]}}] diff --git a/blogs/programming-paradigms-imperative-and-declarative-programming/index.html b/blogs/programming-paradigms-imperative-and-declarative-programming/index.html index 3221d3e..c734122 100644 --- a/blogs/programming-paradigms-imperative-and-declarative-programming/index.html +++ b/blogs/programming-paradigms-imperative-and-declarative-programming/index.html @@ -6,4 +6,4 @@ Step 6: If they are done with it, display my image. Step 7: Thank you very much Computer.

This is how an imperative program instructs the computer to perform a task of displaying an image on screen. It takes into account various scenarios before displaying the image on screen and also provides detailed execution instruction to the computer.

A declarative program simply tells the computer what is expected.

Step 1: Hey computer how are you ?
 Step 2: I want you to display an image on screen.
-Step 3: Please update me once done. Thank you.

This declarative program simply instructs the computer to display the image and update when done, without getting into detail about the execution.

Summary

Imperative style programs consider the existing state of computer and also change the instruction order based upon it (control flow). It is relative. On the other hand declarative style programs simply describe the logic without describing control flow. It is absolute.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Step 3: Please update me once done. Thank you.

This declarative program simply instructs the computer to display the image and update when done, without getting into detail about the execution.

Summary

Imperative style programs consider the existing state of computer and also change the instruction order based upon it (control flow). It is relative. On the other hand declarative style programs simply describe the logic without describing control flow. It is absolute.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-imperative-and-declarative-programming/index.txt b/blogs/programming-paradigms-imperative-and-declarative-programming/index.txt index 3bef720..3bb9b8d 100644 --- a/blogs/programming-paradigms-imperative-and-declarative-programming/index.txt +++ b/blogs/programming-paradigms-imperative-and-declarative-programming/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-imperative-and-declarative-programming","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-imperative-and-declarative-programming\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-imperative-and-declarative-programming","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-imperative-and-declarative-programming\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-imperative-and-declarative-programming","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - Imperative and Declarative Programming"}],["$","meta",null,{"name":"description","content":"Difference between how and what a program instruct the computer to perform a certain task."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - Imperative and Declarative Programming"}],["$","meta",null,{"property":"og:description","content":"Difference between how and what a program instruct the computer to perform a certain task."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-imperative-and-declarative-programming"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-imperative-and-declarative-programming.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - Imperative and Declarative Programming"}],["$","meta",null,{"name":"twitter:description","content":"Difference between how and what a program instruct the computer to perform a certain task."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-imperative-and-declarative-programming.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - Imperative and Declarative Programming","date":"$D2020-07-10T00:00:00.000Z","content":"\n# Imperative and Declarative Programming\n\nA program is a set of instructions that instruct the computer to perform a certain task. And [Programming Paradigm](/blogs/programming-paradigms-what-are-programming-paradigms) are the styles of writing a computer program. Paradigms can be broadly classified into Imperative and Declarative programming based on how and what the computer is instructed to do.\n\n## How and What ?\n\nYes. An imperative program tells the computer about **how** to perform certain tasks. While a declarative program tells the computer about **what** to do and not really caring about how the computer does it.\n\nLet’s imagine you are into shopping. You want to buy a T-Shirt. In your head you will have conditions and logic getting popped. Someone will go ahead like this :\n\n> Let me check my wardrobe, if I have a red colour T-Shirt then I probably buy a blue colour T-Shirt. Here you are considering your current wardrobe for making a decision about how a new T-Shirt should be. **This is called an imperative approach**.\n\nAnother person thought might be somewhat different will go ahead like this :\n\nNo matter what my wardrobe or anything else around me is currently, I will go out and will only buy a White colour T-Shirt. Here you are not considering any other thing before making a decision about **what** a new T-Shirt should be. **This is called a declarative approach.**\n\n## That’s right ! But in terms of computer instruction ?\n\nAn imperative program is a program that instructs a computer in a specific manner about how to get through a certain computation, providing it a step by step instruction about _how_ to compute and get to the desired result.\n\n```\nStep 1: Hey computer how are you ?\nStep 2: I want you to display an image on screen.\nStep 3: Check if any other image is displayed already or not.\nStep 4: If not then please check if someone else is also trying to display some image on screen or not ?\nStep 5: If someone else is trying then let him / her first display it on screen.\nStep 6: If they are done with it, display my image.\nStep 7: Thank you very much Computer.\n```\n\nThis is how an imperative program instructs the computer to perform a task of displaying an image on screen. It takes into account various scenarios before displaying the image on screen and also provides detailed execution instruction to the computer.\n\nA declarative program simply tells the computer what is expected.\n\n```\nStep 1: Hey computer how are you ?\nStep 2: I want you to display an image on screen.\nStep 3: Please update me once done. Thank you.\n```\n\nThis declarative program simply instructs the computer to display the image and update when done, without getting into detail about the execution.\n\n## Summary\n\nImperative style programs consider the existing state of computer and also change the instruction order based upon it (control flow). It is relative. On the other hand declarative style programs simply describe the logic without describing control flow. It is absolute.\n","categories":["Programming","Programming Paradigms","Imperative Programming","Declarative Programmin"]}}] diff --git a/blogs/programming-paradigms-object-oriented-programming/index.html b/blogs/programming-paradigms-object-oriented-programming/index.html index ec77ad2..4056562 100644 --- a/blogs/programming-paradigms-object-oriented-programming/index.html +++ b/blogs/programming-paradigms-object-oriented-programming/index.html @@ -1 +1 @@ -Programming Paradigms - Object Oriented Programming
NP

Programming Paradigms - Object Oriented Programming

Programming
Programming Paradigms
Object Oriented Programming

Object Oriented Programming

Introduction

Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods. Data refers to the values, variables or state that are used within the program and Method are the Procedures or Functions which manipulate that data.

In OOP, a computer program implements logic by making use of these objects that interact with each other. For this purpose multiple objects of similar or distinct structure are created within the program. Implementing similar objects again and again can consume time and creates redundancy in code. Class provides a solution to this problem. It acts as a blueprint or foundation for defining the structure of an object. Class is thereby used to first design and then to create similar multiple objects. Therefore, an object is called an instance of class.

Some languages solve the aforementioned problem by using prototypes. A prototype is an object, whenever we want to create a similar object, to an already existing object, we simply link the new object with the previously defined object as their prototype. The data and methods from the prototype are then transferred to all the objects having it as their prototype. The programming languages implementing OOP are sometimes classified as class-based and prototype-based languages.

Message Passing

In OOP, objects interact or communicate with each other to accomplish various tasks. Such interaction will enable an object to invoke methods of another object, which in-turn will execute the invoked method and return it’s result to the object invoking it. In OOP, message passing is executed by specifying the name of the object followed by the name of the and information to be sent. In OOP, message passing is an essential part of program execution.

Why OOP?

Prior to OOP, there was Procedural Programming. Procedure performs a specific task and manipulates data of the system. One can invoke a procedure, instead of writing the logic again, whenever he / she wants to perform that task. It provides reusability, but with increasingly complex programs it becomes hard to manage and trace the change in the system made by a certain procedure.

OOP provides maintainability and control by binding state and methods within a single object. The change from a method is delegated within the data of the same object and can be traced easily. Moreover, classification into the form of objects enforces modularity. As the data and methods are dependent only upon itself within an object, any existing object is easily replaceable with a new object having similar structure with enhanced capability. Other benefits include security, by imposing restrictions on other objects to change data of an object directly by using access control on object data and methods. OOP is therefore required to overcome these limitations and to organise the program for better control, reusability and maintainability.

Fundamentals of OOP

OOP practises the following principles :

Abstraction

It is the ability of displaying essential information required to communicate with an object, discarding other low-level or irrelevant information required to perform a desired task. For example, a class for Ticket Booking. Using abstraction only the methods such as show booking, create booking, update booking and cancel booking are displayed for interaction and other details can be hidden away from the user. Interfaces and Abstract class are used in OOP to achieve abstraction.

Encapsulation

In OOP, encapsulation refers to binding data and methods, which manipulate that data, within the same object. Since data is restricted, allowing only methods within the object to access it, it imposes a strict security on outside interference and avoids misuses. The same is applicable for the access of object methods. Encapsulation is therefore also referred to as Data Hiding.

Inheritance

It is a mechanism that allows one class to inherit data and methods of another class. It promotes reusability by inheriting features from already existing classes and changing them wherever required to perform different or augment functionality. The class inheriting is called as Child or Sub class and the the class from which it is inherited is called as Parent or Super class.

Polymorphism

In OOP, polymorphism is a strategy that allows methods to behave differently based upon their definition. The method by same name behaves differently when called upon in Child class compared to Parent class depending upon its definition.

Moreover, in a single Class there can be different definitions of the same method name taking different arguments providing different results. For example a class can have a method add, with a definition taking two arguments, another definition taking three arguments and so on.

From the perspective of calling code, polymorphism can also be viewed upon as a type of abstraction that hides which definition of method is being executed by the system.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Programming Paradigms - Object Oriented Programming
NP

Programming Paradigms - Object Oriented Programming

Programming
Programming Paradigms
Object Oriented Programming

Object Oriented Programming

Introduction

Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods. Data refers to the values, variables or state that are used within the program and Method are the Procedures or Functions which manipulate that data.

In OOP, a computer program implements logic by making use of these objects that interact with each other. For this purpose multiple objects of similar or distinct structure are created within the program. Implementing similar objects again and again can consume time and creates redundancy in code. Class provides a solution to this problem. It acts as a blueprint or foundation for defining the structure of an object. Class is thereby used to first design and then to create similar multiple objects. Therefore, an object is called an instance of class.

Some languages solve the aforementioned problem by using prototypes. A prototype is an object, whenever we want to create a similar object, to an already existing object, we simply link the new object with the previously defined object as their prototype. The data and methods from the prototype are then transferred to all the objects having it as their prototype. The programming languages implementing OOP are sometimes classified as class-based and prototype-based languages.

Message Passing

In OOP, objects interact or communicate with each other to accomplish various tasks. Such interaction will enable an object to invoke methods of another object, which in-turn will execute the invoked method and return it’s result to the object invoking it. In OOP, message passing is executed by specifying the name of the object followed by the name of the and information to be sent. In OOP, message passing is an essential part of program execution.

Why OOP?

Prior to OOP, there was Procedural Programming. Procedure performs a specific task and manipulates data of the system. One can invoke a procedure, instead of writing the logic again, whenever he / she wants to perform that task. It provides reusability, but with increasingly complex programs it becomes hard to manage and trace the change in the system made by a certain procedure.

OOP provides maintainability and control by binding state and methods within a single object. The change from a method is delegated within the data of the same object and can be traced easily. Moreover, classification into the form of objects enforces modularity. As the data and methods are dependent only upon itself within an object, any existing object is easily replaceable with a new object having similar structure with enhanced capability. Other benefits include security, by imposing restrictions on other objects to change data of an object directly by using access control on object data and methods. OOP is therefore required to overcome these limitations and to organise the program for better control, reusability and maintainability.

Fundamentals of OOP

OOP practises the following principles :

Abstraction

It is the ability of displaying essential information required to communicate with an object, discarding other low-level or irrelevant information required to perform a desired task. For example, a class for Ticket Booking. Using abstraction only the methods such as show booking, create booking, update booking and cancel booking are displayed for interaction and other details can be hidden away from the user. Interfaces and Abstract class are used in OOP to achieve abstraction.

Encapsulation

In OOP, encapsulation refers to binding data and methods, which manipulate that data, within the same object. Since data is restricted, allowing only methods within the object to access it, it imposes a strict security on outside interference and avoids misuses. The same is applicable for the access of object methods. Encapsulation is therefore also referred to as Data Hiding.

Inheritance

It is a mechanism that allows one class to inherit data and methods of another class. It promotes reusability by inheriting features from already existing classes and changing them wherever required to perform different or augment functionality. The class inheriting is called as Child or Sub class and the the class from which it is inherited is called as Parent or Super class.

Polymorphism

In OOP, polymorphism is a strategy that allows methods to behave differently based upon their definition. The method by same name behaves differently when called upon in Child class compared to Parent class depending upon its definition.

Moreover, in a single Class there can be different definitions of the same method name taking different arguments providing different results. For example a class can have a method add, with a definition taking two arguments, another definition taking three arguments and so on.

From the perspective of calling code, polymorphism can also be viewed upon as a type of abstraction that hides which definition of method is being executed by the system.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-object-oriented-programming/index.txt b/blogs/programming-paradigms-object-oriented-programming/index.txt index 0fd8ad2..b0cba08 100644 --- a/blogs/programming-paradigms-object-oriented-programming/index.txt +++ b/blogs/programming-paradigms-object-oriented-programming/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-object-oriented-programming","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-object-oriented-programming\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-object-oriented-programming","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-object-oriented-programming\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-object-oriented-programming","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - Object Oriented Programming"}],["$","meta",null,{"name":"description","content":"Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - Object Oriented Programming"}],["$","meta",null,{"property":"og:description","content":"Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-object-oriented-programming"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-object-oriented-programming.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - Object Oriented Programming"}],["$","meta",null,{"name":"twitter:description","content":"Object Oriented Programming (OOP) is a Programming Paradigm which is based on the concept of objects. Objects are entities that contain Data and Methods."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-object-oriented-programming.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - Object Oriented Programming","date":"$D2020-10-22T00:00:00.000Z","content":"\n# Object Oriented Programming\n\n## Introduction\n\nObject Oriented Programming (OOP) is a [Programming Paradigm](/blogs/programming-paradigms-what-are-programming-paradigms) which is based on the concept of objects. Objects are entities that contain Data and Methods. Data refers to the values, variables or state that are used within the program and Method are the [Procedures](/blogs/programming-paradigms-procedural-programming) or [Functions](/blogs/programming-paradigms-functional-programming) which manipulate that data.\n\nIn OOP, a computer program implements logic by making use of these objects that interact with each other. For this purpose multiple objects of similar or distinct structure are created within the program. Implementing similar objects again and again can consume time and creates redundancy in code. Class provides a solution to this problem. It acts as a blueprint or foundation for defining the structure of an object. Class is thereby used to first design and then to create similar multiple objects. Therefore, an object is called an instance of class.\n\nSome languages solve the aforementioned problem by using prototypes. A prototype is an object, whenever we want to create a similar object, to an already existing object, we simply link the new object with the previously defined object as their prototype. The data and methods from the prototype are then transferred to all the objects having it as their prototype. The programming languages implementing OOP are sometimes classified as class-based and prototype-based languages.\n\n## Message Passing\n\nIn OOP, objects interact or communicate with each other to accomplish various tasks. Such interaction will enable an object to invoke methods of another object, which in-turn will execute the invoked method and return it’s result to the object invoking it. In OOP, message passing is executed by specifying the name of the object followed by the name of the and information to be sent. In OOP, message passing is an essential part of program execution.\n\n## Why OOP?\n\nPrior to OOP, there was [Procedural Programming](/blogs/programming-paradigms-procedural-programming). Procedure performs a specific task and manipulates data of the system. One can invoke a procedure, instead of writing the logic again, whenever he / she wants to perform that task. It provides reusability, but with increasingly complex programs it becomes hard to manage and trace the change in the system made by a certain procedure.\n\nOOP provides maintainability and control by binding state and methods within a single object. The change from a method is delegated within the data of the same object and can be traced easily. Moreover, classification into the form of objects enforces modularity. As the data and methods are dependent only upon itself within an object, any existing object is easily replaceable with a new object having similar structure with enhanced capability. Other benefits include security, by imposing restrictions on other objects to change data of an object directly by using access control on object data and methods. OOP is therefore required to overcome these limitations and to organise the program for better control, reusability and maintainability.\n\n## Fundamentals of OOP\n\nOOP practises the following principles :\n\n### Abstraction\n\nIt is the ability of displaying essential information required to communicate with an object, discarding other low-level or irrelevant information required to perform a desired task. For example, a class for Ticket Booking. Using abstraction only the methods such as _show booking_, _create booking_, _update booking_ and _cancel booking_ are displayed for interaction and other details can be hidden away from the user. Interfaces and Abstract class are used in OOP to achieve abstraction.\n\n### Encapsulation\n\nIn OOP, encapsulation refers to binding data and methods, which manipulate that data, within the same object. Since data is restricted, allowing only methods within the object to access it, it imposes a strict security on outside interference and avoids misuses. The same is applicable for the access of object methods. Encapsulation is therefore also referred to as _Data Hiding_.\n\n### Inheritance\n\nIt is a mechanism that allows one class to inherit data and methods of another class. It promotes reusability by inheriting features from already existing classes and changing them wherever required to perform different or augment functionality. The class inheriting is called as Child or Sub class and the the class from which it is inherited is called as Parent or Super class.\n\n### Polymorphism\n\nIn OOP, polymorphism is a strategy that allows methods to behave differently based upon their definition. The method by same name behaves differently when called upon in Child class compared to Parent class depending upon its definition.\n\nMoreover, in a single Class there can be different definitions of the same method name taking different arguments providing different results. For example a class can have a method _add_, with a definition taking two arguments, another definition taking three arguments and so on.\n\nFrom the perspective of calling code, polymorphism can also be viewed upon as a type of abstraction that hides which definition of method is being executed by the system.\n","categories":["Programming","Programming Paradigms","Object Oriented Programming"]}}] diff --git a/blogs/programming-paradigms-procedural-programming/index.html b/blogs/programming-paradigms-procedural-programming/index.html index 1addc3d..8a8c027 100644 --- a/blogs/programming-paradigms-procedural-programming/index.html +++ b/blogs/programming-paradigms-procedural-programming/index.html @@ -11,4 +11,4 @@ procedure print_decimal_number(){ <- Value of variable `ten` is `10.00` within this block scope -> number ten = 10.00 -}

Block and Scope allow us to group the instructions required for a procedure to perform tasks and to avoid conflict of the variables.

Difference between Procedural and Function

Procedure or Function can be used interchangeably to specify a group of computer instructions. However, they have differences in implementation when we consider the philosophy of given a paradigm.

In procedural programming, one can change or mutate the value of the argument passed to a procedure. Functional programming on the other hand restricts the mutation of value and emphasis on returning new value with the changes required.

Procedures in programs can share variables and depend on each other. While in functional programming the value is usually not shared and the dependencies exist between functions based on the argument passed to the function and the value returned from the function. In this manner, functions have free order of execution while the procedures don’t.

Procedure can have side-effect within them while a function should not have a side-effect and must be pure.

Procedures cannot be passed as an argument (first-class-citizen) to other procedures. Functions can be passed as an argument to other functions and can be returned from a function.

Summary

Procedural paradigm is normally used for general-purpose programming. It is usually the first paradigm practice that a new developer gets gripped onto. There are several advantages of this approach which includes, ease of implementation, modularity and simple program flow. However, there are certain limitations of procedure which one might need to consider first hand, that includes, difficulties to trace mutation of value, strict order of execution due to state sharing, data is not restricted and can be changed anywhere in the program.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +}

Block and Scope allow us to group the instructions required for a procedure to perform tasks and to avoid conflict of the variables.

Difference between Procedural and Function

Procedure or Function can be used interchangeably to specify a group of computer instructions. However, they have differences in implementation when we consider the philosophy of given a paradigm.

In procedural programming, one can change or mutate the value of the argument passed to a procedure. Functional programming on the other hand restricts the mutation of value and emphasis on returning new value with the changes required.

Procedures in programs can share variables and depend on each other. While in functional programming the value is usually not shared and the dependencies exist between functions based on the argument passed to the function and the value returned from the function. In this manner, functions have free order of execution while the procedures don’t.

Procedure can have side-effect within them while a function should not have a side-effect and must be pure.

Procedures cannot be passed as an argument (first-class-citizen) to other procedures. Functions can be passed as an argument to other functions and can be returned from a function.

Summary

Procedural paradigm is normally used for general-purpose programming. It is usually the first paradigm practice that a new developer gets gripped onto. There are several advantages of this approach which includes, ease of implementation, modularity and simple program flow. However, there are certain limitations of procedure which one might need to consider first hand, that includes, difficulties to trace mutation of value, strict order of execution due to state sharing, data is not restricted and can be changed anywhere in the program.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-procedural-programming/index.txt b/blogs/programming-paradigms-procedural-programming/index.txt index e897f0b..368c68b 100644 --- a/blogs/programming-paradigms-procedural-programming/index.txt +++ b/blogs/programming-paradigms-procedural-programming/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-procedural-programming","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-procedural-programming\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-procedural-programming","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-procedural-programming\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-procedural-programming","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - Procedural Programming"}],["$","meta",null,{"name":"description","content":"It is a style of writing computer programs using procedures. Procedural Programming solves a problem by implementing and making use of various procedures."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - Procedural Programming"}],["$","meta",null,{"property":"og:description","content":"It is a style of writing computer programs using procedures. Procedural Programming solves a problem by implementing and making use of various procedures."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-procedural-programming"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-procedural-programming.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - Procedural Programming"}],["$","meta",null,{"name":"twitter:description","content":"It is a style of writing computer programs using procedures. Procedural Programming solves a problem by implementing and making use of various procedures."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-procedural-programming.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - Procedural Programming","date":"$D2020-08-16T00:00:00.000Z","content":"\n# Procedural Programming\n\nProcedural Programming is an [Imperative](/blogs/programming-paradigms-imperative-and-declarative-programming) style of [Programming Paradigm](/blogs/programming-paradigms-what-are-programming-paradigms). It is a style of writing computer programs using procedures. Procedural Programming solves a problem by implementing and making use of various procedures.\n\n## What is a Procedure ?\n\nProcedure is a sequence of computer instructions for performing a specific task. When we need to perform that same task again somewhere else then instead of writing the same instruction set again, we will call the procedure to perform the task. Procedure are also referred to as Routines, Subroutines and Functions. Procedures enable [Modularity]() in a computer program. Procedure may have input arguments in order to perform given tasks. For example, the procedure to compute and print the square of given integer list can be expressed as follows :\n\n```\nprocedure print_squares(list_of_integer){\n for each integer in list_of_integer {\n print integer * integer;\n }\n}\n```\n\nNote : The above construct doesn’t belong to any programming language and it’s used for explanatory purpose only.\n\n## Block and Scope\n\nProcedure depends on block and scope for performing its functionality. A `block` is a structure that groups a set of computer instructions. In the above example, the opening parenthesis and the closing parenthesis forms a block.\n\n```\nprocedure print_squares(list_of_integer){ <- Block starts ->\n ...\n} <- Block ends ->\n```\n\nA `scope` associates a `value` to a `variable` in some part of the program or `block`. The `name` of the variable can be then used to refer to the value associated with it in that block. Where-else in other blocks of the same program the same name of the variable can refer to some other value or no value at all.\n\n```\nprocedure print_number(){\n <- Value of variable `ten` is `10` within this block scope ->\n number ten = 10\n}\nprocedure print_decimal_number(){\n <- Value of variable `ten` is `10.00` within this block scope ->\n number ten = 10.00\n}\n```\n\n`Block` and `Scope` allow us to group the instructions required for a procedure to perform tasks and to avoid conflict of the variables.\n\n## Difference between Procedural and [Function](/blogs/programming-paradigms-functional-programming)\n\nProcedure or Function can be used interchangeably to specify a group of computer instructions. However, they have differences in implementation when we consider the philosophy of given a paradigm.\n\nIn procedural programming, one can change or mutate the value of the argument passed to a procedure. Functional programming on the other hand restricts the mutation of value and emphasis on returning new value with the changes required.\n\nProcedures in programs can share variables and depend on each other. While in functional programming the value is usually not shared and the dependencies exist between functions based on the argument passed to the function and the value returned from the function. In this manner, functions have free order of execution while the procedures don’t.\n\nProcedure can have [side-effect]() within them while a function should not have a side-effect and must be pure.\n\nProcedures cannot be passed as an argument (first-class-citizen) to other procedures. Functions can be passed as an argument to other functions and can be returned from a function.\n\n## Summary\n\nProcedural paradigm is normally used for general-purpose programming. It is usually the first paradigm practice that a new developer gets gripped onto. There are several advantages of this approach which includes, ease of implementation, modularity and simple program flow. However, there are certain limitations of procedure which one might need to consider first hand, that includes, difficulties to trace mutation of value, strict order of execution due to state sharing, data is not restricted and can be changed anywhere in the program.\n","categories":["Programming","Programming Paradigms","Procedural Programming"]}}] diff --git a/blogs/programming-paradigms-structured-programming/index.html b/blogs/programming-paradigms-structured-programming/index.html index 0fddaf6..dabf555 100644 --- a/blogs/programming-paradigms-structured-programming/index.html +++ b/blogs/programming-paradigms-structured-programming/index.html @@ -1 +1 @@ -Programming Paradigms - Structured Programming
NP

Programming Paradigms - Structured Programming

Programming
Programming Paradigms
Structured Programming

Structured Programming

Bit History

In a computer program, control flow is the order in which set instructions are executed. A control flow statement changes program flow, to achieve specific results, by choosing a path from available paths. These statements can be based on some condition; executing instructions only when some condition is met; or can be unconditional; arbitrarily transferring the flow to some different instruction set. The goto statement was the most basic form of unconditional transfer. It transfers the control to the labelled instructions set.

GOTO LABEL;

Goto performs one-way transfer of control which means the control is not expected to return after executing the labelled instructions set. On the contrary, calling a Function usually returns the control after execution. In earlier programming, goto statements were used extensively. However, with increasing complexity it becomes harder to maintain computer programs because goto resulted in non-linear change of control flow which was harder to understand compared to linear transfer.

Dijkstra was one of the first persons to criticise the use of goto, arguing about errors and poor structure imposed by using it. He proposed the use of linear control flow transfer under high discipline, thereby eliminating the use of goto in programming and Spaghetti Code caused by goto. This is considered to be an important movement in the history of computer programming and accepted as the beginning of a new Programming paradigm, Structured Programming. It is a paradigm focusing on improving the clarity, control, quality and maintainability of a computer program by making use of disciplined structures.


Elements of Structured Programming

Structured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program.

Blocks

It is a style of grouping multiple instructions that looks like a single instruction statement. Block also helps in defining the scope of variables to avoid conflicts with other similarly named variables in the instruction set. They have an enclosing structure usually defined by keywords such as begin...end, if...fi etc. Some language supports the use of curly braces {...} to define a block.

Subroutines and Functions

It allows breaking the program into small modular sets of instructions that perform specific tasks. These modules are called subroutines or functions. They invoke each other internally in specific order to get expected results. They provide re-usability of logic.

Control Structures

It enables the control of program flow to determine the execution of instruction in a certain manner. The three main category of control structure are as follows :

Sequence : Providing a sequence of instructions to allow the computer execute them in the provided order for achieving results.

Selection : Allowing the selection of a flow from the list of available flow. This is usually done based on some condition that is evaluated to decide the next executing flow of a program. Keywords such as if...else expresses selection.

Iteration : Allowing certain instructions in a program to run multiple times until some result is achieved. The instructions might be executed zero time or might be executed multiple times until some condition is met. It is also referred to as looping or repetition. Keywords such as while, do while, for expresses iteration.

Recursion : Similar to iteration, an instruction set calls itself until the condition is met for termination. The approach can be applied to many problems and is a fundamental idea in computer science.


Structured Programming Languages

Some of the initially developed languages adhering to structure programming includes ALGOL, Pascal, PL/I, Ada, FORTRAN. Almost all of the high level programming languages support structured programming including C, JAVA, C++, Python etc.


Advantages and Disadvantages

Structure programming improves readability and maintainability of programs. It provides modularity and re-usability by making use of functions and subroutines. Improves design and productivity during the development phase.

Since the structure program adheres to strict discipline, a small change will have to be propagated to many parts of the program. It uses a large amount of memory to execute calling procedures, subroutines and functions and to maintain the information using system resources.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Programming Paradigms - Structured Programming
NP

Programming Paradigms - Structured Programming

Programming
Programming Paradigms
Structured Programming

Structured Programming

Bit History

In a computer program, control flow is the order in which set instructions are executed. A control flow statement changes program flow, to achieve specific results, by choosing a path from available paths. These statements can be based on some condition; executing instructions only when some condition is met; or can be unconditional; arbitrarily transferring the flow to some different instruction set. The goto statement was the most basic form of unconditional transfer. It transfers the control to the labelled instructions set.

GOTO LABEL;

Goto performs one-way transfer of control which means the control is not expected to return after executing the labelled instructions set. On the contrary, calling a Function usually returns the control after execution. In earlier programming, goto statements were used extensively. However, with increasing complexity it becomes harder to maintain computer programs because goto resulted in non-linear change of control flow which was harder to understand compared to linear transfer.

Dijkstra was one of the first persons to criticise the use of goto, arguing about errors and poor structure imposed by using it. He proposed the use of linear control flow transfer under high discipline, thereby eliminating the use of goto in programming and Spaghetti Code caused by goto. This is considered to be an important movement in the history of computer programming and accepted as the beginning of a new Programming paradigm, Structured Programming. It is a paradigm focusing on improving the clarity, control, quality and maintainability of a computer program by making use of disciplined structures.


Elements of Structured Programming

Structured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program.

Blocks

It is a style of grouping multiple instructions that looks like a single instruction statement. Block also helps in defining the scope of variables to avoid conflicts with other similarly named variables in the instruction set. They have an enclosing structure usually defined by keywords such as begin...end, if...fi etc. Some language supports the use of curly braces {...} to define a block.

Subroutines and Functions

It allows breaking the program into small modular sets of instructions that perform specific tasks. These modules are called subroutines or functions. They invoke each other internally in specific order to get expected results. They provide re-usability of logic.

Control Structures

It enables the control of program flow to determine the execution of instruction in a certain manner. The three main category of control structure are as follows :

Sequence : Providing a sequence of instructions to allow the computer execute them in the provided order for achieving results.

Selection : Allowing the selection of a flow from the list of available flow. This is usually done based on some condition that is evaluated to decide the next executing flow of a program. Keywords such as if...else expresses selection.

Iteration : Allowing certain instructions in a program to run multiple times until some result is achieved. The instructions might be executed zero time or might be executed multiple times until some condition is met. It is also referred to as looping or repetition. Keywords such as while, do while, for expresses iteration.

Recursion : Similar to iteration, an instruction set calls itself until the condition is met for termination. The approach can be applied to many problems and is a fundamental idea in computer science.


Structured Programming Languages

Some of the initially developed languages adhering to structure programming includes ALGOL, Pascal, PL/I, Ada, FORTRAN. Almost all of the high level programming languages support structured programming including C, JAVA, C++, Python etc.


Advantages and Disadvantages

Structure programming improves readability and maintainability of programs. It provides modularity and re-usability by making use of functions and subroutines. Improves design and productivity during the development phase.

Since the structure program adheres to strict discipline, a small change will have to be propagated to many parts of the program. It uses a large amount of memory to execute calling procedures, subroutines and functions and to maintain the information using system resources.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-structured-programming/index.txt b/blogs/programming-paradigms-structured-programming/index.txt index 4e93f42..46c1fd7 100644 --- a/blogs/programming-paradigms-structured-programming/index.txt +++ b/blogs/programming-paradigms-structured-programming/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-structured-programming","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-structured-programming\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-structured-programming","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-structured-programming\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-structured-programming","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - Structured Programming"}],["$","meta",null,{"name":"description","content":"Structured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - Structured Programming"}],["$","meta",null,{"property":"og:description","content":"Structured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-structured-programming"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-structured-programming.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - Structured Programming"}],["$","meta",null,{"name":"twitter:description","content":"Structured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-structured-programming.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - Structured Programming","date":"$D2020-10-08T00:00:00.000Z","content":"\n# Structured Programming\n\n## Bit History\n\nIn a computer program, control flow is the order in which set instructions are executed. A control flow statement changes program flow, to achieve specific results, by choosing a path from available paths. These statements can be based on some condition; executing instructions only when some condition is met; or can be unconditional; arbitrarily transferring the flow to some different instruction set. The goto statement was the most basic form of unconditional transfer. It transfers the control to the labelled instructions set.\n\n`GOTO LABEL;`\n\nGoto performs one-way transfer of control which means the control is not expected to return after executing the labelled instructions set. On the contrary, calling a [Function](/blogs/programming-paradigms-functional-programming) usually returns the control after execution. In earlier programming, goto statements were used extensively. However, with increasing complexity it becomes harder to maintain computer programs because goto resulted in non-linear change of control flow which was harder to understand compared to linear transfer.\n\n[Dijkstra](https://en.wikipedia.org/wiki/Edsger_W._Dijkstra) was one of the first persons to criticise the use of goto, arguing about errors and poor structure imposed by using it. He proposed the use of linear control flow transfer under high discipline, thereby eliminating the use of goto in programming and [Spaghetti Code](https://en.wikipedia.org/wiki/Spaghetti_code) caused by goto. This is considered to be an important movement in the history of computer programming and accepted as the beginning of a new [Programming paradigm](/blogs/programming-paradigms-what-are-programming-paradigms), Structured Programming. It is a paradigm focusing on improving the clarity, control, quality and maintainability of a computer program by making use of disciplined structures.\n\n---\n\n## Elements of Structured Programming\n\nStructured programming divides a program into simple elements which in-turn can also contain other such elements. These are the building blocks of a structured program.\n\n### Blocks\n\nIt is a style of grouping multiple instructions that looks like a single instruction statement. Block also helps in defining the scope of variables to avoid conflicts with other similarly named variables in the instruction set. They have an enclosing structure usually defined by keywords such as `begin...end`, `if...fi` etc. Some language supports the use of curly braces {...} to define a block.\n\n### Subroutines and Functions\n\nIt allows breaking the program into small modular sets of instructions that perform specific tasks. These modules are called subroutines or functions. They invoke each other internally in specific order to get expected results. They provide re-usability of logic.\n\n### Control Structures\n\nIt enables the control of program flow to determine the execution of instruction in a certain manner. The three main category of control structure are as follows :\n\n**Sequence** : Providing a sequence of instructions to allow the computer execute them in the provided order for achieving results.\n\n**Selection** : Allowing the selection of a flow from the list of available flow. This is usually done based on some condition that is evaluated to decide the next executing flow of a program. Keywords such as `if...else` expresses selection.\n\n**Iteration** : Allowing certain instructions in a program to run multiple times until some result is achieved. The instructions might be executed zero time or might be executed multiple times until some condition is met. It is also referred to as `looping` or `repetition`. Keywords such as `while`, `do while`, `for` expresses iteration.\n\n**Recursion** : Similar to iteration, an instruction set calls itself until the condition is met for termination. The approach can be applied to many problems and is a fundamental idea in computer science.\n\n---\n\n### Structured Programming Languages\n\nSome of the initially developed languages adhering to structure programming includes ALGOL, Pascal, PL/I, Ada, FORTRAN. Almost all of the high level programming languages support structured programming including C, JAVA, C++, Python etc.\n\n---\n\n### Advantages and Disadvantages\n\nStructure programming improves readability and maintainability of programs. It provides modularity and re-usability by making use of functions and subroutines. Improves design and productivity during the development phase.\n\nSince the structure program adheres to strict discipline, a small change will have to be propagated to many parts of the program. It uses a large amount of memory to execute calling procedures, subroutines and functions and to maintain the information using system resources.\n","categories":["Programming","Programming Paradigms","Structured Programming"]}}] diff --git a/blogs/programming-paradigms-what-are-programming-paradigms/index.html b/blogs/programming-paradigms-what-are-programming-paradigms/index.html index 5f22ef1..c616efb 100644 --- a/blogs/programming-paradigms-what-are-programming-paradigms/index.html +++ b/blogs/programming-paradigms-what-are-programming-paradigms/index.html @@ -1 +1 @@ -Programming Paradigms - What are Programming Paradigms ?
NP

Programming Paradigms - What are Programming Paradigms ?

Programming
Programming Paradigms

What are Programming Paradigms ?

Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it. Hence a pattern can be termed as something, a philosophy, idea, theory or method through which we approach certain actions. The same is the case around with programming.

Programming Paradigms are the certain set of constructs and ideas through which we program a machine. It is a style of writing programs.

But why do we need programming paradigms ?

Imagine this, a friend of yours asks you for a favour. Since you are good with handwriting and forming statements, on the first day the friend asks you to write his / her name on a piece of paper. Ah that’s simple, you wrote it with precise penmanship and it’s a wonderful creation you put on paper. The second day, the same friend comes to you and asks you to write a statement about his / her personality. You activate your brain cells and think of something. You put that out on a paper and the problem solved. The third day, the same friend comes to you and asks you to write an essay about his / her friendship with yours. You are now into thinking and forming patterns to write the entire thing. Assuming this situation goes around for some days and each day your friend asks you to write on different topics. Eventually you will start forming patterns and follow it in certain cases.

We have patterns when we are writing a letter, a resume, a legal notice etc. It will always be there. So in order to solve certain problems we need to follow a certain pattern. Programming paradigms are therefore needed to solve the complexities we face while writing a program. Programming paradigms are the solution evolved from years of writing code and are proven solutions to decrease complexities and increase productivity while programming any system.

Is there only a single programming paradigm ?

Well your friend won’t be asking you to write the same things over and over again. Like that the problem we are and will be dealing will not be the same. And in order to solve different problems we will need to have a different programming paradigm. Depending on the solving a problem or solution we need to implement, we can apply a programming paradigm to it.

And how programming paradigms are classified then ? It depends on different factors like sequence of operations, how the code is organised in groups, style of syntax and grammar and many other things. So depending on the problem you need to solve, you can select a programming paradigm followed by a programming language.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Programming Paradigms - What are Programming Paradigms ?
NP

Programming Paradigms - What are Programming Paradigms ?

Programming
Programming Paradigms

What are Programming Paradigms ?

Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it. Hence a pattern can be termed as something, a philosophy, idea, theory or method through which we approach certain actions. The same is the case around with programming.

Programming Paradigms are the certain set of constructs and ideas through which we program a machine. It is a style of writing programs.

But why do we need programming paradigms ?

Imagine this, a friend of yours asks you for a favour. Since you are good with handwriting and forming statements, on the first day the friend asks you to write his / her name on a piece of paper. Ah that’s simple, you wrote it with precise penmanship and it’s a wonderful creation you put on paper. The second day, the same friend comes to you and asks you to write a statement about his / her personality. You activate your brain cells and think of something. You put that out on a paper and the problem solved. The third day, the same friend comes to you and asks you to write an essay about his / her friendship with yours. You are now into thinking and forming patterns to write the entire thing. Assuming this situation goes around for some days and each day your friend asks you to write on different topics. Eventually you will start forming patterns and follow it in certain cases.

We have patterns when we are writing a letter, a resume, a legal notice etc. It will always be there. So in order to solve certain problems we need to follow a certain pattern. Programming paradigms are therefore needed to solve the complexities we face while writing a program. Programming paradigms are the solution evolved from years of writing code and are proven solutions to decrease complexities and increase productivity while programming any system.

Is there only a single programming paradigm ?

Well your friend won’t be asking you to write the same things over and over again. Like that the problem we are and will be dealing will not be the same. And in order to solve different problems we will need to have a different programming paradigm. Depending on the solving a problem or solution we need to implement, we can apply a programming paradigm to it.

And how programming paradigms are classified then ? It depends on different factors like sequence of operations, how the code is organised in groups, style of syntax and grammar and many other things. So depending on the problem you need to solve, you can select a programming paradigm followed by a programming language.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/programming-paradigms-what-are-programming-paradigms/index.txt b/blogs/programming-paradigms-what-are-programming-paradigms/index.txt index 697447b..1d7ca8f 100644 --- a/blogs/programming-paradigms-what-are-programming-paradigms/index.txt +++ b/blogs/programming-paradigms-what-are-programming-paradigms/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","programming-paradigms-what-are-programming-paradigms","d"],{"children":["__PAGE__?{\"slug\":\"programming-paradigms-what-are-programming-paradigms\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","programming-paradigms-what-are-programming-paradigms","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"programming-paradigms-what-are-programming-paradigms\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","programming-paradigms-what-are-programming-paradigms","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"Programming Paradigms - What are Programming Paradigms ?"}],["$","meta",null,{"name":"description","content":"Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"Programming Paradigms - What are Programming Paradigms ?"}],["$","meta",null,{"property":"og:description","content":"Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/programming-paradigms-what-are-programming-paradigms"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/programming-paradigms-what-are-programming-paradigms.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"Programming Paradigms - What are Programming Paradigms ?"}],["$","meta",null,{"name":"twitter:description","content":"Paradigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/programming-paradigms-what-are-programming-paradigms.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"Programming Paradigms - What are Programming Paradigms ?","date":"$D2020-07-05T00:00:00.000Z","content":"\n# What are Programming Paradigms ?\n\nParadigms are patterns. We found patterns in every phase of our day to day environment. Whether it be eating, drinking, sleeping or any other part of our life, patterns will always be a part of it. Hence a pattern can be termed as something, a philosophy, idea, theory or method through which we approach certain actions. The same is the case around with programming.\n\n> Programming Paradigms are the certain set of constructs and ideas through which we program a machine. It is a style of writing programs.\n\n## But why do we need programming paradigms ?\n\nImagine this, a friend of yours asks you for a favour. Since you are good with handwriting and forming statements, on the first day the friend asks you to write his / her name on a piece of paper. Ah that’s simple, you wrote it with precise penmanship and it’s a wonderful creation you put on paper. The second day, the same friend comes to you and asks you to write a statement about his / her personality. You activate your brain cells and think of something. You put that out on a paper and the problem solved. The third day, the same friend comes to you and asks you to write an essay about his / her friendship with yours. You are now into thinking and forming patterns to write the entire thing. Assuming this situation goes around for some days and each day your friend asks you to write on different topics. Eventually you will start forming patterns and follow it in certain cases.\n\nWe have patterns when we are writing a letter, a resume, a legal notice etc. It will always be there. So in order to solve certain problems we need to follow a certain pattern. Programming paradigms are therefore needed to solve the complexities we face while writing a program. Programming paradigms are the solution evolved from years of writing code and are proven solutions to decrease complexities and increase productivity while programming any system.\n\n## Is there only a single programming paradigm ?\n\nWell your friend won’t be asking you to write the same things over and over again. Like that the problem we are and will be dealing will not be the same. And in order to solve different problems we will need to have a different programming paradigm. Depending on the solving a problem or solution we need to implement, we can apply a programming paradigm to it.\n\nAnd how programming paradigms are classified then ? It depends on different factors like sequence of operations, how the code is organised in groups, style of syntax and grammar and many other things. So depending on the problem you need to solve, you can select a programming paradigm followed by a programming language.\n","categories":["Programming","Programming Paradigms"]}}] diff --git a/blogs/the-twelve-factor-app/index.html b/blogs/the-twelve-factor-app/index.html index 473a4c9..adeddaa 100644 --- a/blogs/the-twelve-factor-app/index.html +++ b/blogs/the-twelve-factor-app/index.html @@ -1 +1 @@ -The Twelve Factor App
NP

The Twelve Factor App

Software Engineering
Deployment
Saas

The Twelve Factor App

Nowadays software is often served over the web and is available to use everywhere. Such applications demand frequent development, operation management and scaling.

The twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time.

This article provides an overview about the twelve factors.

The factors

  • Codebase
  • Dependencies
  • Config
  • Backing services
  • Build, release, run
  • Processes
  • Port binding
  • Concurrency
  • Disposability
  • Dev/prod parity
  • Logs
  • Admin processes

Codebase

There should be one code base for one application. This code base can be used to deploy multiple instances of the same application, for e.g production site, staging and local deployments. Since the code is often maintained by version control systems such as git, these deployments can have different versions but the same code base.

Codebase
Codebase

Dependencies

Programs often depends on third party packages or libraries and are maintained using package management system, for e.g npm for node packages. These libraries can be installed system-wide or local to the application. The twelve factor app should never depend upon the system-wide installed dependencies or system-tool. System tools are the software installed on the machine. The app should make sure that all the libraries consumed are within the scope of application and must be declared using manifest file, for e.g package.json in node application.

Dependencies
Dependencies

Config

Config is the information that the application uses in deployments. This information can vary based on the type of deployment i.e production, staging, development etc. In a twelve factor app, the config that varies should never be stored within the code. The varying config should be separated from the codebase.

Config
Config

Backing services

An application depends on various locally or third party managed services by resource URL for it's execution, like databases such as PostgresSQL, messaging system such as RabbitMQ or API services from Google Maps. The twelve factor app should not distinguished between local and third party services. An app should be easily able to switch between services without making any code changes. For e.g no change in code, except config, should be required if the app decides to use hosted database service instead of local.

Backing services
Backing services

Build, release, run

The app should practise three steps for deployment i.e build, release and run; as well as maintained a strict separation between them. Build is converting the code into an executable bundle, release is setting the config for the bundle to be deployed, and run executes the bundle with the config launching it as an application.

Build, release, run
Build, release, run

Processes

The application can have multiple instances in the execution environment. The app instance should never store anything in memory for reference (stateless) and tracks the state of another app instance. Not following the principle can result in stale state for multiple instances and compromises data integrity. Any information that requires sharing between instances should be stored in persistent storage such as a database.

Processes
Processes

Port binding

The app should expose a service by binding it to a port. The service is identified by the port rather than a domain or ip address. The app should be self-contained to provide the service and doesn't rely upon the injections of a web server for exposing its service. This also allow an app to be used as backing service to another app.

Port binding
Port binding

Concurrency

The app should support and promote concurrency. It should be able to handle varying loads and requests. This principle recommends architecting the app to handle loads by organising processes based on their purpose and separating them. The application can scale out using this process model.

Concurrency
Concurrency

Disposability

The app should be able to start and stop gracefully within short time. The app should be architect to have minimum starting time to support elastic scaling and should shut down refusing new requests and finishing existing requests. The app should also be able to handle unexpected termination caused by external factors such as hardware failures.

Disposability
Disposability

Dev/prod parity

The development, staging and production environment should be kept similar. The app should be designed for continuous deployment. The developer or code owner must be closely involved in deployment. The code being written should be deployed after few hours or minutes, being written. The tools used for development and production environments should be as similar as possible.

Devprod Parity
Devprod Parity

Logs

Logs provide us with insight into the behaviour of running applications. Such logs are often written to a file on the server for later reference. This principle suggest sending log data in a stream that can be used by multiple consumers. The app should not be concerned with the storage of its output stream. It should not write to a log file, instead each process writes its event stream to standard output.

Logs
Logs

Admin processes

Administration or maintenance tasks for the app include running database migration, running scripts etc. This principle suggests considering admin processes similar to any other process of the app. The admin processes must also go through the same cycle as other processes in the app. They should be considered as a part of software life cycle development.

Admin processes
Admin processes

Conclusion

The twelve factor apps are principles designed to create applications that are easily maintained and scale. It enforces elasticity and modularity. These principles are used by many SaaS application providers.

References

12factor.net

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +The Twelve Factor App
NP

The Twelve Factor App

Software Engineering
Deployment
Saas

The Twelve Factor App

Nowadays software is often served over the web and is available to use everywhere. Such applications demand frequent development, operation management and scaling.

The twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time.

This article provides an overview about the twelve factors.

The factors

  • Codebase
  • Dependencies
  • Config
  • Backing services
  • Build, release, run
  • Processes
  • Port binding
  • Concurrency
  • Disposability
  • Dev/prod parity
  • Logs
  • Admin processes

Codebase

There should be one code base for one application. This code base can be used to deploy multiple instances of the same application, for e.g production site, staging and local deployments. Since the code is often maintained by version control systems such as git, these deployments can have different versions but the same code base.

Codebase
Codebase

Dependencies

Programs often depends on third party packages or libraries and are maintained using package management system, for e.g npm for node packages. These libraries can be installed system-wide or local to the application. The twelve factor app should never depend upon the system-wide installed dependencies or system-tool. System tools are the software installed on the machine. The app should make sure that all the libraries consumed are within the scope of application and must be declared using manifest file, for e.g package.json in node application.

Dependencies
Dependencies

Config

Config is the information that the application uses in deployments. This information can vary based on the type of deployment i.e production, staging, development etc. In a twelve factor app, the config that varies should never be stored within the code. The varying config should be separated from the codebase.

Config
Config

Backing services

An application depends on various locally or third party managed services by resource URL for it's execution, like databases such as PostgresSQL, messaging system such as RabbitMQ or API services from Google Maps. The twelve factor app should not distinguished between local and third party services. An app should be easily able to switch between services without making any code changes. For e.g no change in code, except config, should be required if the app decides to use hosted database service instead of local.

Backing services
Backing services

Build, release, run

The app should practise three steps for deployment i.e build, release and run; as well as maintained a strict separation between them. Build is converting the code into an executable bundle, release is setting the config for the bundle to be deployed, and run executes the bundle with the config launching it as an application.

Build, release, run
Build, release, run

Processes

The application can have multiple instances in the execution environment. The app instance should never store anything in memory for reference (stateless) and tracks the state of another app instance. Not following the principle can result in stale state for multiple instances and compromises data integrity. Any information that requires sharing between instances should be stored in persistent storage such as a database.

Processes
Processes

Port binding

The app should expose a service by binding it to a port. The service is identified by the port rather than a domain or ip address. The app should be self-contained to provide the service and doesn't rely upon the injections of a web server for exposing its service. This also allow an app to be used as backing service to another app.

Port binding
Port binding

Concurrency

The app should support and promote concurrency. It should be able to handle varying loads and requests. This principle recommends architecting the app to handle loads by organising processes based on their purpose and separating them. The application can scale out using this process model.

Concurrency
Concurrency

Disposability

The app should be able to start and stop gracefully within short time. The app should be architect to have minimum starting time to support elastic scaling and should shut down refusing new requests and finishing existing requests. The app should also be able to handle unexpected termination caused by external factors such as hardware failures.

Disposability
Disposability

Dev/prod parity

The development, staging and production environment should be kept similar. The app should be designed for continuous deployment. The developer or code owner must be closely involved in deployment. The code being written should be deployed after few hours or minutes, being written. The tools used for development and production environments should be as similar as possible.

Devprod Parity
Devprod Parity

Logs

Logs provide us with insight into the behaviour of running applications. Such logs are often written to a file on the server for later reference. This principle suggest sending log data in a stream that can be used by multiple consumers. The app should not be concerned with the storage of its output stream. It should not write to a log file, instead each process writes its event stream to standard output.

Logs
Logs

Admin processes

Administration or maintenance tasks for the app include running database migration, running scripts etc. This principle suggests considering admin processes similar to any other process of the app. The admin processes must also go through the same cycle as other processes in the app. They should be considered as a part of software life cycle development.

Admin processes
Admin processes

Conclusion

The twelve factor apps are principles designed to create applications that are easily maintained and scale. It enforces elasticity and modularity. These principles are used by many SaaS application providers.

References

12factor.net

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/blogs/the-twelve-factor-app/index.txt b/blogs/the-twelve-factor-app/index.txt index bded561..5183d55 100644 --- a/blogs/the-twelve-factor-app/index.txt +++ b/blogs/the-twelve-factor-app/index.txt @@ -3,12 +3,12 @@ 0:[[["",{"children":["blogs",{"children":[["slug","the-twelve-factor-app","d"],{"children":["__PAGE__?{\"slug\":\"the-twelve-factor-app\"}",{}]}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:HL["/_next/static/css/2fd3c970a312a5ab.css",{"as":"style"}] 6:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +7:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 8:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 9:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} a:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} c:I{"id":"1978","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 3:[["$","html",null,{"lang":"en","children":[["$","$L6",null,{"async":true,"src":"https://www.googletagmanager.com/gtag/js?id=UA-171631214-1"}],["$","$L6",null,{"id":"google-analytics","strategy":"afterInteractive","children":"window.dataLayer = window.dataLayer || [];\n function gtag() {\n dataLayer.push(arguments);\n }\n gtag(\"js\", new Date());\n \n gtag(\"config\", \"UA-171631214-1\");\n "}],["$","$L6",null,{"data-ad-client":"ca-pub-4302795410966209","async":true,"src":"https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"}],["$","body",null,{"children":["$","$L7",null,{"children":[["$","$L8",null,{}],["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$","$L9",null,{"parallelRouterKey":"children","segmentPath":["children","blogs","children",["slug","the-twelve-factor-app","d"],"children"],"error":"$undefined","errorStyles":"$undefined","loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"template":["$","$La",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","asNotFound":"$undefined","childProp":{"current":["$Lb",null],"segment":"__PAGE__?{\"slug\":\"the-twelve-factor-app\"}"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/2fd3c970a312a5ab.css","precedence":"next"}]]}],"segment":["slug","the-twelve-factor-app","d"]},"styles":[]}],"segment":"blogs"},"styles":[]}],["$","$Lc",null,{}]]}]}]]}],null] 4:[[["$","meta",null,{"charSet":"utf-8"}],["$","title",null,{"children":"The Twelve Factor App"}],["$","meta",null,{"name":"description","content":"The twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time."}],null,[[["$","link",null,{"rel":"author","href":"https://github.com/nishantpainter"}],["$","meta",null,{"name":"author","content":"Nishant Painter"}]]],null,null,null,null,null,null,["$","meta",null,{"name":"viewport","content":"width=device-width, initial-scale=1"}],null,null,null,null,null,null,null,null,["$","meta",null,{"name":"category","content":"technology"}],null,[]],[null,null,null,null],null,null,[null,null,null,null,null],null,[null,["$","meta",null,{"property":"og:title","content":"The Twelve Factor App"}],["$","meta",null,{"property":"og:description","content":"The twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time."}],["$","meta",null,{"property":"og:url","content":"https://nishantpainter.com//blogs/the-twelve-factor-app"}],null,null,null,null,[[["$","meta",null,{"property":"og:image","content":"https://nishantpainter.com/img/og/the-twelve-factor-app.png"}]]],null,null,null,null,null,null,[["$","meta",null,{"property":"og:type","content":"article"}],null,null,null,null,null,null]],[["$","meta",null,{"name":"twitter:card","content":"summary_large_image"}],null,null,null,null,["$","meta",null,{"name":"twitter:title","content":"The Twelve Factor App"}],["$","meta",null,{"name":"twitter:description","content":"The twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time."}],[[["$","meta",null,{"name":"twitter:image","content":"https://nishantpainter.com/img/og/the-twelve-factor-app.png"}]]],null,null],null,[null,[["$","link",null,{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"any"}]],[],null]] -d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +d:I{"id":"6831","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} b:["$","$Ld",null,{"blog":{"title":"The Twelve Factor App","date":"$D2023-06-08T00:00:00.000Z","content":"\n# The Twelve Factor App\n\nNowadays software is often served over the web and is available to use everywhere. Such applications demand frequent development, operation management and scaling.\n\nThe twelve factor app is a set of practices followed by developers after observing a variety of software as a service in the market. The significance of following this methodology is to promote the growth of application, easing the maintenance and limiting the cost of software over the time.\n\nThis article provides an overview about the twelve factors.\n\n## The factors\n\n- [Codebase](#codebase)\n- [Dependencies](#dependencies)\n- [Config](#config)\n- [Backing services](#backing-services)\n- [Build, release, run](#build-release-run)\n- [Processes](#processes)\n- [Port binding](#port-binding)\n- [Concurrency](#concurrency)\n- [Disposability](#disposability)\n- [Dev/prod parity](#devprod-parity)\n- [Logs](#logs)\n- [Admin processes](#admin-processes)\n\n## Codebase\n\n**There should be one code base for one application**. This code base can be used to deploy multiple instances of the same application, for e.g production site, staging and local deployments. Since the code is often maintained by version control systems such as git, these deployments can have different versions but the same code base.\n\n
\n\n## Dependencies\n\nPrograms often depends on third party packages or libraries and are maintained using package management system, for e.g `npm` for `node` packages. These libraries can be installed system-wide or local to the application. **The twelve factor app should never depend upon the system-wide installed dependencies or system-tool**. System tools are the software installed on the machine. The app should make sure that all the libraries consumed are within the scope of application and must be declared using manifest file, for e.g `package.json` in `node` application.\n\n
\n\n## Config\n\nConfig is the information that the application uses in deployments. This information can vary based on the type of deployment i.e `production`, `staging`, `development` etc. **In a twelve factor app, the config that varies should never be stored within the code**. The varying config should be separated from the codebase.\n\n
\n\n## Backing services\n\nAn application depends on various locally or third party managed services by resource URL for it's execution, like databases such as `PostgresSQL`, messaging system such as `RabbitMQ` or API services from `Google Maps`. **The twelve factor app should not distinguished between local and third party services**. An app should be easily able to switch between services without making any code changes. For e.g no change in code, except config, should be required if the app decides to use hosted database service instead of local.\n\n
\n\n## Build, release, run\n\n**The app should practise three steps for deployment i.e build, release and run; as well as maintained a strict separation between them**. `Build` is converting the code into an executable bundle, `release` is setting the config for the bundle to be deployed, and `run` executes the bundle with the config launching it as an application.\n\n
\n\n## Processes\n\nThe application can have multiple instances in the execution environment. **The app instance should never store anything in memory for reference (stateless) and tracks the state of another app instance**. Not following the principle can result in stale state for multiple instances and compromises data integrity. Any information that requires sharing between instances should be stored in persistent storage such as a database.\n\n
\n\n## Port binding\n\n**The app should expose a service by binding it to a port**. The service is identified by the port rather than a domain or ip address. The app should be self-contained to provide the service and doesn't rely upon the injections of a web server for exposing its service. This also allow an app to be used as backing service to another app.\n\n
\n\n## Concurrency\n\n**The app should support and promote concurrency**. It should be able to handle varying loads and requests. This principle recommends architecting the app to handle loads by organising processes based on their purpose and separating them. The application can scale out using this process model.\n\n
\n\n## Disposability\n\n**The app should be able to start and stop gracefully within short time**. The app should be architect to have minimum starting time to support elastic scaling and should shut down refusing new requests and finishing existing requests. The app should also be able to handle unexpected termination caused by external factors such as hardware failures.\n\n
\n\n## Dev/prod parity\n\n**The development, staging and production environment should be kept similar**. The app should be designed for continuous deployment. The developer or code owner must be closely involved in deployment. The code being written should be deployed after few hours or minutes, being written. The tools used for development and production environments should be as similar as possible.\n\n
\n\n## Logs\n\nLogs provide us with insight into the behaviour of running applications. Such logs are often written to a file on the server for later reference. **This principle suggest sending log data in a stream that can be used by multiple consumers**. The app should not be concerned with the storage of its output stream. It should not write to a log file, instead each process writes its event stream to standard output.\n\n
\n\n## Admin processes\n\nAdministration or maintenance tasks for the app include running database migration, running scripts etc. **This principle suggests considering admin processes similar to any other process of the app**. The admin processes must also go through the same cycle as other processes in the app. They should be considered as a part of software life cycle development.\n\n
\n\n## Conclusion\n\nThe twelve factor apps are principles designed to create applications that are easily maintained and scale. It enforces elasticity and modularity. These principles are used by many SaaS application providers.\n\n## References\n\n[12factor.net](https://12factor.net)\n","categories":["Software Engineering","Deployment","Saas"]}}] diff --git a/contact/index.html b/contact/index.html index a35e48b..80a4633 100644 --- a/contact/index.html +++ b/contact/index.html @@ -1 +1 @@ -Contact | Nishant Painter
NP

Contact

Hello 👋 We work with these technologies.
Feel free to reach out for one-to-one mentorship and trainings, industrial training, queries and consultations.

Send me an email
virtual.nishantpainter@gmail.com

Twitter
@nishantpainter

LinkedIN

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Contact | Nishant Painter
NP

Contact

Hello 👋 We work with these technologies.
Feel free to reach out for one-to-one mentorship and trainings, industrial training, queries and consultations.

Send me an email
virtual.nishantpainter@gmail.com

Twitter
@nishantpainter

LinkedIN

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/contact/index.txt b/contact/index.txt index e373a0c..90d7375 100644 --- a/contact/index.txt +++ b/contact/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["contact",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/index.html b/index.html index adfc2dc..31ab389 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Nishant Painter
NP

Nishant Painter

Computer Programmer 💻🕹️☯️

Blogs
Projects
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Nishant Painter
NP

Nishant Painter

Computer Programmer 💻🕹️☯️

Blogs
Projects
Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/index.txt b/index.txt index f1f4186..bb397c0 100644 --- a/index.txt +++ b/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/projects/index.html b/projects/index.html index 4e9c636..9d89b81 100644 --- a/projects/index.html +++ b/projects/index.html @@ -1 +1 @@ -Projects | Nishant Painter
NP

Projects

Personal Kanban
Image for personal kanban

Personal Kanban is an offline capable application or tool that implements kanban to manage work at personal level. Work items can be represented as records and columns to depict each stage of your work process. Columns can be as simple as ¨todo ¨, ¨in-progress ¨ and ¨done¨, or it can be complex to suit your flow.

It´s a tool to visualize and optimize your workflow. Physical boards are popular among few, while virtual boards like Personal Kanban play a critical role in agile software development considering their accessibility, simplicity and elegant display. Regardless of whether a board is physical or virtual, it must depict work visually along with clearly identifying the blockage and other dependencies. Each of these features are offered seamlessly by Personal Kanban.

Plan your work with flexibility, identify and resolve bottlenecks and overview your complete work visually.

See Project
Tiny Manager
Image for tiny manager

Tiny Manager is a simple application that assists you in managing your pet projects. Along with project management it allows mundane management using todos and a simple notepad application, all at one place.

Timesheet
Image for timesheet

Timesheet is an application for managing and quickly accessing your daily work time. It has a minimalistic features set required and sleek design. Stop opening, closing your local text editor for persisting and calculating the timesheet and hours manually. Start using Timesheet now.

Made in India CSS
Image for made in india css

Made in India CSS is a collection of 15 distinct background patterns generated using linear and radial CSS gradients. You can use these tricolor gradient patterns in building your website or web application by importing the made-in-india css file and using various class.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Projects | Nishant Painter
NP

Projects

Personal Kanban
Image for personal kanban

Personal Kanban is an offline capable application or tool that implements kanban to manage work at personal level. Work items can be represented as records and columns to depict each stage of your work process. Columns can be as simple as ¨todo ¨, ¨in-progress ¨ and ¨done¨, or it can be complex to suit your flow.

It´s a tool to visualize and optimize your workflow. Physical boards are popular among few, while virtual boards like Personal Kanban play a critical role in agile software development considering their accessibility, simplicity and elegant display. Regardless of whether a board is physical or virtual, it must depict work visually along with clearly identifying the blockage and other dependencies. Each of these features are offered seamlessly by Personal Kanban.

Plan your work with flexibility, identify and resolve bottlenecks and overview your complete work visually.

See Project
Tiny Manager
Image for tiny manager

Tiny Manager is a simple application that assists you in managing your pet projects. Along with project management it allows mundane management using todos and a simple notepad application, all at one place.

Timesheet
Image for timesheet

Timesheet is an application for managing and quickly accessing your daily work time. It has a minimalistic features set required and sleek design. Stop opening, closing your local text editor for persisting and calculating the timesheet and hours manually. Start using Timesheet now.

Made in India CSS
Image for made in india css

Made in India CSS is a collection of 15 distinct background patterns generated using linear and radial CSS gradients. You can use these tricolor gradient patterns in building your website or web application by importing the made-in-india css file and using various class.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/projects/index.txt b/projects/index.txt index 9c33daa..a89c91f 100644 --- a/projects/index.txt +++ b/projects/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["projects",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/publications/index.html b/publications/index.html index 31eea8e..ab97a48 100644 --- a/publications/index.html +++ b/publications/index.html @@ -1 +1 @@ -Publication | Nishant Painter
NP

Publications

Machine-Learning-Based Android Malware Detection Techniques—A Comparative Analysis
Information and Communication Technology for Sustainable Development

Today, Smartphones can handle myriad of programs and applications that perform a wide varieties of functions. In recent years, Android has been a globally anticipated open source operating system for Smartphones. However, rapid advancement of Android is marred with augmenting threats of Android malwares that perform pernicious activities on Smartphones. Malwares exercising different techniques to dodge existing detection methods offer uncommon challenges for their accurate detection. Signature-based detection approach and machine-learning-based detection approach are the broad classifications for existing Android malware detection techniques. Researchers and antimalware companies have identified the inefficiency of signature-based detection approach and shifted to machine-learning-based detection approach to overcome the limitations of signature-based detection approach. This paper disserts existing machine-learning-based Android malware detection techniques and presents parametric comparison of discussed malware detection techniques. Hence, this paper targets to study various machine-learning-based detection techniques and to establish probable future directions.

See Publication
Comparative Analysis of Android Malware Detection Techniques
Information and Communication Technology for Sustainable Development

In recent years, the widespread adoption of smartphones has led to a new age of information exchange. Among smartphones, Android devices have gained huge popularity due to the open architecture of Android and advanced programmable software framework to develop mobile applications. However, the pervasive adoption of Android is coupled with progressively uncontrollable malware threats. This paper gives an insight of existing work in Android malware detection. Additionally, this paper highlights the parametric comparison of existing Android malware detection techniques. Thus, this paper aims to study various Android malware detection techniques and to identify plausible research direction.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file +Publication | Nishant Painter
NP

Publications

Machine-Learning-Based Android Malware Detection Techniques—A Comparative Analysis
Information and Communication Technology for Sustainable Development

Today, Smartphones can handle myriad of programs and applications that perform a wide varieties of functions. In recent years, Android has been a globally anticipated open source operating system for Smartphones. However, rapid advancement of Android is marred with augmenting threats of Android malwares that perform pernicious activities on Smartphones. Malwares exercising different techniques to dodge existing detection methods offer uncommon challenges for their accurate detection. Signature-based detection approach and machine-learning-based detection approach are the broad classifications for existing Android malware detection techniques. Researchers and antimalware companies have identified the inefficiency of signature-based detection approach and shifted to machine-learning-based detection approach to overcome the limitations of signature-based detection approach. This paper disserts existing machine-learning-based Android malware detection techniques and presents parametric comparison of discussed malware detection techniques. Hence, this paper targets to study various machine-learning-based detection techniques and to establish probable future directions.

See Publication
Comparative Analysis of Android Malware Detection Techniques
Information and Communication Technology for Sustainable Development

In recent years, the widespread adoption of smartphones has led to a new age of information exchange. Among smartphones, Android devices have gained huge popularity due to the open architecture of Android and advanced programmable software framework to develop mobile applications. However, the pervasive adoption of Android is coupled with progressively uncontrollable malware threats. This paper gives an insight of existing work in Android malware detection. Additionally, this paper highlights the parametric comparison of existing Android malware detection techniques. Thus, this paper aims to study various Android malware detection techniques and to identify plausible research direction.

Image for social site githubImage for social site linkedinImage for social site stackoverflowImage for social site medium
© 2020 - 2023 Nishant Painter. All Rights Reserved.
\ No newline at end of file diff --git a/publications/index.txt b/publications/index.txt index ebde363..a0b0215 100644 --- a/publications/index.txt +++ b/publications/index.txt @@ -2,7 +2,7 @@ 2:HL["/_next/static/css/986d56ae264b3548.css",{"as":"style"}] 0:[[["",{"children":["publications",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/986d56ae264b3548.css","precedence":"next"}]],["$L4",["$","meta",null,{"name":"next-size-adjust"}]]]]] 5:I{"id":"5034","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} -6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-58c72bf823524d24.js"],"name":"","async":false} +6:I{"id":"4513","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","1:static/chunks/1-e7ecfedc4d37742a.js","688:static/chunks/app/blogs/[slug]/page-f1a11f58620b0c94.js"],"name":"","async":false} 7:I{"id":"3336","chunks":["519:static/chunks/519-a3b077c6f8d3e235.js","49:static/chunks/49-aaf7e9eaea2df6f0.js","215:static/chunks/215-778e6a8571e20536.js","861:static/chunks/861-51134c186efb5132.js","17:static/chunks/17-be20e367e8a4b979.js","877:static/chunks/877-d3eb9241e1106165.js","198:static/chunks/198-170cda3e949c7f24.js","918:static/chunks/918-b951c540ee28c158.js","185:static/chunks/app/layout-cdbf8e91849b01ee.js"],"name":"","async":false} 8:I{"id":"3791","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} 9:I{"id":"9877","chunks":["272:static/chunks/webpack-0ccd4dfd07ca212e.js","802:static/chunks/f2e3bb05-98d58b5180d8bf6e.js","664:static/chunks/664-10d7fc4ddae56491.js"],"name":"","async":false} diff --git a/sitemap.xml b/sitemap.xml index 0c4e971..2672a50 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,126 +2,126 @@ https://nishantpainter.com -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/design-patterns-how-to-write-a-design-pattern -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/design-patterns-what-are-design-patterns -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-abstraction -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-arity -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-composition -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-currying -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-decomposition -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-first-class-function -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-higher-order-function -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-immutability -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-memoization -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-partial-application -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-pure-function -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-recursion -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-referential-transparency -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-shared-state -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-side-effect -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/functional-programming-tail-call-optimization -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-functional-programming -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-imperative-and-declarative-programming -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-object-oriented-programming -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-procedural-programming -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-structured-programming -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/programming-paradigms-what-are-programming-paradigms -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/blogs/the-twelve-factor-app -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/projects -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/publications -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/about -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z https://nishantpainter.com/contact -2023-06-25T06:48:59.052Z +2023-07-14T02:38:05.671Z