Home
| Cool Commercials & Clips | Bushisms | Stupid Riceboys | "How Rice Are You" Poll | Cancel Your AOL Account | Love and Hate Mail
Site Search | I am Confused | Funny Moments in Sports | Photo Gallery | News Archives | Fun with Flash | Amazing New Products
Listen to Music | Chat Room | The Homer Soundboard | The Virtual Ex | Essential Links

Random Simpsons Quote:
It's just like Venice, but without the Black Plague.
   -Milhouse
 
.
The Latest Stuff:
-Bushisms  Listen to some great quotes in MP3 format. I think he's learning disabled.

-Read my recent email conversation with an AOL employee  Be sure to send an email too!

-Send me your Riceboy Pics!  I'm planning a BIG update

-Cool Commercials & Clips Now all on one page! 

Must-See Classics:
-Teen Sex Symbol Spears looking to change image

-New Government Campaign Targets Masturbators

-Oprah to grin and bare it for her 50th

>>More Archived Classics >>

The Latest Essential Links:
Currently In The Works:

-Have a suggestion of what you'd like to see?  Shoot it my way and I'll think about it.

JavaScript Vs. VB Script

Written for Summer Session Class

The World Wide Web continues to adapt to different types of users, and different types of uses. The languages and systems used to create the actual content of the World Wide Web are also changing on an almost daily basis. Basic HTML pages, which were once a staple of the web along with web design companies, are now difficult to find. The only surviving designers have been forced into a world full of development. Our basic skills are obsolete and a new direction is needed. It seems the only place where plain HTML is still in use is in a basic, brochure-style web site for Mom and Pop’s Furniture Shop.

There are 2 common scripting methods used in the development of web pages that are more interactive. These 2 methods are known as Client-Side and Server-Side Scripting. With Client-Side Scripting, the scripts on the page are processed by the individual web browser that requests the page. With Server-Side Scripting, on the other hand, all scripts are processed on the server before the requested page is ever sent to the browser. This results in no actual code being sent to the client’s machine.

One of the most popular methods used to create today’s modern dynamic web pages is Server-Side Scripting languages. These dynamic pages are constructed in such a way that all server processes take place before the page is delivered to the user. This means that you only need the most basic internet browsing software to view the most complex and dynamic pages on the web today. 

Contrary to Server-Side scripts, Client-Side scripts can only run on browsers that support the specific scripting language that you are using. This means that you would need Netscape Navigator to view fully functioning JavaScript (I in fact learned this lesson the hard way in this very class.) On the contrary, you would need Internet Explorer to view fully functioning VB Script.

Server-Side Scripting has made it possible to “create platform-independent, easily deployable applications” (Rahmel). The thought of creating a program or application that will run anywhere in the world has obvious advantages over Client-Side Scripting. If you have ever written a research paper at the computer lab on a PC, while your computer at home is a Macintosh, you can surely relate to this. Scripting Engines seek to resolve the problem of having no functioning application code on the client. Because the script code is embedded in the HTML, it is downloaded every time the page is accessed (Rahmel).

I feel that it is important to note that my comparisons between JavaScript and VB Script are meant to be relevant only to Server-Side Scripting uses. Both languages can be used for Client-Side scripting purposes, however that is not the topic of this discussion and is a cold-blooded debate as old as the battle between Netscape Navigator and Internet Explorer (or PC versus Macintosh). 

I am proposing that VB Script is a better choice for the development of Server-Side Internet Applications, and I intend to provide evidence supporting why I feel this way. Coming from a background that consists primarily of design, my comparisons of the two are not biased in any way, as they are both foreign to me. One of the main questions I asked when analyzing these languages is “How quickly can I get up and running with fully functioning code, taking into considerations such factors as support, learning curve, etc?”

I am well aware that many programmers and developers will cringe at the fact that I am willing to put my stamp of approval on a product that was developed by the Microsoft Machine, but I am prepared to face such scrutiny. It is impossible to deny that although this can be a disadvantage, the widespread support options available are hard to ignore. 

Part of the reason that support for VB Script is so easily attainable is because the syntax is based on that of Visual Basic. In fact, “VB Script is identical, syntactically and grammatically, to Visual Basic and Visual Basic for Applications” (Thurott). There are literally millions of Visual Basic Developers who can instantly become web developers without much of a learning curve.

JavaScript, on the other hand, is not truly based on any other language. Despite use of the phrase “Java” in the name, it has absolutely nothing to do with it at all. In fact, the original name of JavaScript was LiveScript, but the name was changed at the last minute by the developers at Netscape, “so that Netscape could feed off the success of Java, like some fish hanging off the belly of a shark” (Thurott).

VB Script was created specifically for use on the internet, and is designed to be as close as possible to a programming language that is probably the most popular ever created (Hatfield, P. 21). VB Script doesn’t use lots of strange brackets and symbols in its logic. In fact, it often has a strong resemblance to another popular language known as English. Consider the basic example below (Thurrott):

The VB Script Example:

Dim x
For x = 1 to 10
    document.write x & “<BR>”
Next

Now let’s look at the same example written using JavaScript:

var x;
for(x = 1; x <=10; x++)
    {
        document.write(x + “<BR>”);
    }

