Web Development/Choosing the right programming language

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Section 5.3 — Back to Contents

Choosing the right programming language for server-side applications.

When it comes to the perfect programming language for the development of your site, it is imperative that you understand that there is no perfect programming language. Once you understand this, it is simply a matter of choosing the language that best serves your needs. Before you decide on what language to use, you should consider the following:

  • Server platform
  • Server software being run
  • Budget
  • Previous programming experience
  • Database being used for back-end

The Operating system you are running on your system is your platform and your choice of OS may play a major part in the language you choose. Be aware that unforeseen problems may push you to change platforms in the future, and that some language choices will make this very painful. Microsoft Windows and POSIX-compliant unix-like systems will most likely be your two main choices in technology.

Once you have chosen your OS, the next choice is your server software. On Windows systems, you have IIS which comes installed for free with windows. It has a long history of performance and security problems. Many of the web servers commonly used on POSIX-compliant unix-like systems are available for Windows too, including the very popular and well-respected Apache web server.

"POSIX-compliant unix-like systems" includes a plethora of available OSes including but not limited to Linux, Sun Solaris, BSD, and Mac OS X. Apache is by far the most common web server for these systems and for web serving in general.

While some of the available programming languages are free under the GNU Public License or other open-source licences, others are commercial products and carry a licensing fee. The commercial products do carry the advantage of commercial support and tighter integration with the companies' other products, so if you have a large amount of capital and want to get your site set up quickly with little configuration, then a commercial solution might be your better option. Some of us, however, cannot afford the high price tag of the commercial solutions on the market and may elect to make use of the free yet still very powerful languages available. The tradeoff is the effort in properly configuring the environment which may or may not be worth the cost savings.

The Most Popular Programming Languages[edit]

The following are a list of the most popular languages used in the industry today. This is by no means exhaustive or complete and it is up to you to personally research each option to choose the right language for you.

Perl[edit]

  • Type: Interpreted script language, Compilable into binary executable or platform-compatible Bytecode
  • website: perl.com
  • License: Open source [free]

insert content here

Example code (using Dancer Perl framework)

#!/usr/bin/env perl
use Dancer;
get '/' => sub
 {
  "Hello World!"
 };
dance;


PHP[edit]

  • Type: Interpreted script language, Compilable
  • Website: php.net
  • License: Open source [free]

PHP is a recursive acronym for PHP Hypertext Processor. Unlike the other offerings listed, PHP is designed specifically for server-side programming, which means that its library is specialized for the tasks you'll be doing over and over again in the course of programming your website. PHP also has the advantage of being able to interweave code with HTML, thus allowing you to mix layout with programming. While this may simplify coding for small sites, it does carry the potential to be abused, resulting in difficult to manage or maintain code for larger projects. Proper use of a templating system such as Smarty should do wonders towards preventing that. PHP is available for most operating systems including Unix and Windows, and is an excellent server-side programming language for professional programming.

Example code

<!DOCTYPE html>
<html>
    <head>
        <title>PHP Hello World</title>
    </head>
    <body>
        <?php echo "hello world"; ?>
    </body>
</html>

Or a feature that really shows that PHP is designed for the web is something like this.

<!DOCTYPE html>
<html>
    <head>
        <title>PHP Hello World</title>
    </head>
    <body>
        <?php
        if(isset($_GET['showHtml']))
        {
             ?>
             <h1>The GET variable showHtml is set.</h1>
             <?php
        }
        ?>
    </body>
</html>

In this case if "showHtml" is set (using "?showHtml" in the URL), the code will display the h1. This way you will not have to use echo or print to print HTML.

C[edit]

  • Type: Compiled
  • Website:
  • License:

The C programming language is a standardized programming language developed in the early 1970s by Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications.

C is a useful language to learn since similar syntax is used by many modern languages such as Java, PHP, and JavaScript.

Example code

#include <stdio.h>
int main() {
   printf("Content-Type: text/html\r\n\r\n");
   printf("<html> <head>\n");
   printf("<title>Hello, World!</title>\n");
   printf("</head>\n");
   printf("<body>\n");
   printf("<h1>Hello, World!</h1>\n");
   printf("</body> </html>\n");
}

More Example code

#include <stdio.h>

int main() {
    show();
}

void show() {
    printf("hello");
}

ColdFusion[edit]

  • Website: Adobe
  • License: Multiple available [1]

Programming:ColdFusion

ColdFusion is a scripting language based on standard HTML that is used to write dynamic Web sites. It allows you create dynamic pages quickly and easily, including querying data from a database, use hundreds of built in tags and functions, or creating full scale object oriented enterprise level applications. ColdFusion pages can consist largely of standard HTML tags intermingled with ColdFusion Markup Language (CFML) tags, or can implement custom frameworks designed to assist the developer in separating presentation from business logic (e.g. with the MVC design pattern). ColdFusion was introduced by Allaire in 1996 and acquired by Macromedia in a merger in April 2001 and by Adobe in 2005. As an Adobe product, ColdFusion developers have the advantage of leveraging many existing Adobe technologies seamlessly. Examples of such integration can be seen in the dynamic generation of Adobe Acrobat .pdf documents, Adobe Flash forms and presentations, Adobe Flash remoting capabilities, as well as connection with Adobe Flex user interfaces.

Example code

<cfset myVar = "Hello World!">

<cfoutput>
  <html>
    <body>
      #myVar#
    </body>
  </html>
</cfoutput>