Polyglot Language Paradigms

Static Typing VS Dynamic Typing

Static

Static typed programming languages are those in which variables need not be defined before they’re used. This implies that static typing has to do with the explicit declaration (or initialization) of variables before they’re employed. Java is an example of a static typed language; C and C++ are also static typed languages.

Dynamic

Dynamic typed programming languages are those languages in which variables must necessarily be defined before they are used. This implies that dynamic typed languages do not require the explicit declaration of the variables before they’re used. Python is an example of a dynamic typed programming language, and so is PHP.

Strong Typing VS Weak Typing

Strong

Programming languages in which variables have specific data types are strong typed. This implies that in strong typed languages, variables are necessarily bound to a particular data type. Python is strong typed, and so is Java.

Weak

As opposed to strong typed languages, weak typed languages are those in which variables are not of a specific data type. It should be noted that this does not imply that variables do not have types; it does mean that variables are not "bound" to a specific data type. PHP and C are examples of weak typed languages.

Compiled Language VS Interpreted Language

Compiled

A compiled language is coded by a human, then that source code translates into assembly language so that the target program runs and returns a desired result. C is an example of a compiled language. The benefits of using a compiler to compile code is that the final product generally runs faster than interpreted code because it doesn't need to compile on the fly while the application is running.

Interpreted

An interpreted language, however, is compiled in real time when it's run, and it often uses simpler and more human-friendly syntax for coding. Python is a popular interpreted language. In general, interpreted code runs more slowly than compiled code because the interpreter translates the program on-the-fly into something the machine can handle.

Server-Side Programming

It is the program that runs on server dealing with the generation of content of web page.

1) Querying the database

2) Operations over databases

3) Access/Write a file on server.

4) Interact with other servers.

5) Structure web applications.

6) Process user input. For example if user input is a text in search box, run a search algorithm on data stored on server and send the results.

Examples :

The Programming languages for server-side programming are :

1) PHP

2) C++

3) Java and JSP

4) Python

5) Ruby on Rails

Object-oriented programming

Programming or OOPs refers to languages that uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.

OOPs Concepts:

Functional Programming Paradigm

Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions style. It is a declarative type of programming style. Its main focus is on “what to solve” in contrast to an imperative style where the main focus is “how to solve”. It uses expressions instead of statements. An expression is evaluated to produce a value whereas a statement is executed to assign variables.

Programming Languages that support functional programming:

 Haskell, JavaScript, Scala, Erlang, Lisp, ML, Clojure, OCaml, Common Lisp, Racket.

Concepts of functional programming:

  • Pure functions

  • Recursion

  • Referential transparency

  • Functions are First-Class and can be Higher-Order

  • Variables are Immutable

Advantages:

  1. Pure functions are easier to understand because they don’t change any states and depend only on the input given to them. Whatever output they produce is the return value they give. Their function signature gives all the information about them i.e. their return type and their arguments.

  2. The ability of functional programming languages to treat functions as values and pass them to functions as parameters make the code more readable and easily understandable.

  3. Testing and debugging is easier. Since pure functions take only arguments and produce output, they don’t produce any changes don’t take input or produce some hidden output. They use immutable values, so it becomes easier to check some problems in programs written uses pure functions.

  4. It is used to implement concurrency/parallelism because pure functions don’t change variables or any other data outside of it.

  5. It adopts lazy evaluation which avoids repeated evaluation because the value is evaluated and stored only when it is needed.

Disadvantages:

  1. Sometimes writing pure functions can reduce the readability of code.

  2. Writing programs in recursive style instead of using loops can be bit intimidating.

  3. Writing pure functions are easy but combining them with rest of application and I/O operations is the difficult task.

  4. Immutable values and recursion can lead to decrease in performance.

Applications:

  • It is used in mathematical computations.

  • It is needed where concurrency or parallelism is required.

Reference

server-side-client-side-programming

functional-programming-paradigm

object-oriented-programming-oops-concept

compiled-language

Previous
Previous

#NoMoreApologies

Next
Next

Law of Demeter