Skip to main content

Posts

Showing posts with the label Programming

Functional & Object Oriented Language Cheats

  Functional programming First class functions - Functions can be passed as functions or return functions Function Composition - Chained Functional calls Prevent Side effects - Using  Immutability Pure Functions - No Side Effects - Same output for same input Parallelism - Pure function acting on immutable data   1. Immutable data & Pure Functions -  Scala Constructs - Scala uses val keyword to declare the variable, which is immutable declaration.   Pure functions don't read value from the external world, they don't modify the data, instead produce the new value  Java Constructs - Java uses final   keyword to declare the variable reference as Immutable, i.e once the value is assigned to the variable it cannot be reassigned.  Lombok -  https://projectlombok.org/features/val  , val was introduced in lombok that gets replaced to final var Java is the Strict type language, i.e. we need to declare the data type of the v...