Welcome to Office Zealot Sign in | Join | Help
Dynamic languages vs. static languages.

 I recently stated doing some work with JavaScript as part of working on infoPath Forms Server. I realized that you can do some pretty powerful and cool things with JavaScript however the lack of strong types is a little hard to get used to.

In Java script you can do things like:

function TestFunction()

{

  

    var myVariable = 33;

    alert(i);

 

    myVariable = CallBack;

   

    myVariable();

 

}

 

function CallBack()

{

    alert("CallBack");

}

In this example I create a variable named myVariable and assign the integer value 33 to it. Then I assign the value or location of the function CallBack to the variable myVariable.

I then invoke the function by treating it as a function i.e. myVariable().

This is pretty cool and very powerful. However, the problem comes when you start looking at a large complex code base. Since there are no types you can’t easily determine the type of a variable. What the InfoPath team has done is used a naming convention for the variables. This allows us to track the object back to a source file.

However, since this is still a non typed language and there is no easy way to use the right click style go to definition found in Visual Studio and other tools.

When learning a new code base tools like this make things much easier. Working in JavaScript is analogous to walking around a dark room looking for a marble.

If anyone has any hints or tips on navigating large JavaScript code base let me know your thoughts.

Posted: Tuesday, January 23, 2007 8:00 PM by dreamey
Filed under: ,

Comments

ing_marco said:

Hi,

i'm want make a validation for javascript on infopath, un use C#.net like a lenguage.

But i need can execute a javascript like a onclick for a button.

can you help me plz

# November 16, 2007 8:53 AM
Anonymous comments are disabled