Why/How of creating Application Pages in Windows SharePoint Services 3.0

According to Ted Pattison in his book :"You can create custom application pages to add user interface components to a custom solution based on Microsoft Windows SharePoint Services 3.0. Unlike site pages (for example, default.aspx), a custom application page is deployed once per Web server and cannot be customized on a site-by-site basis. Application pages are based in the virtual _layouts directory. In addition, they are compiled into a single assembly DLL. They are also used across all sites within a server farm. For these reasons, they perform better than site pages. With application pages, you can also add inline code. With site pages, you cannot add inline code."
There couldn't have been a easier way to explain application pages in sharepoint. Creating one is as simple thanks to all mighty MSDN
_____________________________________________________________

Typically, you link custom application pages to application.master, the master page file that is used by the default application pages in Windows SharePoint Services. You should also write application pages to inherit from a base class defined inside the Microsoft.SharePointassembly named LayoutsPageBase. The following example provides the basic layout for a custom application page.

C#
 


  Site Title: 
  

  Site ID: 



   Hello World



   The Quintessential 'Hello World' of Application Page


Deployment
Note that although you can deploy your application pages directly inside the \LAYOUTS directory, doing so can create file name conflicts between your application pages and those application pages that are created by Microsoft and other companies. It is a best practice to deploy your application pages inside a company-specific or project-specific directory that is nested with the \LAYOUTS directory. For example, you can deploy application pages within a company-specific directory located at the path \LAYOUTS\Litware.
 Read It
You usually create custom application pages with a link to the application.master file. The custom application page demonstrated in this How-To sample adds three Content tags to add HTML content to the resulting page. In particular, this page replaces three placeholders that are defined inside application.master:PlaceHolderMainPlaceHolderPageTitle andPlaceHolderPageTitleInTitleArea. However, these are only three of the many different placeholders that you can choose to replace.
Also note that an application page can have a script block at the top with code that programs against the object model. When you program a similar page within Microsoft Visual Studio 2005, you can benefit from conveniences such as color-coding and Microsoft IntelliSense. However, you must add the correct @Assembly directive to the top of the page to reference the Microsoft.SharePoint assembly.
Application pages are useful because they provide quick and easy access to the Windows SharePoint Services object model. After you create an application page and provide an overridden implementation of the OnLoad method, you can obtain entry points into the Windows SharePoint Services object model in a site-specific context by using the following code.
C#
SPSite siteCollection = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
Visual Basic
Dim siteCollection As SPSite = SPContext.Current.Site
Dim site As SPWeb = SPContext.Current.Web
The ability to obtain site-relative context makes writing application pages far more powerful. An application page can function differently depending on which site you go through to access it. When you navigate to an application through the context of one site, it typically appears and functions differently than when you navigate to it through the context of another site.