which server-side language is right for you

Upload: praveensunny20

Post on 03-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Which Server-Side Language is Right for You

    1/11

  • 8/11/2019 Which Server-Side Language is Right for You

    2/11

    The choice of a server-side programming language is a constant source of heated debate on the

    Internet today. Just like HTML editors, everyone has their favorite scripting language and most

    people have very good reasons for their choices. However, the very nature of server-side

    development that Web browser compatibility is not an issue allows for two technologies that

    tackle the same problem in very different ways to both succeed in equal measure! For this reason,

    this article is not about deciding which platform is the best of all, but which is best for you. And hey:

    even if you still cant decide after reading this, or if it turns out youve already made the wrongchoice, at least youll have some idea of what youre up against!

    CGI/Perl

    Perl has been around longer than the World Wide Web itself. Version 1 was released on December

    18th 1987, a full decadebefore the other languages covered in this article were even conceived! If

    youre new to this stuff, youreprobably wondering how a server-side Web development language

    could have existed before the Web itself. You see, Perl was not createdas a Web developmentlanguage. Perl is, in fact, a multipurpose scripting language that was designed to handle tasks that

    involve a lot of text manipulation. Perl is very good at juggling pieces of text from various sources

    and combining them to form complete documents, which is exactly what is involved in server-side

    Web development.

    In the decade and a half since its creation, Perl has been expanded by means of modules, pieces

    of somtimes-complex functionality that can be plugged into the language to adapt it to various

    specialized purposes. One such purpose is the creation of dynamic Web content via the Common

    Gateway Interface (CGI) supported by the vast majority of Web servers. CGI is a standard means by

    which the Web server software can hand a browsers request for a Web page off to any program.

    Truth be told, CGI programs can be (and have been, on occasion) written in C/C++ if necessary.

    With its convenient handling of text, however, Perl has always been better suited to the job, and now

    that Perl comes with the CGI.pm module built in, most of the nitty gritty details of handling things

    like HTML form submissions are handled for you. As a final boon, the Comprehensive Perl Archive

    Network (CPAN) (http://www.cpan.org/) was founded to provide a centralized source for add-in

    modules, sample scripts, and in some cases fully developed Web applications.

    Today, versions of Perl are available for free on all major operating systems (from mainstream

    Windows to the most obscure Unix variant), and if you want to make it do something complicated,

    chances are someone has already written a module to make your job easier. The only downside to

    this language is that, since it wasnt purpose-built for Web development, it hasnt been optimized

    either for speed, scalability, or ease of use in a Web server setting. There are much easier

    languages out there to learn that can do just as much in the Web development arena, but Perl willalso let you do a lot more than just Web development if you need to.

    Advantages:

    http://www.cpan.org/
  • 8/11/2019 Which Server-Side Language is Right for You

    3/11

    A mature language with over a decade of history, youre less likely to run into bugs in Perl than in

    any other server-side language.

    Its FREE, though a good book to show you the ropes may set you back a little.

    Most good Web hosts support Perl, so you probably wont have to pay extra for hosting.

    A vast network of dedicated Perl developers all over the world are at your disposal. Not only will

    they answer your questions on countless Perl discussion groups and mailing lists, but the CPAN

    archive (among others) will give you plenty of examples to work from.

    Drawbacks:

    Although some options exist to improve the situation, Perl doesnt scale especially well on busy

    servers. If youre looking to create a Web application that can field a lot of hits in a short space of

    time, you may want to look elsewhere.

    Perl is notorious for having five different ways of doing even the simplest thing, which can make

    learning from the work of others difficult if they didnt use the same method youre used toseeing. Additionally, Perl developers are notorious for finding the shortest way to write any given

    program, so you may be surprised to look at a sample script only to find that a complete

    ecommerce shopping cart script has been written in three lines of code, most of which is

    squiggles and backslashes.

    Perl is optimized for the Unix platform on which it was created, so if you expect to work on a

    Windows server, you likely have better choices performance-wise.

    Perl is Open Source software, which means there is no formal support for it. Despite the huge

    support community available to you, if something goes wrong, the only person you can really

    count on is yourself.

    Target Developer:

    Most Web developers who still work with Perl today tend to be Unix administrators and users who

    also put Perl to work in other areas of their system. For people like these, Perl is a comforting go

    anywhere, do anything tool that can always be relied upon. If youre an inexperienced developer

    faced with the task of maintaining a site that was originally written in Perl, then grab a couple of

    good books (http://www.webmasterbase.com/article/435) and prepare to add a truly powerful tool to

    your arsenal.

    ASP

    Before we go any further, lets get something out of the way for the purists out there. Microsoft Active

    Server Pages (ASP) is nota language. Rather, ASP is a framework that lets you combine one of a

    number of scripting languages (VBScript and JavaScript being the most popular choices) with an

    expandable set of software components. These components are treated as objects by the

    http://www.webmasterbase.com/article/435
  • 8/11/2019 Which Server-Side Language is Right for You

    4/11

    scripting language of your choice when it is used as part of the ASP framework. In essence, the

    power of ASP lies in its ability to combine relatively simple scripting languages like VBScript and

    JavaScript with powerful software components that are normally used by C/C++ developers.

    Okay, thats the Microsoft sales pitch out of the way. Now lets face facts: for all practical purposes,

    ASP might as well be a language. You simply get a choice between writing VBScript ASP or

    JavaScript ASP. Since most of the sample code out there is written in VBScript, your choice is all

    but made for you. Thus, ASP is generally considered to be a language for developing dynamic Web

    sites using VBScript, and under that umbrella it excels. ASP is easy to learn, powerful enough for

    most mainstream server-side Web development, and quite good performance-wise.

    ASP is closely linked to the Windows operating system (most of the software components that ASP

    relies on for its functionality are Windows-specific) and the Microsoft Internet Information Services

    Web server software. For these reasons, it is neither practical nor desirable to run a Web site

    based on ASP on anything but a Windows-based server. If youre setting up your own Web server,that means you must invest in a copy of Windows 2000 Server (although much of ASP runs on

    Windows 2000 Professional, IIS is not as scalable on that platform). If youre paying for Web

    hosting, it means paying for a Windows-based server, which is usually more expensive. Any way you

    look at it, ASP will cost you money to run. There are versions of ASP that canbe run on an Apache

    server running under Linux, but unless youre specific aim is to move an existing ASP Web site onto

    a Linux server, there is little point.

    Another concern for ASP developers is the relatively limited nature of the components that come

    bundled with ASP. If all you need for your application is database connectivity, a search engine,

    email handling services, basic form processing and session tracking, then ASP will suit you just fine.

    Any less common functionality, however, will usually require you to install additional software

    components on your server. There are many companies out there that produce components for use

    with ASP that generate PDF files, interact with FTP servers, handle binary file uploads and many

    other things. Unfortunately, these components, like ASP, tend to be commercial solutions that will

    cost you money.

    The upside of all this is that ASP is a very well supported technology, with all the backing of the

    Microsoft development community behind it. MSDN (http://msdn.microsoft.com/), the Microsoft

    Development Network provides a wealth of technical articles and reference material for ASP

    developers, and Microsoft support personnel will gladly investigate any problems you have in your

    development efforts (for a price). If at any time you absolutely need an answer to a question, you can

    rest assured there will be someone there whose job it is to give you the answer.

    Advantages:

    Fairly easy to learn, though programming is required.

    Built into Windows 2000 Server no installation headaches.

    http://msdn.microsoft.com/
  • 8/11/2019 Which Server-Side Language is Right for You

    5/11

    Professional support available.

    Drawbacks:

    Its not free (unless youre already using a Windows server)

    Specialized functionality may require you to purchase commercial components, or develop them

    yourself in C/C++ or Visual Basic.

    If youre used to C-style syntax (shared by C/C++, Java, Perl, PHP, etc.), you may find the

    idiosyncrasies of VBScript difficult to come to grips with.

    Target Developer:

    If youve done any development with VBScript or Visual Basic, or have developed COM objects in

    Windows before, then this is definitely the Web development platform for you. Also, ASP is about as

    friendly to non-programmers as a programming language can get (but if you really hate

    programming, check out Cold Fusion, up next). If youre comfortable committing to Windows for your

    Web server platform and can afford the costs involved, or if the company you work for simply

    demands the level of support that Microsoft can provide, then ASP is a great technology to learn.

    Cold Fusion

    For the Web desginer who has never written a program before, the choice of server-side Web

    development platform can be a dreaded one. Whichever way you go, youre faced with an big, evil

    programming language to learn and your head just starts to ache Originally created by Allaire

    (http://www.allaire.com/) in 1995 and recently bought out by Macromedia

    (http://www.macromedia.com/), Cold Fusion was designed to be different. Instead of a scripting

    language, Cold Fusion gives you a set of tags to learn. Yes, tags just like those HTML tags youve

    come to know and love!

    Lets take the example of publishing information stored in a database on the Web. With the vast

    majority of server-side languages, you need to add code to your Web page to break out of HTML

    mode, connect to the database, request the entries from the database that you want to display, and

    process the results that the database sends you to display it as part of the Web page. In Cold

    Fusion, this common task is done with two tags: a tag, the attributes of which give the

    query a name and indicate what information to retrieve from which database. A second tag,

    refers to the query and lets you use standard HTML to format and display the results

    of the query.

    To the experienced programmer, this tag-based system may sound restrictive and inflexible, but witha built-in library of over 300 tags in the latest version, and the ability to add custom tags with more

    traditional programming languages like C/C++ and Java, Cold Fusion is anythingbut restrictive.

    Cold Fusion 5.0 includes tags that automatically generate graphs from database data, seamlessly

    http://www.macromedia.com/http://www.allaire.com/
  • 8/11/2019 Which Server-Side Language is Right for You

    6/11

    provide search facilities on your Website, and even generate HTML forms with full JavaScript

    validation code. For the desginer who is forced to acquire server-side skills, Cold Fusion comes

    with the utopian promise of only having to learn a few new tags!

    Like ASP, Cold Fusion is a commercial server platform, which means it will cost you money to run it

    whether you set up your own server or rent space on a Web hosting provider. Unlike ASP, however,

    Cold Fusion is not tied to the Windows platform. Cold Fusion can integrate just as easily with

    Apache running under Linux as it can with IIS on Windows 2000.

    Advantages:

    Extremely easy to learn no programming required!

    Powerful and very scalable (latest version has support for both software- and hardware-based

    server clustering).

    Professional Support from Macromedia.

    Cross platform.

    Drawbacks:

    Expensive to set up your own server: Cold Fusion Server Professional 5.0 costs $1,295

    Programmers may not like the tag-based development methods.

    Target Developer:

    Web designers who are comfortable with HTML but need to add server-side skills to their repertoire

    without having to learn a programming language. From the average developers point of view,

    learning Cold Fusion is just like learning some new tags. Non-designers are also likely to warm up

    to the neatness of server-side programming with tags, so if youre tired of debugging your server-

    side scripts, Cold Fusion might be worth a look!

    PHP

    A relative newcomer in the server-side development arena, PHP has gained a large following

    among programmers with its familiar syntax and comprehensive function library. Also, its relatively

    simple syntax and low, low price (its free!) has made it an attractive alternative to Microsofts ASP

    for new developers.

    PHP has been dubbed by some to be Perl killer of the server-side scripting world. For purposes of

    Web development, PHP can do almost everything that Perl can, and usually does it quicker and

    easier. Unlike Perl, which usually runs as a CGI program invoked by the Web server to handle each

    page request, PHP can integrate with your Web server so that it operates much more efficiently.

  • 8/11/2019 Which Server-Side Language is Right for You

    7/11

    PHP is an extremely capable language, with a vast array of built-in functions to do everything from

    tracking user sessions to generating dynamic graphics and even PDF files on the fly! No modules to

    install, no commercial add-ins to buy PHP handles everything itself! In fact, just about the only

    weakness of PHP is that its relatively difficult to expand the language to add non-standard

    functionality that is not handled by its built-in functions. Doing this requires a knowledge of C/C++

    programming and is not for the faint of heart! Fortunately, youd have to come up with a veryesoteric

    Web application to require functionality that isnt already built into PHP.

    PHP is free, cross-platform, Open Source software. It integrates with all major Web servers on all

    major operating systems. This is a great boon for developers on a budget, because they can set up

    a complete Linux-based Web server with PHP support and not pay a dime for software! The

    downside of this, of course, is that there is no formal support for any problems you may encounter

    with PHP. Also since PHP is such a new and actively developed technology, there are still

    occasional bugs found in the latest versions. Dont let these niggles put you off, though PHP has

    an extremely active user community (a large segment of which can be found in our very ownSitePoint Forums (http://www.sitepointforums.com/)!) that is always eager to help you with any

    stumbling blocks, and the current versions of PHP are quite stable and reliable.

    Advantages:

    Fairly easy to learn, especially for developers with C/C++, Java, or Perl experience.

    Active user community willing to lend you a hand getting started.

    Everythings built right into the language.

    Its free!

    Cross-platform.

    Drawbacks:

    This language was designed to be programmer-friendly, which unfortunately makes it a little less

    friendly to non-programmers.

    Target Developer:

    Web developers on a budget who enjoy simple programming (e.g. JavaScript), or dont mind

    learning how. PHP gives you a great deal of power with relatively simple code structure, but may not

    be suited to very high end applications that arent supported by PHPs built-in features.

    Java

    Java is arguably the most powerful platform for server-side Web development today. From small

    Java programs (Servlets) that handle Web page requests to JavaServer Pages (JSPs) that

    combine HTML with custom tags and Java code, and even up to Enterprise JavaBeans (EJBs),

    http://www.sitepointforums.com/
  • 8/11/2019 Which Server-Side Language is Right for You

    8/11

    software components with sophisticated abilities to carry information seamlessly across servers

    and networks to accomodate distributed applications, Java is truly a hot technology.

    An experienced Java Web developer can easily pull in salaries in excess of US$100,000/yr. As you

    might expect, theres a reason for that: Java is not easy to learn! Unlike scripting languages like

    Perl, ASP and PHP, Java is a full-fledged programming language fully capable of writing big

    programs! Someone with a little programming experience could expect to pick up a working

    knowledge of the Java language in a month or two with the help of a good book, and in another

    month would likely be able to pick up the basics of simple server-side programming with Java. Now,

    if youre interested in making a career in server-side programming then that may not seem like

    much, but if you just want to get something working quickly, a simpler language like PHP can have

    you up and running in a week or less!

    Java is renouned for its Write One, Run Anywhere (WORA) philosophy, and indeed Java can be run

    on all major Web servers and all major operating systems. Java Web applications can also bebundled up into a standard Web Application Archive (.WAR) files that can then be installed on any

    Java-enabled Web server, no matter the platform. The makers of Java planned for this mechanism

    to be used to distribute commercial Web applications for use on Java Web servers; however, in my

    experience, Java Web applications tend to be customized solutions to complex problems, rather

    than sellable solutions that you can buy online.

    Many different vendors produce the plug-ins that enable Web servers like Apache and IIS to run

    Java Web applications, and while most of them are free for personal use and development, the

    majority must be paid for before you can use them to serve a commercial Website.

    Advantages:

    Extremely powerful and scalable.

    Cross-platform.

    Most Java server plugins are free for personal and development purposes.

    Drawbacks:

    Java takes a lot of work to learn. Dont even start if youre not serious about learning object

    oriented programming.

    Most Java server plugins must be paid for if they are to be used to host a commercial Web site.

    Target Developer:

    Serious developers who want the ultimate in power, flexibility and scalability for their Web

    applications, and dont mind paying for it in sweat, tears and development time.

  • 8/11/2019 Which Server-Side Language is Right for You

    9/11

    Summary

    In this article, we looked at the relative features, benefits and downfalls of all the major server-side

    development options available today:

    Perl: a mature, cross-platform language that can be hard to understand

    ASP: Microsofts powerful, Windows-based framework

    Cold Fusion: a powerful, tag-based option for non-programmers

    PHP: a cross-platform, open-source alternative with lots of features built in

    Java: the ultimate in power and flexibility, for serious programmers

    Hopefully armed with the low-down on all these options, youre feeling better-equipped to tackle the

    big decision of which to learn and use for your next project. If youre still in need of some guidance,

    be sure to drop by our Server-Side Internet Development forum at SitePoint Forums

    (http://www.sitepointforums.com/). Well be glad to help!

    You might also like:

    (http://www.sitepoint.com/author/kevin-yank/)

    Kevin Yank (http://www.sitepoint.com/author/kevin-yank/)

    Kevin began developing for the Web in 1995 and is a highly respected technical author. Kev is a

    world-renowned author, speaker and JavaScript expert. He has a passion for making web

    technology easy to understand by anyone. Yes, even you!

    (https://plus.google.com/105505321936740566301)

    Stored Procedures in MySQL and PHP

    (http://www.sitepoint.com/stored-procedures-mysql-php/)

    Book: Jump Start Bootstrap

    https://learnable.com/books/jump-start-bootstrap?utm_source=sitepoint&utm_medium=related-items&utm_content=js-bootstraphttp://www.sitepoint.com/stored-procedures-mysql-php/http://www.sitepoint.com/author/kevin-yank/https://plus.google.com/105505321936740566301http://www.sitepoint.com/author/kevin-yank/http://www.sitepointforums.com/
  • 8/11/2019 Which Server-Side Language is Right for You

    10/11

    Free book: Jump Start HTML5 BasicsGrab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful

    new features.

    email address

    (https://learnable.com/books/jump-start-bootstrap?

    utm_source=sitepoint&utm_medium=related-

    items&utm_content=js-bootstrap)

    Are You Targeting Google Dart?

    (http://www.sitepoint.com/targeting-google-dart/)

    Claim Book

    No Reader comments

    Comments on this post are closed.

    http://www.sitepoint.com/targeting-google-dart/https://learnable.com/books/jump-start-bootstrap?utm_source=sitepoint&utm_medium=related-items&utm_content=js-bootstrap
  • 8/11/2019 Which Server-Side Language is Right for You

    11/11