The dynamics of Dynamic programming languages

One of the things that fascinates me when it comes to programming is the underlaying architecture which allows programs to be executed on your computer. I think it is interesting to know how data is handled. There are many ways of handling data. Usually all the data has got a type bound to it. That means that if we have a value then it must be of a type to ensure some kind of safety at runtime. You declare a variable of type int and it will forever, in the liftime of the program, be a variable of that kind. The compiler will automatically cast an error if you assign a string of character (text) to the it. This is called static typing.

In difference to this there is a concept where you do not need to think of types in this way. In most dynamic programming languages variables do not have fixed types and you can therefore assign what kind of value you want to it. The type will change to the one of the new value at runtime. And to say there are implicit conversions between different types and you do not have to worry about if you want to cast an int to a double or vice versa. This is called dynamic typing. It will be done without any extra effort from you. So the languages are still type aware in a manner. I will now talk more about ideals type-safety. You need to be aware of languages and their differences. I will later mention the behaviours of PHP and its flaws.

Type-safety is a lot. In static programming (the first part) you have the notion of variables with fixed types, and that is an implementation of type-safety. But there is so much more. You do not need to have typed variables to be a lot less than that. Type-safety is also about having a set system where you get the behaviour you want and prevent the unwanted from happening. Many traditional programmers prefer static typing and what it gives because you are guaranteed to write less buggy programs and then execute them “safely”. On the other hand, an experienced programmer may also use a dynamic language despite this and produce safe code without the safety provided by static typing. It depends on the programmer, and of course the underlaying runtime which hopefully protects you from doing things fatal to your system.

All languages are either classified as strongly- or weakly typed depending on their way of handling the types of data. That is regardless of whether it is a statically typed language or not. PHP is an example of a weakly typed language.

Productivity is said to be larger with a dynamic programming language than with a typed because you do not really care about types as much in static, non-dynamic languages, like C, C++, C# and Java. You are then simply concentrating at the algorithms and logic, and not the types of the objects.

Now let us continue with type-safety. PHP is for instance not a very type-safe language (weakly typed in other words) because you may do what ever you want and the runtime will not complain but do exactly what you wrote, unless it is syntactic or logical. If you add a boolean value (true or false) with a number you will probably add them as a number. If you just want to add these as a string you may have to write some more code. But because PHP is a scripting language you may try as you write to find errors in your code. There is usually no way of becoming aware of them when writing the programs, or scripts. Errors are deteced at runtime in the realm of dynamic programming languages.

This tells you that runtime is what matters in dynamic languages, opposed to compile-time which is important in many statically typed languages. That is why very few dynamic languages needs to be compiled before execution. It is carried out on the fly when entering it in the console. Reflection and runtime alteration are usually a feature of the most renowned languages. Everything happens at runtime, baby!

Another dynamic scripting language is Python. It is regarded as one of the most popular of its kind. There is a significant difference in the way it handles types, as in any framework of a programming language. No programming language has the same architecture. Many share similarities though. Python is truly a scripting language and the fact that it comes with an interpreter really confirms that.

The interpreter allows you to type code in a console. The code will then be executed on the fly, dynamically! This is common for many scripting languages. It gives developers a way of really try as they write.

Other features common to dynamic programming languages are support for functional programming. Most of the concepts initially derive from LISP.

So there are many advantages and disadvantages with dynamic programming languages, like all programming languages. I do not want to argue about which one is the best. I think that programming languages shall be chosen by need, and then it is up to the programmer, YOU, to use it right. As a developer you always have to adopt new ways and new techniques to be up to date in a constantly changing world of bits and bytes, data.

Thanks for reading.

0 Responses to “The dynamics of Dynamic programming languages”



  1. No Comments Yet

Leave a Reply





Robert Sundström

Tweets

  • Waiting for the VS 2010 Beta 2 to be released to public. Only a couple of hours left. But still not sure when. Is it local time? 3 weeks ago
  • Writing meaningless programs.. 3 weeks ago
  • I consider myself being a logical being, but my logic is flaud. 3 weeks ago
  • SvD: Facebook gör dig smart – men Twitter fördummar (http://bit.ly/14XGNr 2 months ago
  • 2 weeks have passed since I came to Karlskrona. I pretty much enjoy living here. College has started and so far little coursework. 2 months ago

Recent Comments

Steve on Windows 3.11 on a virtual…
catchmikey on Wakoopa
Hillary on First days in Delsbo
wilhol on PC or Mac?

Categories

Calendar

June 2009
M T W T F S S
« May   Jul »
1234567
891011121314
15161718192021
22232425262728
2930  

Blog Stats

  • 15,396 hits