Immediately you will notice that there is an abundance of semicolons, parentheses and brackets in the JavaScript code. These characters are mandatory – the code simply will not work without them. I assure you that few things are more frustrating than spending hours trying to debug code where the only problem was a missing semicolon or bracket. To make matters worse, in my own personal experience I have found that the semicolons may actually NOT be needed in every instance, and may cause problems at certain times. I have been unable to figure out why this is sometimes the case, but it seems almost random.

You may have noticed that the VB Script code uses capitalized letters at the beginning of the lines. These are not mandatory, and in fact you could switch between the upper and lower case right in the middle of the same code! JavaScript, on the other hand, is case-sensitive. If you create a variable named “count”, then you had better not refer to it as “Count” 20 lines down. VB Script could care less if you capitalize. It’s smart enough to figure out that they are in fact one and the same. 

JavaScript does share some basic syntax with Java, C, and C++, however, the way that JavaScript handles variables and objects is absolutely nothing like Java, C, and C++. At least with JavaScript there is a bright side – comments are handled exactly the same way as they are in C, C++, and Java!

There are numerous built-in functions available to VB Script that are not native to JavaScript. All of these functions are instantly available to you to use in your coding. Nearly every function you wish to use in JavaScript you must first create. One very good example is the usage of date and time functions. The following code is used to return a simple string containing the current date (Thurrott). 

The VB Script Code:

Function GetDate
        Dim MyMonthName

        MyMonthName = MonthName(Month(Now), False)
        GetDate = MyMonthName & " " & Day(Now) & ", " & Year(Now)
End Function

The JavaScript Code:

function GetDate()
        {
                var MyMonthName, d;
                d = new Date();

                switch(d.getMonth() + 1)
                {
                    case 1:
                            MyMonthName = "January ";
                            break;
                    case 2:
                            MyMonthName = "February ";
                            break;
                    case 3:
                            MyMonthName = "March ";
                            break;
                    case 4:
                            MyMonthName = "April ";
                            break;
                  case 5:
                            MyMonthName = "May ";
                            break;
                    case 6:
                            MyMonthName = "June ";
                            break;
                    case 7:
                            MyMonthName = "July ";
                            break;
                    case 8:
                            MyMonthName = "August ";
                            break;
                    case 9:
                            MyMonthName = "September ";
                            break;
                    case 10:
                            MyMonthName = "October ";
                            break;
                    case 11:
                            MyMonthName = "November ";
                            break;
                    case 12:
                            MyMonthName = "December ";
                }
        return(MyMonthName + d.getDate() + ", " + d.getFullYear())
    }

It is hard not to notice the length difference between these 2 pieces of code immediately. It is almost impossible to believe that they perform the same function! The VB Script example uses built-in functionality by calling the Month(Now) and Day(Now) functions, while the JavaScript example forces you to actually create that functionality BEFORE you can use it. Why reinvent the wheel?

This moves us to the next advantage that VB Script has over JavaScript. VB Script programming has been found to take considerably less overall lines of code to perform the same functions. The above function is simply one example of this. In fact, research indicates that VB Script code is “consistently smaller than JavaScript” (Hanni). 

Not only will having to type less lines of code save you time, but there is also an advantage in filesize. Bandwidth, server storage space, and user patience are all resources that shouldn’t be wasted. When performing the same tasks, VB Script produces a smaller file size than JavaScript about 49% of the time (Hanni). That is a fairly significant number when you add it up.

With JavaScript it is possible to save a library of reusable routines, however this involves using the time and resources to create it. Generally such routines are loaded with comments so that you are able to locate the area of code that you will need to customize for each particular application. Why not just call a VB Script function that has already been designed to serve your specific tasks instead? 

As you have seen in the previous examples, VB Script is simply an easier language to learn, understand, and debug. The language elements are mainly ones that will be familiar to anyone who has programmed in just about any language, such as If...Then...Else blocks and Do, While, and For...Next loops, and a typical assortment of operators and built-in functions (O’Donnell).

When you consider how quickly technologies are changing on the World Wide Web, I feel it’s important that they are able to be adapted and used quickly. After all, time is money, and the faster you can develop your next fully functioning web application, the faster you will be able to move on to the next one.

Selected Bibliography:

Hanni, Erin L. (2000) Scripting on the WWW: JavaScript vs. VBScript. http://www.cs.bsu.edu/homepages/ehanni/research/report.htm 

Hatfield, Bill. (1998) Active Server Pages For Dummies. Foster City, CA: IDG Books Worldwide, Inc. 

Lomax, Paul. (Spring 1997) VBScript versus JavaScript. World Wide Web Journal: 1997. http://www.w3journal.com/6/s3.lomax.html

O’Donnell, Jim. (1996) Platinum Edition Using HTML 3.2, Java 1.1, and CGI. QUE Corporation. http://www.eed.usv.ro/misc/doc/www/platinum/phjc48fi.htm

Rahmel, Dan (October 1996) Comparing JavaScript and VBScript, Internet Systems: 1996. http://www.dbmsmag.com/9610i07.html

Thurrott, Paul. (1997-1999) VBScript For the World Wide Web. http://www.internet-nexus.com/books/vbscript/jscript.htm

 

webmaster@heferito.com