Comparison between Static and Dynamic Programming Languages

by Web Development

There is confusion between words static and dynamic to describe the type systems of programming languages. Here we will discuss about these two types of programming languages in details.

In computer language the word static mean fixed while dynamic means capable of actions and/or change. Both terms are used for programming languages, web pages and different application programs. When a computer user requested a web page by entering URL in Address bar then server return the page in HTML form and browser displays it. On Static web page this is all while in dynamic web page you can change or do some other actions to the related page.

Static and Dynamic programming languages are high level languages that enables development of program in much simpler programming context. The biggest difference between both languages is name of variable. In static programming languages variable name is bound with both type and object but in dynamic programming languages variable is only bound with object. In static programming language, once a variable name is bound to a type it can be bound only to objects of that type. It can’t be bound to object of different type. Any attempt to bind the name of object to wrong type will raise an exception. In dynamic languages name is bound to object at execution time and it is possible to bind a name of objects of different types during execution of program.

Comparison between Static and Dynamic Programming LanguagesHere is an example of static and dynamic languages:

In static programming language, if name Studentname=5 is integer type then you can’t bind it with string type because it is an illegal approach. If Studentname is declared integer then you can’t change its type to string and if it is declared in string then you can’t change its type to integer. But in dynamic programming language there is no restriction and its perfectly fine.

StudentName = 5

StudentName =”Ali’

We can see that Dynamic approach is more advance and evolved, here are some advantages.

  • There is no need to compile and build. You just need to code and test followed by deploy to production.
  • The nature of variables allows the type to be determined at run time, it shows more flexible code.
  • Switch statement are not bound to single type.
  • It is more concise and attractive too.

Static Approach also has some Advantages.

  • The type is determined at runtime while dynamic languages have much runtime errors and take much more time to tracking down runtime errors.
  • Static languages are much faster than Dynamic languages.
  • Static languages make programmer more accountable while Dynamic language make programmer more hazard and encourages bad habits.

Static Programming languages are C, C++, java, C# and Objective-C.

Dynamic Programming languages are Python, Ruby and Java Script.