About Perl, Python, PHP, Ruby

Even now, I would like to make a comparison or give an opinion. Just self-satisfaction and personal views.

Historical history of birth

I think it is important to know the background and purpose of each language in terms of using that language.

Pre-Perl era

In the pre-Perl era, there were only compiled languages like C in the world, and only shells, sed, and awk could process without compiling. When I wanted to process a little text automatically, but it wasn't something that I would create in earnest in C, everyone would process UNIX commands side by side as a shell script. Convenient commands such as sort and test were provided in UNIX, and even a little complicated processing could be managed by making full use of sed and awk.

However, there are two types of shells, Bourne Shell type and C Shell type, and even if the same UNIX command has different options depending on the OS, the portability is low. In the first place, the processing is continuous because the command execution is continuous. It had the drawback of being heavy.

The strongest scripting language for text processing-Introducing Perl-

Meanwhile, Perl was born to solve the dissatisfaction of shell scripts. It included the functions of shell, sed, and awk, and implemented powerful regular expressions in addition to the functions required for text processing. In text processing, it is much more powerful and faster than the combination of commands by the shell. Also, because of the high portability that the same Perl works in the same way, everyone started using Perl.

Then, the Internet has spread to the general public, and it has become an era in which many people create websites. More and more people want to put not only static HTML but also dynamic pages (CGI) such as counters and bulletin boards. At that time, Perl was a reasonable option to implement CGI. Since it is a script language, it can be used just by placing it, powerful text processing such as regular expressions is possible (text processing if HTML spitting is exhausted with CGI), and it is installed as standard on UNIX / Linux, so support and provision are easy. For that reason, there was a time when CGI was called Perl.

In this way, Perl became very popular and built an era, but there were three major problems.

  1. There is also a motto "There is more than one way", and the quality tends to vary depending on the level of the writer. The cords are full of splices and tend to be less maintainable.
  2. Since it is not a language created for CGI, there are many redundant expressions such as many print statements to implement CGI.
  3. Since it was not originally object-oriented, it is hard to say that the retrofitted object-oriented is beautiful.

The idea that everyone should have the same code-Python has arrived-

If you do it in one way, everyone will write the algorithm the same way, which will make the code cleaner and easier to read. And maintainability also improves. Python was created based on the idea of reversal. Indentation is sometimes used in a style that is not often found in other languages, and the readability is outstanding. It has become the supreme language for well-behaved programming.

The idea of specializing in the Web-PHP has arrived-

PHP was created with the idea that if you embed the code in HTML instead of creating HTML with code, redundant print statements will not be necessary. Also, by compiling and installing the Apache module called mod_php together, I was able to eliminate the slow process startup peculiar to CGI. It has become the perfect language for creating small web dynamic pages.

The desire to use a pure object-oriented language-Ruby is here-

Ruby was designed and created as a pure object-oriented language from the beginning. Not to mention Perl, Python was also object-oriented, so I was dissatisfied with the language specifications as object-oriented (PHP is also object-oriented). Since Ruby is a full-fledged object-oriented language that makes everything an object from the beginning, it has become a language that can be written very straightforwardly when doing object-oriented programming.

And modern

Perl has a long history and has a long day, and initially it is more than others in terms of the number of libraries, the number of reference codes, the number of Japanese information sites and books, whether OS standards are available, etc. It was superior. However, in modern times, all the necessary libraries for other languages are available, there are many reference codes, many Japanese information sites and books, and packages are prepared for each on Linux. Of course, the latest Mac OS X has all four languages installed from the beginning. In other words, it can be said that the environmental difference has completely disappeared.

It is best to make a choice that suits each purpose because it is such an era. If you want to keep the old code alive, you can leave Perl as it is, if you want to emphasize maintainability, you can use Python, PHP is the best for a little web dynamic page, and if you want to write object-oriented and honestly, Ruby is used. You can use it.

It's boring when it's over, so I'll turn my point of view to the future.

The future of language

Perl-Slow Decline and Hope for 6-

It can be said that the current Perl 5 is already dead. It does not mean that it will not develop any further, but that it is stable. As long as it's Perl5, the code I just wrote will work in the future, and the code I wrote 10 years ago will work fine.

However, Perl 6 will be released in the future. Perl 6 has been cut off backwards compatibility and is even said to be a completely different language. Perl 6 may be accepted as another language, but it is unlikely that it will be seen as the next version of Perl 5. However, it is certain that Perl 5 will be taken over by the successor language that has taken advantage of it. Will it continue its gradual decline, or will it be reborn as Perl 6, and can it be called Perl? The invisible future continues.

Python --forever 2--

