Tuesday, March 13, 2007

Programming web servers: Languages for the web

Servlet

Techtarget (2005, servlet, para.1) defines that a servlet is a little size of program which runs on a server. This term was found in the context of the Java applet, a small program which is sent along with a Web (HTML) page but in a separate file. Java applets always running on a client and can provide a calculation for a user or placing an image on user interaction.

Some programs access databases based on user input should be on the server. Indeed, these have been solved using a Common Gateway Interface (CGI) application. On the other hand, If a Java running in the server, these programs can run with the Java programming language. The advantage of a Java servlet on servers with a great number of traffic is that they can be executed faster than CGI applications. The amount of system increasing for each request is slight. It means that rather than a separate program process to be created, every user request is turned as a thread in a single daemon process.

Wikipedia (2007, Java Servlet, p.1) determines several steps of the servlet life cycle:
  1. The servlet class runs in the container during start-up.
  2. The container invokes the init() method. This method begins with the servlet and has to be called before the servlet can allow any requests. In the whole life of a servlet, the init method needs to be called at once.
  3. After initialization process, the servlet can provide client-requests. A request is provided in their own separate thread. The container will call the service() method of the servlet for each request. The service() method establishes HTTP request (GET, POST, etc) and accordingly call the such methods doGet(), doPost(), doTrace(), etc. The developer of the servlet has to provide implementation for these methods. If an implementation for doPost() not available yet, it means that the servlet cannot manage POST requests. A developer must never the service() method.
  4. At the end, the container calls the destroy() method that stops the servlet service. The destroy() method such as init() is called only once in the life-cycle of a servlet.

JSP

JSP (2007, JSP, para.1) highlights that Java Server Page or JSP is a server-side technology developed by SUN and can be an extension for the Java servlet technology. JSPs have dynamic coding ability that runs in tandem with HTML code, dividing the page logic from the static elements which is the actual display and design of the page to make the HTML more functional (for example, dynamic database queries).

A JSP needs to be translated into Java servlet before being run and it loads HTTP requests and resulting responses such any servlet. In fact, JSP technology is an easiest way to code a servlet. A translation does in the first time when the application is run. A JSP translator is a trigger for the .jsp file name extension in a URL. JSPs are fully compatible with servlets. User can obtain an output from a servlet or resend the output to a servlet and a servlet can include ouput from a JSP or resend output to a JSP.

Wikipedia (2007, JavaServer Pages, para.5) divides a JSP into several pieces:

  1. Static data (HTML)
  2. JSP directives (include directive)
  3. JSP scripting variables and elements
  4. JSP actions
  5. custom tags

Perl

According to Lenzer (2004, Perl, para.1) Perl is a text programming language as same as syntax to the C language and includes some UNIX facilities such as awk, tr and SED. Perl is an interpreted language which can be compiled before execution into either cross-platform bytecode or C script. When it compiled, a Perl program will have the same speed as fully precompiled C language program. Perl is a best way to develop common gateway interface (CGI) programs because it has better text manipulation facilities.

Generally, Perl is much easier to learn and code than C and C++ languages. Perl programs can be sophisticated as well. A plug-in can be added for some servers (for example Apache), so Perl will run permanently in memory and causing short time to compile and faster execution of CGI Perl scripts.


About Perl (2007, Perl features, para.3) describes Perl’s features as follow:

  1. Perl is taken from the best features of other scripting languages, such awk, sh, C, etc.
  2. Perl database integration interface (DBI) works with third-party databases, such as Sybase, Postgres, Oracle, MySQL, etc.
  3. Perl also works with XML, HTML, etc.
  4. Perl supports object-oriented and procedural programming.
  5. Perl interfaces with external C++/C libraries over SWIG or XS.
  6. Perl can be more widely use because there are more than 500 third party modules available in the Comprehensive Perl Archive Network (CPAN).
  7. Perl can be implemented into other systems.

