Friday, 1 July 2011

Perl tutorial-5

5. Other choices


5.1 Python - OOP

Developed by Guido Van Rossum, a programmer from Netherlands, Python, freely available fromhttp://www.python.org is an increasingly popular scripting language. Like Perl, it is also available for major platforms. Unlike Perl, Python was created as an Object Oriented Language. Perl does not support OOP as such, but one can easily simulate objects. 
Python is also a cleaner language in that it does not generally allow you to be adventurous with data types. Consequently, Python code is much easier to maintain, as it gets bigger. Python is designed to be extensible. So, enforcing standards and extending the capabilities of the language are easier. With the advent of Java and increased OOP awareness, Python is very popular these days. Python has modules for GUI programming in Unix and Windows environments and that is one area where it is catching up. 
It is a matter of personal preference to choose between Python and Perl. Generally, people who prefer C to C++ opt for Perl and C++ lovers go for Python. VB and ASP programmers also can migrate to Python smoothly, which might not be the case with Perl. 
Personally, for all the elegance of Python, I do not program in that because of one reason. In Python, the blocks are specified by indentation and not by any construct like {} or BEGIN-END. This can really be irritating if your FTP client or editor decides to translate the file! An easy way out is to add {} as comments (like #{ ... #} !) 
A good feature of Python is that the interpreter can be used interactively - like shell. This enables one to test out each line of code thoroughly. A similar application called perlshell is also available in Perl. 
A 100% pure Java implementation of Python called JPython is the latest news on Python. This enables one to create Java byte-code out ot Python code. 


5.2 TCL - GUI, Expect, Commercial support

TCL, the Tool Command Language was invented by Dr.John Ousterhout when he was working with Sun Labs. Later he formed Scriptics Co., which now continues development of Tcl and provides commercial support. 
Tcl has been around longer than Perl or Python and coupled with its GUI toolkit, Tk (hence the name Tcl/Tk) is very popular among Unix crowd. 
Another recent addition to Tcl that attracts interest is Expect. Expect is a tool for automation - specifically for those tasks which needs interaction. A simple example of an Expect script could be logging in to a remote machine, running scripts there and logging out. Expect easily makes the life of system administrators much more pleasant! 
Tcl/Tk plugins for browsers are also available. These can run Tclets inside your browser - many Tclets are already available to produce stunning GUI's. Tclets are probable alternates for java applets. 

5.3 PHP - Web Scripting

PHP started as a Hypertext Preprocessor and was written by Rasmus Lerdorf a couple of years back. Its simplicity and elegance soon made it a very viable alternative to ASP and Java servlets for server side scripting for the web. Syntactically PHP is lot similar to Perl. It is also very much object oriented and very very easy to learn. 
Visit http://www.php.net for more information. 
PHP's popularity has been increasing almost exponentially. The only negative aspect was that mod_perl scripts execute faster. Now in version 4.0, PHP is driven by a completely rewritten engine called Zend and the performance gap is narrowing down a lot. Even the older versions are sufficiently fast to handle a medium complexity site of dynamic content. 
My personal opinion is that, if you want to create interactive/dynamic web site without learning the complexities of CGI, PHP is the way to go - especially if you don't want to spend thousands to purchase ColdFusion or ASP. PHP can also be installed as a separate interpreter program like Perl or Awk. Combined with the ease with which you can write powerful programs in PHP and its easy integration with databases (Oracle/Sybase/Informix/ODBC/PostgreSQL/MySQL...), graphics libraries, network functions, e-mail etc, it is a viable and better choice to even Pro*C !

0 comments:

Post a Comment

 
Related Posts Plugin for WordPress, Blogger...