The current Python is maintained in Python 2 and Python 3. Python2 and Python3 have some incompatibilities, and rewriting is almost essential. There are plenty of migration tools available, but they don't seem to be moving forward. That's because many operating systems still use Python 2. There are many auxiliary tools that form the basis of an OS made in Python. And it's made in Python2. It is necessary to rewrite to change to Python3, and it is necessary to check from the beginning what is currently operating stably. It's better to keep it running on Python2, which is currently running. After all, Python installed as an OS standard will remain Python2, and the tools created accordingly will be Python2. Yes, there will never be a move to Python3.

This may be ironic because Python has succeeded in Python 2. Linguistically, Python3 should be much cleaner, but will the day come when Python3 will become mainstream?

PHP-I don't care about version numbers-

PHP compatibility truncation may be famous. Language compatibility truncation usually occurs in major versions. Perl changes a lot at 5-> 6, and Python truncates some at 2-> 3. Ruby also cuts off some compatibility with 1.8-> 1.9 (1.9 was originally positioned as a development version of 2.0). However, PHP is truncated in the minor version. It will be deprecated at first, but an error will occur in the next version. In other words, there are a lot of codes that don't work just by changing two minor versions. And PHP only supports up to two minor versions. If developers don't maintain old code indefinitely, they will only work with vulnerable versions.

And, after PHP5, PHP7 is not known. In this way, PHP development guidelines have been criticized in various ways. The PHP you wrote will probably stop working after a few years. There is no choice but to maintain it forever, and the dilemma continues.

Ruby-Isn't it popular after all? ---

Ruby also had some compatibility truncation with 1.8-> 1.9, but since I haven't used it so much in the first place, the latest OS has started to adopt 1.9 or later (1.8 is no longer supported). (Although there is). Since 1.9 and later, compatibility is almost maintained, so there is no worry about compatibility like other languages.

But how many people are using Ruby after all? It became famous for Ruby on Rails, but the benefits of Rails are being lost as more and more similar frameworks emerge. A simple web application can't match PHP, and readability and maintainability can't match Python. The drawbacks of being slow, having a small environment, and having a small number of libraries have disappeared, but they do not have the advantages that other languages do not have. After all, I feel that object-oriented enthusiasts will use it for a long time.

JavaScript-dreaming of integration with the web-

Finally, now that JavaScript is being used beyond just a web language. There is also a server-side node.js, which may break Perl and its derived Python, PHP, and Ruby strongholds in the future. However, the language specification of JavaScript itself is too bad to be used as it is. How will the language that compiles to JavaScript called Alt JS and the next ECMAScript 6 evolve, and will they surpass the former Perl? The future remains uncertain.

Recommended Posts

About Perl, Python, PHP, Ruby
Java VS PHP VS Python VS Ruby
2014 Web Application Framework Trends (PHP / Java / Ruby / Python / Perl)
Dynamic proxy with python, ruby, PHP
Hello World in various languages [Python / PHP / Java / Perl / Ruby]
About python slices
About python comprehension
Realize PHP / Python generator with Golang / Ruby
About Python tqdm.
About python yield
About python, class
About python inheritance
[Basic grammar] Differences between Ruby / Python / PHP
About python, range ()
About python decorators
About python reference
About Python decorators
[Python] About multi-process
A story about running Python on PHP on Heroku
About shallow and deep copies of Python / Ruby
Grouping combination in Python / Ruby / PHP / Golang (Go)
About list processing (Python beginners after learning Ruby)
About function arguments (python)
[Docker] Tutorial (Python + php)
[Python] Memo about functions
Ruby, Python and map
Summary about Python3 + OpenCV3
About Python, for ~ (range)
[Python] Memo about errors
Python and Ruby split
About Python development environment
Python: About function arguments
Python, about exception handling
About Python Pyramid traversal
About Python3 ... (Ellipsis object)
[Python] Chapter 01-01 About Python (First Python)
[Python] About standard input
About __all__ in python
Handle prime numbers in Python / Ruby / PHP / Golang (Go)
python, php, ruby How to convert decimal numbers to n-ary numbers
About adding / deleting lists (Python beginners after learning Ruby)
Let's write Python, Ruby, PHP, Java, JavaScript side respectively
How to handle JSON in Ruby, Python, JavaScript, PHP
From the initial state of CentOS8 to running php python perl ruby with nginx
[Python] Find out about pip
Python on Ruby and angry Ruby on Python
Cheating from PHP to Python
Overlapping combinations with limits in Python / Ruby / PHP / Golang (Go)
Think about architecture in python
About python beginner's memorandum function
About the ease of Python
Python and ruby slice memo
About the enumerate function (python)
Standard input / summary / python, ruby
About various encodings of Python 3
Zundokokiyoshi with python / ruby / Lua
Solving with Ruby, Perl, Java and Python AtCoder ATC 002 A
About Python, len () and randint ()
About Python datetime and timezone
A memorandum about correlation [Python]
Python memo using perl --join