About Perl (2007, Perl and the Web, para.4) describes Perl and its relation to the Web:

  1. Perl is the most popular among any other web programming language because of its ability for text manipulation and rapid development cycle.
  2. Perl is also known as “the duct-tape of the Internet”.
  3. Perl can be used to manage encrypted Web data such as e-commerce transaction.
  4. Part of Perl’s standard distribution such as Perl’s CGI.pm module, makes it easy to handle HTML forms.
  5. Perl can be extended into web servers to increase processing by 2000%.
  6. mod perl used by the Apache web server to extend a Perl interpreter.
  7. Perl’s DBI package is a package to make web-database integration easier.

References

About Perl 2007, last edited n.a., Perl.org, viewed 3 March 2007, <http://www.perl.org/about.html>

Bergsten, H 1999, An Introduction to Java Servlets, last updated 10 March 1999, Jupitermedia Corporation, Darien, CT, USA, viewed 3 March 2007, <http://www.webdevelopersjournal.com/articles/intro_to_servlets.html>

Hall, M 1999, Servlets and JavaServer Pages (JSP), last updated n.a., coreservlets.com Inc., Reisterstown, MD, USA, viewed 3 March 2007,

JSP 2007, last edited n.a., Jupitermedia Corporation, Darien, CT, USA, viewed 3 March 2007, <http://www.webopedia.com/TERM/J/JSP.html>

Lenzer, J 2004, Perl, last updated 17 June 2004, SearchWebServices.com, Needham, MA, USA, viewed 3 March 2007, <http://searchopensource.techtarget.com/sDefinition/0,290660,sid39_gci214291,00.html>

Perl 2007, last edited n.a., Jupitermedia Corporation, Darien, CT, USA, viewed 3 March 2007, <http://www.webopedia.com/TERM/P/Perl.html>

Servlet 2007, last edited n.a., Jupitermedia Corporation, Darien, CT, USA, viewed 3 March 2007, <http://www.webopedia.com/TERM/S/servlet.html>

Techtarget 2003, Java Server Page, last updated 14 April 2003, SearchWebServices.com, Needham, MA, USA, viewed 3 March 2007, <http://searchwebservices.techtarget.com/sDefinition/0,290660,sid26_gci214048,00.html>

Techtarget 2005, servlet, last updated 4 April 2005, SearchWebServices.com, Needham, MA, USA, viewed 3 March 2007, <http://searchwebservices.techtarget.com/sDefinition/0,290660,sid26_gci212966,00.html>

Wikipedia 2007, Java Servlet, last updated 6 January 2007, Wikipedia Foundation, Inc., n.a., viewed 3 March 2007, <http://en.wikipedia.org/wiki/Java_Servlet>

Wikipedia 2007, JavaServer Pages, last updated 27 January 2007, Wikipedia Foundation, Inc., n.a., viewed 3 March 2007, <http://en.wikipedia.org/wiki/JavaServer_Pages>

Wikipedia 2007, Perl, last updated 21 January 2007, Wikipedia Foundation, Inc., n.a., viewed 3 March 2007, <http://en.wikipedia.org/wiki/Perl>

Sunday, March 11, 2007

Client, Server and Distributed Paradigms

Client-server paradigms
Sullivan (2006, client/server, para.1) defines that the client and server paradigms divide a pattern of work between two parts and represented by either threads or processes. The client requests for the action or the data, whereas the server fulfill the requests from the client. The client-server can be used by a particular program within a single computer, but the most important idea is in a network. The client-server model makes it easy to interconnect many programs which are distributed across different places in a network. The most common computer transactions using the client-server model is checking a bank account from user computer. A client program requests for the information to a server program at the bank. This server program may forward the request to another bank computer to reach a database server and retrieve user account balance. When the balance is received back to the bank data client and it will serve it back to client in his or her own personal computer and display the account balance information for user.

Sometimes a server called a daemon which is activated and waiting for a client requests. Generally, multiple client programs can also share the services of a common server program. The client programs and server programs are part of larger application or program. Relating to the Internet, the client program is web browser that requests services (the sending of files or web pages) from a web server (Hypertext Transport Protocol or HTTP server) on different computer on the Internet. Basically, a computer with TCP/IP standard allows user to make client requests for files from File Transfer Protocol servers in other computers on the Internet.

