Home  >  Article  >  If you are new to web development, which one should you learn, php, python or ruby?

If you are new to web development, which one should you learn, php, python or ruby?

PHPz
PHPzOriginal
2017-04-27 12:03:0410037browse

php, python and ruby ​​are all suitable for WEB development. For beginners in web development, the biggest question is to learn which programming language is more suitable for future career development and has more prospects. To choose a language that suits you, you must first consider the advantages and disadvantages of php, python and ruby, and how long their learning cycles are. Many people are more concerned about "Which is easier to learn, python or php", "Which one is better, ruby or python?". There are also many articles on the Internet, such as "PHP is dead", "PHP learning curve", "How to use Python well", etc. The editor will discuss with you today which programming language should be learned first among Python, PHP and Ruby?

If you are new to web development, which one should you learn, php, python or ruby?

## Course opening notice: php Chinese website "The 10th PHP Online Training Course" is currently being registered!

In the comparison of PHP, Python and Ruby, it is obvious: the market demand for PHP is the highest, Python is the easiest to learn and understand, and Ruby is more difficult to learn. There is no way to know which language is best based on these simple comparisons alone. We should also consider some other issues, such as:

1. Let’s understand these first Language

phpPHP (foreign name: PHP: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a general open source script language. The syntax absorbs the characteristics of C language, Java and Perl, which is easy to learn and widely used. It is mainly suitable for the field of Web development. PHP's unique syntax mixes C, Java, Perl, and PHP's own syntax. It can execute dynamic web pages faster than CGI or Perl. Compared with other programming languages, dynamic pages made with PHP embed programs into HTML (an application under the Standard Universal Markup Language) document for execution, and the execution efficiency is much higher than CGI that completely generates HTML tags; PHP can also execute compiled code. Compilation can achieve encryption and optimize code running, making the code run faster. (
php tutorial recommendation: the 10 most recommended php tutorials)

python

Python (British pronunciation: /ˈpaɪθən/ American pronunciation: /ˈpaɪθɑːn/), is an object-oriented interpreted computer programming language invented by the Dutch Guido van Rossum in 1989. The first public release was released in 1991.

Python is purely free software. The source code and interpreter CPython follow the GPL (GNU General Public License) agreement. Python syntax is concise and clear, and one of its features is the forced use of white space as statement indentation. Python has rich and powerful libraries. It is often nicknamed the glue language, which can easily connect various modules made in other languages ​​​​(especially C/C++) together. (Complete Collection of Python Tutorials)

rubyRuby, a simple and fast object-oriented (object-oriented programming) scripting language, was developed in 20 It was developed by Japanese Yukihiro Matsumoto in the 1990s and complies with the GPL agreement and Ruby License. It takes inspiration and features from Perl, Smalltalk, Eiffel, Ada, and Lisp languages. The Ruby language itself has also developed Ruby language alternatives for other platforms such as JRuby (Java platform) and IronRuby (.NET platform). The author of Ruby started writing Ruby on February 24, 1993, and it was not officially released to the public on fj (news group) until December 1995. Because the pronunciation of Perl is the same as the birthstone of June, pearl, Ruby was named after the birthstone of July, ruby. (
ruby tutorial collection)

2. Which language is the safest?

First correct the misunderstanding: security issues are not the main issue question. The security of websites and applications depends primarily on the programmers themselves, not the programming language. PHP, Python and Ruby are used on all well-known websites. For example, Zhihu uses Python and Taobao uses PHP. Can you say which one is more secure? Therefore, there is no real conclusion on the security issue.

3. What are the shortcomings of these languages?

PHP:

1. Compared with C/C The more detailed syntax of ++ and Perl, with a lot of curly braces and dollar signs and "->"

2. Function names are easy to confuse. There are various naming conventions for built-in libraries, functions are often prefixed to indicate their source (but usually everyone doesn't do this), and functions are usually placed in classes to simulate namespaces.

3. It is not suitable for large-scale application development and is difficult to maintain because it is not very modular.

4. Weak type: Implicit conversion may surprise unfamiliar programmers and lead to unexpected errors. For example, the strings "1000" and "1e3" appear to be equal because they are implicitly converted to floating point numbers.

5. PHP is a scripting language, not object-oriented.

Python:

1. Python does not have a 'switch' statement and a 'do ... while' statement.

2. Increment, decrement and assignment operators (assignment statements are only valid in Python).

3. Ternary operator/statement (...?...:...).

4. All variables and functions have no private, protected or public definitions.

5. Classes and methods do not have abstract and final modifiers.

Ruby:

1. Learning Ruby is difficult.

2. Lack of information resources.

3. Compared with other programming languages, the processing time (CPU time) is slower.

4. Development and update speed are slow.

4. What are the advantages of these languages?

PHP:

1. Easy to use for beginners (learning curve short and flat). If the developer has similar syntax learning background, such as C, C++, C#, Java, JavaScript, etc.

2. It supports all mainstream web servers, such as Apache, Microsoft IIS, Netscape, personal web server, iPlanet server, etc.

3. PHP is widely accepted by many industries, and it is more popular than other languages.

4. When hosting, it is easy to host a PHP website directly without any server configuration. However, hosting a PHP website can be a headache for newbies.

5. The Zend framework in PHP is the most well-known. For example, frameworks such as Yii, Laravel, and Codeigniter all give PHP greater strength.

6. Any type of CMS can be developed quickly.

Python:

1. The syntax is concise and very easy to read. ·

2. Universal language.

3. Object-oriented.

4. Python is more suitable as "glue".

5. Huge standard library. To pick some random example, Python comes with several XML parsers, CSV and zip file readers and writers, and libraries that can use almost every Internet protocol and data type.

6. The advanced data structure is a list, and this directory is very suitable for Python.

7. Large frameworks for web development, such as Django and Flask.

Ruby:

1. Compared with Python and PHP, Ruby is a more object-oriented language.

2. Ruby can make developers' work easier.

Mix-ins allows imported classes and modules to be extended and overridden by user code after import.

3. Ruby code blocks are more powerful than Python's lambda code blocks.

Any operation can return a value (including similar 'if' statements). Writing function-like code is easier than in Python.

4. Ruby’s Ruby library makes every task easy and can be achieved in just a few steps.

5. The power of Ruby in web development lies in its organized framework. In actual development, you don't have to worry about some basic functions, such as simple editor deletion and other functions.

6. Ruby can give programmers greater freedom and power.

5. What is the employment rate and average salary of developers?

This is a very subjective question, and the answer is not unique. PHP has the largest number of developers, which results in a lower average developer salary. However, this does not mean that all PHP developers are paid low salaries, some senior developers are paid very high salaries. There are also some stable job opportunities for Python and Ruby programmers, as there are fewer developers for these two languages ​​compared to PHP, but the market demand is correspondingly lower. (2017 Recruitment Season: How are the salaries of high-end PHP talents?)

For web development, I believe you should know which one to choose among PHP, Python and Ruby!

Overall conclusion:

1. It is easier for beginners to learn PHP and Python.

2. PHP is currently more employable.

3. PHP is easier to use for small and medium-sized websites.

4. Python is the best general language.

5. Python (Django) and Ruby (Rails) frameworks are more popular than other web development frameworks.

[Related recommendations]

What are the future development prospects of php? Is there any future for learning PHP?

Prospects for the future development of Python language in 2017

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn