Sriram Krishnan (Moved to http://www.sriramkrishnan.com/blog)

Search. Usability. Virtual machines.Geek stuff

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910


Navigation

Subscriptions

News

Link blog
Technorati Profile
The Blogs I read
Creative Commons Licence
This work is licensed under a Creative Commons License.


PHP vs ASP.NET

This has to be the funniest article that I've ever read - comparing PHP 5 and ASP.NET. I was tempted to comment on it - but I thought I'd let people read it for themselves. But I couldn't resist the following -

The author has given a code sample comparing database access in PHP and ASP.NET to show  how much easier PHP coding is (he feels the multi-language support in ASP.NET makes it more complex)

Here are his code samples

 

class oracle_object {
  protected $theDB;
  protected $user;
  protected $pass;
  protected $db;

  function __construct($u, $p, $d) {
    $this->user = $u;
    $this->pass = $p;
    $this->db = $d;
  }

  function db_open () {
    $theDB  =  @OCILogon($this->user,  $this->pass,  $this->db);
    db_check_errors($php_errormsg);
  }

  function db_close() {
    @OCILogoff($theDB);
    db_check_errors($php_errormsg);
  }

  function __destruct () {
    print ("so long...");
  }

}
And the ASP.NET code -

 

Imports System
Imports System.Data
Imports System.Data.OracleClient
Imports Microsoft.VisualBasic

Class Sample

  Public Shared Sub Main()

    Dim oraConn As OracleConnection = New OracleConnection("Data Source=MyOracleServer;Integrated Security=yes;")

    Dim oraCMD As OracleCommand = New OracleCommand("SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER", oraConn)

    oraConn.Open()

    Dim myReader As OracleDataReader = oraCMD.ExecuteReader()

    Do While (myReader.Read())
      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
    Loop

    myReader.Close()
    oraConn.Close()
  End Sub
End Class
Just wondering - the ASP.NET actually does some work like querying the database - and it has almost the same number of lines of code! Somebody needs to come up with better code comparisons!

posted on Sunday, July 18, 2004 11:11 PM by sriram





Powered by Dot Net Junkies, by Telligent Systems