Sadoski (1997, Client/Server Software Architectures – An Overview, p.1) describes the two client-server architectures are:

  1. Two tier architectures
    The location of user system interface is in the user’s desktop environment and the database management services are in a server which is the strongest machine that services many clients. Processing management divides by two environments, the user interface environment and the database management server environment. The database management server stores procedures and triggers.
  2. Three tier architectures
    The three tier architectures overcome the limitations of the two tier architecture. In this architecture, in the middle between the user system interface client environment and the database management server environment were added a middle tier. There are many ways of implementing the middle tier, such as application servers, message servers or transaction processing monitors. The middle tiers tasks are performing queuing, database staging and application execution. For instance, while the middle tier allows queuing, the client can send its request to the middle layer and disengage because the middle tier will access the data and give the answer to the client. The middle layer also adds schedule and prioritization for task in progress. The three tier client-server architecture improves performance for groups with a greater number of users and increases flexibility.

Distributed paradigms
Rofrano (1992, p.1) writes that the distribution of resources and function through two or more interconnected processor is called distributed processing. These processors are the combination of mainframe, midrange or programmable workstation and the distribution can be overt or transparent. Distributed processing is a term which includes client-server computation and cooperative processing. The connection between distributed parts of an application can be either call/return, even-driven or peer-to-peer. There are three communication models that appropriate to implement these relationships: the remote procedure call (RPC), the message and queuing model and the conversional model.

Remote procedure call is a type of a call/return model where application functions communicate in a server/requester relationship. The requesting program does a request to the server program to provide some service. The server program will carry out the task and finish the process by returning the results. Since services can be used on local or remote, this model also introduces a part of transparency in the application can be unrealized of where the real service is performed. This model is implemented on Open Software Foundation (OSF) Distributed Computing Environment (DCE) remote procedure call application programming interface (API) or also called as DCE/RPC and the Transmission Control Protocol/Internet Protocol (TCP/IP).

Message and queuing (MQ) is a type of event-driven model to write distributed applications. The communication between functions can be conducted by placing a message event on a queue and then, routed to the function’s queue. The message will take into queue and processed. By default, it is an asynchronous model and the function called will be returned a message if a result is needed, consequently simulating a synchronous call. An example of message and queuing is e-mail and this messaging model also called as datagrams.

The conversational model is a model of distributed processing when the two applications have to decide on who has the right to deliver and who will accept the data based on established protocols (peer-to-peer). Generally, the initiating application has the right to send data and when the initiating application has completed delivering and agrees to accept data, the roles are conversed. This role will still continue reverse until the processing is complete and the conversation are ended. This model usually implemented on several systems over the Advanced Program-to-Program Communications (APPC) interface.

References

Bauer et al. 1994, ‘A distributed system architecture for a distributed application environment’, IBM Systems Journal, p.2, <http://www.findarticles.com/p/articles/mi_m0ISJ/is_n3_v33/ai_15718569>

Client-server, last edited 1 March 2007, Wikipedia Foundation, Inc., n.a., viewed 7 March 2007, <http://en.wikipedia.org/wiki/Client-server>

Distributed computing 2007, last edited 20 February 2007, Wikipedia Foundation, Inc., n.a., viewed 7 March 2007, <http://en.wikipedia.org/wiki/Distributed_computing>

Rofrano, J. J 1992, ‘Design considerations for distributed applications – Technical’, IBM Systems Journal, p.2, <http://www.findarticles.com/p/articles/mi_m0ISJ/is_n3_v31/ai_12547742/pg_3>

Sadoski, D 1997, Client/Server Software Architectures – An Overview, last updated 2 August 1997, Carnegie Mellon University, Pittsburgh, PA, USA, viewed 7 March 2007, <http://www.sei.cmu.edu/str/descriptions/clientserver_body.html>

