Central Alabama ColdFusion User Group - Why ColdFusion?


Home Employment Why ColdFusion? Demonstrations Archives Tips Other Groups Local Sites

  1. First, the simplicity of ColdFusion tags for database access functions may cut a three-hour code review, modification, or testing task to perhaps an hour or less. Which of the following would you want to modify or debug at the code level? Hint: One set of code is shorter and is easier to understand. Mark Cyzyk writing for WebTechniques.com provided these parallel examples of how to query a database and display the result:

    1. Using ColdFusion:
      <cfquery datasource="somedatasource" name="somequeryname">
      SELECT LASTNAME, FIRSTNAME
      FROM MAIN
      ORDER BY LASTNAME
      </cfquery>
      
      <cfoutput query="somequeryname">
      #LASTNAME#, #FIRSTNAME#<br>
      </cfoutput>
      
    2. Using Active Server Pages (ASP):
      <% @LANGUAGE = VBScript %>
      
      <%
      
      Option Explicit
      Response.Expires = 0 
      Dim objConn, objRS, strQ 
      Dim strConnection  14: 
      Set objConn = Server.CreateObject("ADODB.Connection") 
      strConnection = "Data Source=somedatasource;"  
      objConn.Open strConnection 
      Set objRS = Server.CreateObject("ADODB.Recordset") 
      Set objRS.ActiveConnection = objConn 
      strQ = "SELECT LASTNAME, FIRSTNAME " 
       strQ = strQ & "FROM MAIN "  
      strQ = strQ & "ORDER BY LASTNAME " 
      objRS.Open strQ 
      
      %>
      
      <% 
      
      While Not objRS.EOF 
      Response.Write objRS("LASTNAME") & ", " 
      Response.Write objRS("FIRSTNAME") & "<BR>" 
      objRS.MoveNext 
      Wend 
      objRS.close 
      objConn.close 
      Set objRS = Nothing 
      Set objConn = Nothing 
      
      %>
      
    3. Using Java Server Pages (JSP):
      <%@ page import="java.sql.*" %>
      
      <%
      
      try {
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
      } catch (java.lang.ClassNotFoundException e) {
      e.printStackTrace();
      }
      
      Connection myConnection = null;
      Statement myStatement = null;
      ResultSet myResultSet = null;
      
      try {
      myConnection = DriverManager.getConnection ("jdbc:odbc:jsp", "", "");
      myStatement = myConnection.createStatement();
      myResultSet = myStatement.executeQuery("select firstname, 
                    lastname from main order by lastname");
      while(myResultSet.next())
      	{
      	out.println(myResultSet.getString("lastname")+", ");
      	out.println(myResultSet.getString("firstname")+"<br>");
      	}
      myResultSet.close();
      myStatement.close();
      myConnection.close();
      } catch (SQLException e) {
      e.printStackTrace();
      }
      
      %>
      
  2. Second, the tool to produce ColdFusion tags is powerful. In ColdFusion Studio, you can use a wizard to make "drill down" queries that the user can steer interactively from the web page. Follow some logical steps using a wizard and select "Finish". You're done. Can some other tool produce "drill down" queries this easily with a result that's this simple to understand?

  3. Third, the result from some other tools is not necessarily useful.

    1. With ColdFusion, customers won't have to take any special steps or upgrade their browsers to use what you've created.

    2. To use Oracle Forms over the Web, customers must download and run a large Java applet. The client browser must be quite new - even Netscape 4.5 isn't good enough. Further, client-side Java is a Category 2 technology according to the Defense Information Systems Agency (DISA) 11 Jan 2000 draft memo, "Use of Mobile Code Technologies in Department of Defense (DoD) Information Systems", which states: "Where feasible, protections against malicious forms of Category 2 technologies will be employed at the end-user workstation and at the enclave boundary." In other words, Java is disabled by default. To use Oracle Forms, customers must set their browsers to "have access to all network addresses", "dialogs", "execute", and (if desired) "printing". Finally, Oracle Developer 2000/Handbook (2nd ed by Michael Stowe) says: "Currently, there are no firewalls that understand Java sockets..." It also happens that applications relying on Oracle Forms don't use the same version of Java and the customer must choose which application to give up. Thus, many customers will be unable or unwilling to use your application if it requires Oracle Forms.

  4. Fourth, some functions can't readily be done at all with other tools and therefore no comparison is necessary: Web site indexing/searching and E-mail generation come to mind. Indexing tools often have a sliding scale of fees and may not integrate well with the rest of the site. Mailing with the HTML mailto tag doesn't count; because, it relies on a client's browser instead of letting the server send mail in the background. You could write a perl script by hand to send mail from a Unix box, but it's tougher to do from a Microsoft box unless you load the Web server software on the Exchange server itself.