Last modified on 10 November 2014, at 20:31

Web Development/Choosing the right programming language

Section 5.3 — Back to Contents

Choosing the right programming language for server-side applications. (Choosing the right programming language for browser-site rollovers, animation, and validation -- CSS, JavaScript, Java, or Flash -- is discussed ... ...).

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

  • your server platform
  • the server software you run
  • your budget
  • previous experience in programming
  • the database you have chosen for your backend

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 LanguagesEdit

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.


Java/Servlet/JSPEdit

  • Type: Interpreted or Compiled (for Virtual Machine)
  • website: Oracle
  • License: ---------

Java is a powerful,open source,robust and secure web-based program that can run as standalone program or an applet embedded in a website.

Servlets (controller), JSP (view), Java (model) creates web-based applications using MVC (Model–view–controller). For creating robust secure web-application Java has many frameworks like Struts,Spring and more in web_application_frameworks.

Example code

class HelloTest {
  public static void main(String[] args) {
    System.out.println("Content-type: text/html\n");
    System.out.println("Hello World!"); //Display the string.   
  }
}

Java Tutorials

JavaServer Pages (JSPs) are web pages with embedded Java code. The embedded Java code is executed on the server, then the page is returned to the browser for display.

Example code

<html>
  <head>
    <title>A JSP Example</title>
  </head>
  <body>
    <% out.println("<p>Hello there!</p>"); %>
  </body>
</html>

details...


PerlEdit

  • 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;


PHPEdit

  • 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, the code will display the h1. This way you will not have to use echo or print to print HTML.

CEdit

  • 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");
}

C++Edit

Originally released as "C with Classes" around 1982, C++ was designed by Bjarne Stroustrop to be a superset of C. With its compatibility with C, it became quite popular. In 1983 C with Classes was revised and renamed C++. It was summarized in the book, "The C++ Programming Language" by Stroustrop, Addison Wesley, 1985. The goal was to add programming language features that support data abstraction and object-oriented concepts to C. In 1990 the book entitled "The Annotated C++ Reference Manual," by Ellis and Stroustrop, Addison Wesley became the defining document.

Example code

#include <iostream.h>
using namespace std;
int main() {
   cout << "Content-Type: text/html\r\n\r\n";
   cout << "<html> <head>\n";
   cout << "<title>Hello, World!</title>\n";
   cout << "</head>\n";
   cout << "<body>\n";
   cout << "<h1>Hello, World!</h1>\n";
   cout << "</body> </html>\n";
   return 0;
}

ColdFusionEdit

  • 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>

ASPEdit

ASP, or Active Server Pages combine html and server-side code (processed on the server and displayed as html) to create webpages with embedded functionality and scripts (see the code example).

Example code

<html>
<body>
 
<%
dim name
name="Donald Duck"
response.write("My name is: " & name)
%>
 
</body>
</html>


C#Edit

  • Type: Compiled (for Virtual Machine)
  • website: Microsoft
  • License: ---------

C# (pronounced "C Sharp") is a multi-paradigm programming language encompassing imperative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was developed by Microsoft within the .NET initiative and later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270). C# is one of the programming languages designed for the Common Language Infrastructure.

C# is intended to be a simple, modern, general-purpose, object-oriented programming language. Its development team is led by Anders Hejlsberg, the designer of Borland's Turbo Pascal. It has an object-oriented syntax based on C++. It was initially named Cool, which stood for "C-like Object Oriented Language".[2] However, in July 2000, when Microsoft made the project public, the name of the programming language was given as C#. The most recent version of the language is 4.5 which was released in 2012.

Example code

class ExampleClass
{
    static void Main()
    {
        System.Console.WriteLine("Hello, world!");
    }
}


WebDNAEdit

  • Type: Interpreted script language with built-in database system
  • Website: www.webdna.us
  • License: Freeware

WebDNA is an easy to learn language with hybrid in-memory databases specifically designed for server-side programming. It uses a relatively small set of instructions that can be combined to build sophisticated database-driven websites. WebDNA code can interweaves with css, html, html5 and ajax, allowing to mix layout with programming and sever-side with client-side. Some instructions allow to interact with remote servers.

WebDNA is available for most operating systems including Unix, OS X and Windows.

Example code (connects to a whois server and shows the information)

<!--HAS_WEBDNA_TAGS-->
<html>
   <head>
      <title>WebDNA example 1</title>
   </head>
<body>

[text]info=[tcpconnect host=whois.domaindiscover.com&port=43]
[tcpsend]webdna.us[unurl]%0D%0A[/unurl][/tcpsend]
[/tcpconnect][/text]

</body>
</html>

Example code (store the previous information in a database)

<!--HAS_WEBDNA_TAGS-->
<html>
   <head>
      <title>WebDNA example 2</title>
   </head>
<body>

[append db=base.db]domain=webdna.us&whois=[info]
[/append]

</body>
</html>