Jump to content

ASP / PHP


astralaaron
 Share

Recommended Posts

so is ASP just a different language that does basically what PHP does?what are some advantages of useing ASP vs PHP ?
None, really. The major advantage of PHP is its cross-platform support and builtin functions for MD5 hasing, file uploading, image manipulation, etc. ASP doesn't have native support for any of those, instead it relies on the use of COM objects which are developed by independent programmers. Although most COM objects cost $$$$$, all major ASP hosts include at least the following COM objects for free:- ASPUpload, used for uploading files.- ASPImage, used for dynamically generating and manipulating images on the fly.- ASPHttp, used for sending HTTP requests and generating custom headers. (I'm not sure what the advantage is to using ASPHttp over XMLHttp that's is included by default in all ASP installations)- ASPEmail, helps to send emails.- ASPEncrypt, generates MD5, SHA1, SHA512, hashes and PGP encryptions.Fortunately, ASP.Net includes namespaces for all of those functions lacking in Classic ASP. If you have to make a choice between PHP and Classic ASP, choose PHP; if you have to make a choice between ASP.Net and anything else, choose ASP.net.ASP and PHP can do basically the same things with the same efficiency. There are some considerations to make:- ASP is only supported on Windows, but PHP has cross-platform support with Windows and Linux. For most web developers, that doesn't make a difference, because they are hosted by 3rd parties like Brinkster and GoDaddy, so they never have to touch the servers. However, if you do have to touch the servers and configure them yourself, then I recommend using Windows for its user-friendly interface. Configuring servers in Linux, especially in command line, is extremely difficult. I'd also recommend IIS for the sake of being able to run .Net applications in addition to Unix applications as wel.- Unless you are purchasing your own servers, it doesn't make a difference that Windows costs $$$$ and Unix is free. Generally, in ASP vs PHP discussions, people like to bring up the fact Linux servers are free, but the vast majority of web developers don't own their servers, most web developers contract to a 3rd party host. For people who own their own servers and who actually intend to service 100s or 1000s of concurrent connections a day, the real cost of web hosting has nothing to do with the software, the cost has everything to do with renting OC-3 cable for $2000/month.- ASP doesn't actually cost money in and of itself, it comes packaged with Windows. If you're smart, you can actually develop with ASP and ASP.Net without ever having to pay a single penny for software. The latest version of the .Net framework is available for free on Microsoft.com, and all of the "express" editions of Windows software are free, which include Visual Web Developer, C# Express, VB.Net Express, C++ Express, J# Express, SQL Server Express, and a few others.Visual Studio.Net costs about $200, but theres no point buying it when the express editions are available for free. I've used VS.net and the express editions extensively, and they are identical. (There is only a single difference: the express editions only let you create applications in a single language, so if you wanted to create something in C#, then you have to open C# Express; if you want to create something in VB.net, then you have to open VB.Net Express. VS.net is nothing more than all the express editions rolled up into a single piece of software, it lets you create applications in any of the .Net languages; if you want to create something in C#, then click "Create a new C# application"; if you want to create something in VB.net, you click "Create a new VB.Net application".)- Although people like to poke fun at Microsoft for security issues and stability issues, those criticisms are a holdover from IIS 5 (which is about 10 years outdated). The latest Windows server is IIS 6, which is widely recognized as one of the most secure and stable servers in the world, even surpassing Apache. If you don't believe me, you can look at the figures yourself:-- Apache 1.3 - 19 vulnerabilities since 2003, 1 still open-- Apache 2.0 - 33 vulnerabilities since 2003, 3 still open-- Apache 2.2 - 3 vulnerabilities since 2003, 1 still open-- IIS 5.x - 14 vulnerabilities since 2003, 2 still open-- IIS 6.0 - 3 vulnerabilities since 2003, 0 still open- In terms of script security, some sites are made insecure by poor programming. But PHP seems to invite security problems, and it has a notorious history of security holes, especially with newbie friendly features like register_globals and "magic quotes". Somes web hosts even ban the use of PHPbb forums due to persistent security problems.In my opinion, between learning Classic ASP and PHP, the only smart move to make is to learn PHP which is still being actively developed and used today, while Classic ASP is basically a dying language.
Link to comment
Share on other sites

ASP is also a server side scripting language like PHP.....Some articles which discuss the pros and cons of ASP and PHP..http://marty.anstey.ca/programming/php/articles/http://www.webpronews.com/expertarticles/2...2/22/asp-vs-php
No offense, but those are hysterically awful criticisms of ASP. Believe me, there are a lot of good reasons to criticize ASP, such as its lack of Try-catch blocks for error handling, absense of namespaces, dependence on COM objects for important tasks like file uploading and encryption, pathetic OOP support, inadequate support for dynamically including files, absence of datatypes, and the fact that its a dead language, but the authors of those sites evidently have no idea what they are talking about.Just a few random samples from the first link:
But realistically, let's get with the times; what was ASP is no longer. Microsoft has dropped support in favor of ASP.NET, which is about the furthest thing possible from what ASP was. No longer is VBScript the preferred language of choice, but C#, Microsoft's new (and surprisingly decent) contender which threatens to (if it hasn't already) completely decimate Java's position. And what of the lowly ASP developers of yore? Time to move on, folks. Microsoft, without openly admitting it, has put the final nail in the coffin of traditional ASP with .NET. Sure, support still exists and probably will for some time; but developers who bought into Microsoft's vision have no choice but to follow suit and learn C#, a language very similar to C and Perl and precisely what ASP originally intended to replace.
Really? Fortunately, ASP programmers aren't forced to learn C# when they make the switch to ASP.net, they can use VB.net instead. C# and VB.Net are identical languages, built on the same framework, but they have a slightly different syntax; C# has the familiar C-syntax, VB.Net has the familiar BASIC syntax. Its up to the programmer which one they prefer... actually they could mix C# and VB.net classes in the same application if they wanted.I regularly program in both syntaxes: I use VB.Net for web development, and C# for XBox 360 development. I have a preference for VB.net because its a little easier to read, and it lets me declare functions with optional parameters.
ASP natively supports only Access and MSSQL, whereas PHP natively supports a huge number of databases.
Unless the author has a different definition of "native support" than I do, he is absolutely and totally wrong. ASP actually doesn't "natively" support any databases, it connects to databases through a middle-tier language called ADO using ODBC drivers, which allows it to connect to literally hundreds and hundreds of databases, it can even connect to Excel documents and flat files.
MySQL is a database that PHP closely integrates with; it is a very powerful database that rivals Oracle in speed. Like PHP, MySQL is free, and blows most other databases out of the water. Another hidden cost with ASP is the database angle; Microsoft expects you to develop using Access and when your webpage outgrows it, to switch to MSSQL, an extremely expensive option. What most people don't realize is how quickly you can outgrow Access. Although you're technically limited to around 30 simultaneous connections, realistically it's closer to 5. Not many websites can survive such limitations. Most moderately sized websites require over 1000 simultaneous database connections. In addition, Access is SLOW. And you forego a lot of cool database functionality such as stability, transactions, replication, stored procedures, triggers, and so on. There are so many reasons not to use Access, I can't even begin to elaborate on them here.
Yes, Access is terrible, but what does that have to do with ASP? Wouldn't the same criticisms apply to PHP if people wrote PHP applications with an Access backend? The truth is, the quote above is a non-criticism, because Microsoft does not expect anyone to actually develop large websites with Access, and there is no formal requirement to use SQL Server. In fact, major ASP and ASP.Net hosts like Brinkster.com and M6.net offer MySQL as a database option; usually, if you're willing to pay $2 a month more for hosting, you can upgrade to an SQL Server database.While the author is very enthusiastic about MySQL, I think its a terrible database. I don't like it because it requires more maintanence than any other database I've ever used: MySQL servers are notorious for going offline, MySQL frequently corrupts table indexes. Its a good database for small to medium-sized sites, but its unsuitiable for sites with more than 20,000 hits per day. Its not as fast as Oracle and SQL Server.If you want MySQL for large-scale projects and high traffic websites like Wikipedia, then you have to pay $$$$$ for a MySQL AB or MySQL Enterprise license (both of which are closed-source and roughly the same cost as SQL Server).
ASP is significantly slower than PHP, for obvious reasons. Primarily, PHP runs on notoriously fast Unix and Linux servers which have for years outpaced Windows running on comparable hardware. ASP does not run on any operating system other than Windows, and even then, only in IIS and PWS. I could discuss countless reasons why IIS makes a terrible web server, but that would be a discussion all on it's own. PHP runs on almost any web server, on almost any platform. I have even built a web server in PHP which was capable of executing PHP scripts.
I've written scripts in ASP and PHP, and PHP seems a little faster. Both ASP and PHP seem to produce database output at the same pace, with minor edge given to PHP. ASP is definitely superior at processing large arrays because it uses traditional sequentially indexed arrays, but PHP doesn't actually use real arrays, its actually uses an associative array where each element in the array is actually a key/value pair. Long story short, it means ASP can perform array lookups in O(1) time, and PHP "arrays" perform lookups in about O(log n) time.Generally, ASP applications aren't written very efficiently, especially when it comes to pumping out information from a database. A typical ASP application looks something like this:
Dim Conn, RSSet Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.RecordSet")Conn.Open some_connection_stringRS.Open "Select * from table", conn, 1, 1	do until rs.eof		Response.write RS("field1")		Response.write RS("field2")		Response.write RS("field2")		rs.movenext	loopRS.CloseConn.Close

That's extremely slow, especially if you need to perform things like random access.However, ASP lets you dump the results of a database query into an array, which is MUCH faster to process than using the recordset object:

Dim Conn, RS, arrDataSet Conn = Server.CreateObject("ADODB.Connection")Set RS = Server.CreateObject("ADODB.RecordSet")Conn.Open some_connection_stringRS.Open "Select * from table", conn, 1, 1	arrData = rs.getRows()RS.CloseConn.CloseDim IFor I = 0 to uBound(arrData, 2)	response.write arrData(0, I)	response.write arrData(1, I)	response.write arrData(2, I)Next

The code looks a little more complicated, but its about 1.5x faster than the first method. Another method, the getString() method, is about 3x faster, but its not as easy to use. Both getRows and getString methods outperforms PHP's capacity to churn out database results, and they DEFINITELY outperforms PHP's capacity dump database contents into an array and print them to screen.Unfortunately, you never see tutorials on using the getString and getRows methods, because those techniques aren't very newbie friendly, but if you use them, then your ASP applications process as fast or faster than any equivalent PHP applications.On the second link, most of the criticisms are identical to the criticisms above (so I won't bother to repeat everything I've said above), but it makes one remark that deserves comment:

PHP is based on C++ language and the syntax used in PHP is quite similar to C/C++. C/C++ is still considered the best programming language by many programmers and people who love this language would surely feel more comfortable with the syntax of PHP. ASP on the other hand has a more Visual Basic kind of syntax that again is closely related to only Microsoft products. So, it depends on a person-to-person which language he or she is comfortable.
VBScript is the default syntax for Classic ASP, but ASP programmers can use the C-like JavaScript syntax if they like by adding the <%@ Language="JavaScript" %> directive to the top of their page.I generally agree with people that PHP is a better language than Classic ASP, but you won't find an explanation for why PHP is better in the articles posted above. At the moment they said ASP only supports Access and SQL Server, it became readily evident that the authors don't actually have a lot of experience programming in ASP, if any at all. Anyone can use MySQL and ASP perfectly fine, a lot of websites already do, including my own website (FSTDT.com) which is written in ASP and uses a MySQL backend.
Link to comment
Share on other sites

I agree with most of what you say, but I take issue with a few points. First, I agree that the articles are essentially the same anti-Microsoft cruft that people try to pass off as an unbiased review. It's clearly written by someone who is trying to get people to use PHP, it's not written by someone trying to compare the two.

C# and VB.Net are identical languages, built on the same framework
Half of that statement is true. Both C# and VB.Net, and quite a few other languages, will compile down to the common language runtime that .NET applications run off, but it is not accurate to say they are identical.
While the author is very enthusiastic about MySQL, I think its a terrible database. I don't like it because it requires more maintanence than any other database I've ever used: MySQL servers are notorious for going offline, MySQL frequently corrupts table indexes. Its a good database for small to medium-sized sites, but its unsuitiable for sites with more than 20,000 hits per day.
I definately take issue with this statement. First, your statement that you think MySQL is a terrible database does not reconcile with your later statement where you claim that you use MySQL. If that's the way you truly feel about MySQL, I don't think you would choose to use it on your own site. Furthermore, I have never had to maintain, reindex, or repair a database. Granted, the server would probably run quicker if I did, but it's not necessary to do this to have MySQL function. MySQL is the most popular open-source database server in the world, and these are some of the sites that use MySQL:Los Alamos National LaboratoryCitySearchClassMatesCraigsListEviteFriend Finder NetworkGoogleHot or NotLycos EuropePriceGrabberYahoo!MIT Lincoln LabChicago Mercantile ExchangeLinden Lab (Second Life)City of New YorkDepartment of Homeland SecurityDeutsche PostMinistère de la Justice (France)NASANASA Jet Propulsion Lab (JPL)State of IllinoisState of MichiganState of MinnesotaState of New YorkState of Rhode IslandSwedish National PoliceU.S. Census BureauUnited Nations FAOUNICEFDaimlerChryslerYamahaAssociated PressBBC NewsNew York TimesSlashdotBloomberg L.P.These came from this page:http://mysql.com/customers/Some other notable sites:del.icio.usDiggFacebookFlickrLiveJournalPhotobucketWikipediaYouTubeIt would be fair to say that these sites receive considerably more traffic then 20,000 hits per day, and that they are very database-heavy sites. Craigslist in particular is essentially nothing more then a web interface to the database. Anyway, I am just reacting to you using the word "terrible" to describe MySQL. I think that is pretty rediculous, if it were true then none (not one) of these sites listed would use it. True, you have to pay for an "Enterprise" license for MySQL, but I'm assuming that most of what you are paying for is support and the advanced tools. The license cost is $595 per server per year. Therefore, I feel obligated to point out that Microsoft SQL Server 2005 Standard edition with 5 client access licenses costs over $1,600. SQL Server Enterprise edition, which is what I would compare against the MySQL Enterprise license for $595 per server per year, costs over $24,000 (source). So...
(both of which are closed-source and roughly the same cost as SQL Server).
That is not true. Not even a little. It's off by two orders of magnitude.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...