Let's stop for a moment and think about what comes after platinum? Let's stop and think about who is your Mom's favourite child? The answer is Mahdi Yusuf. Nice to meet you. I am a software developer. P.S. I am sure your Mom loves us equally. Mahdi is a DZone MVB and is not an employee of DZone and has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

Choosing Static vs. Dynamic Languages for Your Startup

  • submit to reddit

Everyone is thinking why in the world would anyone pick static, when you can be dynamic? Usually the thought process is, "what language am I most proficient in, that can do the job." Totally not a bad way to go about it. Now does this choice affect anything else? Testing? Speed of development? Robustness?

Dynamic vs. Static

Dynamic languages are languages that don’t necessarily need variables to be declared before they are used. Examples of dynamic languages are Python, Ruby, and PHP. So in dynamic languages the following is possible:

num = 10

We have successfully assigned a value to variable without declaring it before hand. Simple enough, try doing this in Java (you can’t). This can *increase* development speed, without having to write boilerplate code. This can somewhat be a double edge sword, since dynamic languages types are checked during runtime, there is no way to tell if there is a bug in code until it is run. I know you can test, but you can’t test for everything. You can’t test for everything. Here is an example albeit trivial.

def get_first_problem(problems):
    for problem in problems:
        problam = problem + 1
        return problam

Now if you are raging to some serious dubstep, its easy enough to miss that small typo, you go screw it and do it live, and deploy to production. Python will simply create the new variable and not a single thing will be said.

Only you can stop bugs in production!

Static languages are languages that variables need to be declared before use and type checking is done at compile time. Examples of static languages include Java, C, and C++. So in static languages the following is enforced

static int awesomeNumber;

awesomeNumber = 10;

Many argue this increases robustness as well as decrease chances of Runtime Errors. Since the compiler will catch those horrible horrible mistakes you made throughout your code. Your methods contracts are tighter, downside to this is crap ton of boilerplate code.

Weak and Strong Typing can be often be confused with dynamic and static languages. Weak typed languages can lead to philosophical questions like what does the number 2 added to the word ‘two’ give you? Things like this are possible with a weak typed language.

a = 2
b = "2"
concatenate(a, b) // Returns "22"
add(a, b) // Returns 4

Traditionally languages may place restriction on what transaction may occur for example in a strong typed language adding a string and integer will result in a type error as shown below.

>>> a = 10
>>> b = 'ten'
>>> a + b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'


Regardless of where you land on this discussion, claiming one is better than the other would lead to flame war, but there are places where each is strong.

Dynamic languages are good for fast quick development cycles and prototyping, while static languages are better suited to longer development cycles where trivial bugs could be extremely costly (telecommunication systems, air traffic control).

For example if some giant company called Moo Corp. spent millions of dollars on QA and Testing and a bug somehow gets into the field, to fix it would mean another round of testing. When sitting in that chair the choice is clear static languages FTW, its a hard job but someone has to milk the cows.

Test, test, and test.

Just a little food for thought, for when you are starting your next project. You never know what limitations you maybe placing on yourself and your team.

What do you do consider when selecting a programming language for a project?


Published at DZone with permission of Mahdi Yusuf, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Chris Travers replied on Tue, 2012/09/25 - 3:49am

One of the things I have come to really love about Perl is the way you can essentially make it behave more like a strongly typed language if you want.  Strict mode, for example, addresses your Python bug, and if it were to happen in Perl would throw an error because you haven't declared a scope yet.  Similarly Moose gives you type checking at runtime, so you know that you integer field is always an integer.  Of course the more checking you want to do the more boilerplate you have to write.  Thats the way it is.

So one additional point I would make is that whatever language you go with look for tools that allow you to move along that grid.  For example, if using Perl, look carefully at Moose and strict mode.  Moose imposes a significant startup cost so you might choose not to use it on that basis alone.  However, strict mode is vital.  Look for similar tools in your language of choice and make informed decisions about whether or not to use them.

Uilian Souza replied on Tue, 2012/09/25 - 9:33am

Following Chris's line of thought, I think Groovy and Grails can offer a good balance between productivity and robustness, and both have a great IDE support in SpringSource GG.

And you still can reuse all available Java ecosystem.

Just my two cents ;)

Peterfreeman Osama replied on Sun, 2014/01/12 - 9:58am

  would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance.

customer service skills listhr source consultinghuman resources internships superior staffingproject proposal template

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.