Sullivan, J 2006, Client/server, last updated 20 April 2006, TechTarget, Needham, MA, USA, viewed 7 March 2007, <http://searchnetworking.techtarget.com/sDefinition/0,,sid7_gci211796,00.html>

The Client/Server paradigm 2006, last edited n.a, Safari Books Online, Sebastopol, CA, USA, viewed 7 March 2007, <http://safari5.bvdep.com/0131013769/ch08lev1sec11>


Thursday, March 8, 2007

E-commerce, distributed processing and the Internet

E-commerce
E-business guide (2004, Building - E-commerce - selling on your website, para.1) describes that e-commerce is a buying, selling and ordering services and goods activities on the Internet. The web and e-mail are the facilitation to make any electronic transactions happen. The simple transaction is a customer ordering goods on the online store and paying it by credit card.

The most common types of e-commerce are:

  1. B2B – Business to Business
    This kind of e-commerce is a transaction among a company with another company. They pass the information to each other by the Internet.
  2. B2C – Business to Consumer
    A company sells their products or services directly to the consumers through the Internet. For example, a buyer ordering a product to the computer store and the buyer pay the bills in electronic way as well.
  3. B2E – Business to Employee
    This kind of e-commerce is known as intranet where an employee can access to organization website to get information through organization network.
  4. C2C
    A seller personally sells his or her goods or services to a buyer. The simple example is ebay. This is an auction site where many buyers bid a product from the seller and the higher bidder deserve to get the product.

Distributed applications
If a program runs on more than one computer and connects through a network is called a distributed application (Indiana University 2006, p.1). The common distributed applications consist of two different software programs: the front-end software (client) and the back-end software (server). The workstations run front-end software (client). The application is software to handle user interface and processing functions, such as Microsoft Word is a program that receiving input from a keyboard, manipulating or editing word document and displaying output on a screen. Back-end software manages shared resources, such as printers, modems and disks and running on a shared system, such as a shared VMS or UNIX system. The back-end software has a capability as the main processing for the application.

The distributed application concept is simple, a computer can be a client and another computer can be a server or more widely, several servers connecting many clients. The example is a web browser which a browser need servers on the World Wide Web and front-end software such as Internet Explorer requests the web page to the servers.

The Internet
The Internet is the biggest network that connects million of computers all around the world and the information can be sent from any computer to the other computers in 24 hours a day. These computers can be in government departments, schools, small and large businesses, universities or homes. It can be single personal computers or any type of computer or even workstations on a company or school network. The term internet usually defines as a network of networks because the smaller networks of each organization connected into on huge network named the Internet. All computers have the same connection to the Internet and the only different is the speed of the connection which depends on Internet Service Provider (ISP) and modem (Sofweb 2006, p.1).

Generally, the Internet has a protocol called TCP/IP. IP has a task to move packet of data from one node to another node. IP will forward every packet to the destination address (a four byte IP number). The Internet authorities define the range of numbers to other organizations. The organizations define parts of their numbers to departments. IP works on gateway machine which send data form department to organization to region and then all around the world. TCP is responsible to verify the appropriate delivery of data from client to server. Data may be lost in the middle of the network. TCP supports to detect any errors or lost of data and as a trigger to retransmit until the data is fully received (Wikipedia 2006, p.1).

References

Building – E-commerce – Selling on your website 2004, last edited 5 November 2004, Department of Communications, Information Technology and the Arts, Canberra, ACT, viewed 4 March 2007, <http://www.e-businessguide.gov.au/building/e-commerce>

Distributed application 2006, last edited 12 June 2006, Wikipedia Foundation, Inc., n.a., viewed 4 March 2007, <http://en.wikipedia.org/wiki/Distributed_application>

E-commerce 2007, last edited 16 February 2007, Wikipedia Foundation, Inc., n.a., viewed 4 March 2007, <http://en.wikipedia.org/wiki/E-commerce>

E-commerce benefits 2006, last edited 22 September 2006, The State of Queensland (Department of State Development), Queensland, viewed 4 March 2007, <http://www.sd.qld.gov.au/dsdweb/v3/guis/templates/content/gui_cue_cntnhtml.cfm?id=4831>

Gilbert, H 1997, Distributed Applications and the Web, last updated 10 January 1997, PC Lube and Tune, New Haven, CT, viewed 4 March 2007, <http://pclt.cis.yale.edu/pclt/WEBAPP/default.htm>

Internet
2006, last edited 1 February 2007, Wikipedia Foundation, Inc., n.a., viewed 4 March 2007, <http://en.wikipedia.org/wiki/Internet>

Softweb 2006, Using the Internet, last updated 19 January 2006, State of Victoria (Department of Education and Training, viewed 4 March 2007, <http://www.sofweb.vic.edu.au/internet/>

Types of E-commerce 2005, last edited 19 September 2005, The State of Queensland (Department of State Development), Queensland, viewed 4 March 2007, <http://www.sd.qld.gov.au/dsdweb/v3/guis/templates/content/gui_cue_cntnhtml.cfm?id=4897>

What is a distributed application? 2006, last edited 9 June 2006, Indiana University, Bloomington, IN, viewed 4 March 2007, <http://kb.iu.edu/data/adob.html>






Tuesday, March 6, 2007

Database Servers

A database server is a computer application which provides database services to other computers, this called client-server model. This term also described as a computer determines to run a program. Database management systems (DBMS) provides basic database server functionality and some DBMS’s (for example, MySQL) based on the client-server model to access database (Wikipedia 2006). There are many database servers provide by different vendors such as Microsoft SQL server, PostgreSQL, MySQL, Interbase and many more.

According to PC World (2006, p.1) there are several types of database:
  1. Relational database
    A relational database stores all items needed in one database, sets them in some databases and making the relationship among them. For instance, a small-medium size enterprise (SME) wants to define the relationship between customers and orders in tables. Each customers and orders has their own unique ids so that two tables can be matched together. These databases named relational because they define these two connections (a customer form can be used to look up their order details form from the order table rather than storing double information). SQL is a common relational database which provides queries.
  2. Object databases
    Object databases very carefully store data in self contained units (objects). These objects contain specific data, attributes and behaviors related to them. A simple example is a product database such as a shoes object, which has some attributes such as color, size and price. The main difference between relational databases and object is the method to access the data. To access the data objects from the object databases, usually programmers using object oriented programming language along with calling methods in their code. This may contain much information if it resided in the application code and sends the information to the object database. That’s why the application code is simplified. On the other hand, at the same time when the application and database are entwined together can cause complexity of accessing the data outside of the application.
  3. Object-relational databases
    This kind of database combines both object and relational approaches. This gives the benefits of utilizing objects when it necessary to be tied to the strengths of utilizing relational databases.
  4. Hierarchical databases
    The relational databases organize data in tabular form but hierarchical databases organize the data in a tree form. A parent node will lead their inherent child nodes (which these children may have their own further nodes). This type of database is similar with a Windows Explorer program which displays the contents of a hard disk or hard drive (double click the parent directory and then it will drop down the further information and so on). This provides multiple types of subsidiary data but also make it complicated to identify complex multiple types of single data items. Recent hierarchical databases have been common used in computer science fields than in real world applications and hierarchical systems are more popular with the existence of XML (Extensible Markup Language) that uses a hierarchical method as a general data exchange format.

References

Database Server 2006, last edited 4 November 2006, Wikipedia Foundation, Inc., n.a., viewed 1 March 2007, <http://en.wikipedia.org/wiki/Database_server>

Database Servers Buying Guide 2006, last edited n.a., Australian PC World, NSW, Australia, viewed 1 March 2007, <http://www.pcworld.idg.com.au/index.php/id;676007892> SQL

Database Server 2006, last edited n.a., Todd VerBeek, viewed 1 March 2007, <http://microsoft.toddverbeek.com/sql.html>