2 agosto, 2024

Is web development with PHP an old man’s thing? |

It is all too common to receive criticism and ridicule when you say you work programming in PHP. Not as much as when someone says they do it in Cobol, but that’s right, if you want to learn to program with PHP, this is the warning: It is a language with a bad reputation.

However, WordPress the most popular CMS in the world and which already accounts for 28% of all websites published on the Internet, is programmed in this language. And not only that, many of the most popular content managers and frameworks today are written in this language and, therefore, job offers that ask you to master Symfony, Drupal or Laravel are the order of the day.

But of course, surely you are much more popular saying that you work with Go, Node.js, React or Angular, but don’t let the trees stop you from seeing the forest. There is a very clear reality: PHP is still used in the web world, a lot.

So why does it have a bad reputation?

1. Ignorance

People speak badly about this language because they don’t know it. But not only people foreign to this language, but the lack of knowledge even reaches the programmers themselves. In 2009, for example, it introduced Closures, and if it hadn’t been for Symfony, today people would hardly even use them. And this programming language does not hesitate to adapt features that may be useful to you. If you want to program with php web development, you should know that you have classes, interfaces, reflections, proxies, magic methods, etc. The only thing that prevents you from using them if you want to have correctly structured code is your ability and knowledge.

2. Freedom

Virtue and defect in equal parts. If you want a set of prefabricated tools that facilitate and guide you when creating orderly code separated by layers, you can use Symfony or Zend, two of the frameworks that have been created for this. But if you want to develop under MVC, you just have to use Doctrine as ORM for the model, Symfony for the controller and Twig for the view. You can make garbage more easily, yes, but it is the price you pay for giving the developer almost total freedom in the management of the language, as occurs in JavaScript. But don’t forget something basic: it is your responsibility, not the language’s, to write good code.

The past of PHP

It was created in 1995 by Rasmus Lerdorf. Based on C, he created a set of scripts to count visits to his website and called it “Personal Home Page Tools”. Creating a new programming language was not in his mind. Still.

Since then, it has been rewritten and redesigned several times. With PHP 4 the engine appeared ZendEngineAnd it was not until version 5 appeared (in 2004) when the language supported object orientation.

PHP 6 was a stone in the road that slowed down the development of the language. Among other improvements, an attempt was made to support Unicodebut the plan did not go well and it was decided to port the improvements that did work to the PHP 5 branch (what was PHP 5.4), continue evolving that version and start from scratch with PHP 7.

Andrei Zmievski, the man who led the PHP 6 project explains all the problems encountered in his talk The Good, the Bad, and the Ugly: What Happened to Unicode and PHP 6.

The present: Php 7.0

PHP 7.0 was released in December 2015 after a long wait, but it was worth it as the performance improvement has been notable.

But not only has performance and memory usage improved, but important inconsistency and type management problems have been resolved.

Among the main obstacles to migrating from PHP 5 to PHP 7 was the elimination of everything that was already marked as deprecatedsuch as extensions of mysqlthe functions preg_replace or the possibility of using a function with the same name as the class as a constructor.

These have been the main changes to review to port a plugin or module to version 7.

Improvements in PHP 7

Speed. Type declaration in function arguments New scalar variable types and the ability to enable strict type mode Type declaration of function returns Improved error and exception handling and new Throwable interface; fatal errors are now handled as exceptions. Functions and anonymous classes. Possibility of grouping classes when importing New operators such as Null coalesce or spaceship operator (< = >)

In this post You can read in detail about these changes and see examples of the use of php today

Why use PHP?

Yes, PHP is still used. Many are still looking to program with PHP web design, although other languages ​​are more in demand. Its advantages include its favorable learning curvethe absence of licenses as it is Open Source, development environments that are very easy to configure and a large community.

It is easy to learn to program in this language. But as we said before, another virtue that, if poorly executed, becomes a defect. It is easy to program something without making head or tail without knowing what you are doing and that is where the main criticisms come from.
But by learning to use the language correctly and taking advantage of everything it already gives you, and using any of the main frameworks of the language, you can build websites with this language, as well as services quickly and reliably (without going any further. , through this link You will be able to see the webinar where we will build a website that will be your to-do list. In an hour. Not bad, huh?)

But for as many reasons as I list, those who hate him will continue to do so. And those who know how to take advantage of their potential will also continue to do so.

PHP is still used like any other language. Companies like Etsy have no qualms about admitting that they use PHP and are happy with it. Slack also uses it and in this post analyzes its virtues and defects. Tumblr talks about its migration to PHP 7 and performance improvements on its blog.

Facebook started in this language, although they later developed the Hack language, adapting PHP to their needs and the HHVM virtual machine.

Today, PHP 7 and frameworks like Laravel have nothing to envy other languages ​​and their frameworks like Ruby with Django or Ruby with Ruby on Rails.

We cannot offer you a PHP bootcamp exclusively. But, so that you can judge for yourself what this language can offer you, we invite you to watch this webinar with Alicia Rodríguez, backend programmer.

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *