📜 ⬆️ ⬇️

Sketches with PHP Russia 2019: clean code, dark magic



On May 17, the first professional conference for PHP developers PHP Russia 2019 was held at Infospace in Moscow. After a long pause, they received a fully honed platform for them; in the announcement, we compared it with the stadium, which was not the case with the peychpishnikov, one of the teams of the “highest IT division”. And the first season of the "stadium" met at least with dignity, with the difference from the prototype of football, that it is difficult to make a strict separation between players and fans.

During the period of the “great peychpishnogo glaciation” - large conferences on PHP in Russia have not been as many as nine years - the community around the language has a need for such a meeting place. At the same time, great hopes were placed on the event, and the task to please everyone was seen as an extraordinary one. But fear has big eyes, and healthy paranoia has good peripheral vision: the experience of IT events on our organizational side, along with the power of “PHP magic” on the side of the program committee and the authority of its participants in the industry, allowed us to organize a mature event on the first try.

Almost 500 people arrived at PHP Russia. The online audience was also rather small - several hundred viewers joined. The program was based on 22 reports, including five from eminent foreign speakers, as well as three meetings and performances in an improvisational Unconference format in a separate stream.
')


The conference went in three streams , and it would be painful to choose where to go if it were not possible later to watch the broadcasts of everything that happened in the main program.

Alexander Makarov, co-organizer of the conference
- We in the program committee thought for a long time and finally shook up the grid so that the puzzle was formed: they refused to take the English-speaking speakers into a separate stream, watched so that the reports were mutually balanced. Relatively speaking, that the most hit ones would go in parallel and not one would over-pull most of the audience. Of course, there were conceptual bundles within each track: so, immediately after Dave Liddament’s performance, which, arguing about the static analysis of PHP code, PHPStorm paid considerable attention, in the same room Kirill Smelov’s report started, where a story about innovations in PHP 7.4 followed by a presentation on 8.0.

About topics


As planned , the lion's share of speeches was built around PHP-specific topics, in large part very, very hardcore.

Among the main vectors of interest at the conference, the future of the language itself, its architecture and standardization, asynchronous programming in PHP, its best practices and implicit possibilities, working with specific frameworks and even machine learning using the PHP stack were highlighted.



Key reports


The program committee approached the selection of reports scrupulously, therefore it was difficult to select the “coolest” ones: there were no openly passing blocks in the program, at least according to the results of the first feedback from guests. So as examples, we had to pick out a few of the number:




Nikita Popov: Typed Properties and more. What's coming in PHP 7.4?




Nikita Popov, one of the most active and prominent core developers directly to PHP, deservedly got into the headliners of the conference. His report is an average between a changer with author's comments (plus code examples) and a visionary excursion into the future of the language. Nikita consistently and succinctly explained what awaits us in the next version of PHP and beyond.

According to the indicative timeline, alpha release version 7.4 will be held on June 6, 2019, and release 7.4 GA will be rolled out on November 21. Well, a year later, in December 2020, the rumored "eight" will come out.

The main thing that will get embodied in PHP 7.4:


Perhaps the most long-awaited innovation in the upcoming version is the ability to set types for class properties. It is noteworthy that such a property must be explicitly initialized, and if its default value is not specified, it will not be made null - no, an exception will be raised in this situation. Also among other things, typed properties will help to implement in PHP something like the ones still missing in the language intersection types. In other words, specify several types for the arguments at once.

The second major change in PHP 7.4 is the “debut” of switch functions. These are single-line anonymous functions - syntax sugar, which some developers believe, is useless, although others consider it to be just as useful.

It is also impossible to deprive of attention the operator ??= , which was previously absent in the language. This is what it does: if the parameter in the left parameter does not exist or is null, it is assigned the value of the parameter on the right.

Of the likely innovations that are still under discussion, generics were mentioned. However, Nikita immediately made a reservation that their full implementation is not an easy task.

As for the features that are recognized as obsolete in version 7.4, there are several of them. The processing of the ternary operator from left to right has been thrown to the dustbin of history - in the “eight” such a syntax will generate an error. The priority of the concatenation operator will also be lowered: if it is used together with addition or subtraction operators, those will be processed first.



At the end of the speech, Nikita was overwhelmed with questions that he tried to answer substantively, as far as he could, thanks to which the audience received several valuable leads.

Nikita Popov:
- I think that typed collections will be in the form of generics.

Dmitry Stogov: The most interesting in PHP 8





The line started by Nikita Popov was continued by another prominent contributor to the core of the PHP - Dmitry Stogov, Lead Engineer of Zend Technologies. He told about a slightly more distant future of the language - about the sacramental version 8.0. In recent years, he has focused on improving the performance of PHP and with the same accent built his story.

For a decade and a half, the language "accelerated." Significant performance spikes were achieved with releases 5.1 and 7.0. In the era of the "seven" there was a smooth growth: the increase in the speed of code execution from version to version was not radical. However, PHP 8.0 promises a bag of gifts for developers. They are waiting for a lot of interesting things.

We say "interesting" - we mean JIT? Not really. Yes, indeed, dynamic just-in-time compilation promises a rise in performance in version 8.0, but ... only in synthetic tests, in real applications, it is even possible to slow down, even if it is insignificant. However, improvements are possible.

Then “meat” began: Dmitry went deep into the basics of PHP and JIT work in it, simultaneously explaining “what’s wrong with JIT”, and shared with the public how the JIT, the preloading mechanism and FFI will be linked to due to which they are designed to improve the performance of PHP-code.

The above triad opens up new uses for PHP. It will be possible to write extensions directly in PHP, connect third-party C-libraries, without too much difficulty to create prototypes ...

But, as an honest engineer, Dmitry not only outlined the dizzying opportunities that would be available in the eighth version of the language, but also warned about its shortcomings, but rather, "non-optimal". Of course, it’s great that with preloading, the scripts are loaded when PHP starts, but without restarting they cannot be replaced, and some may not work with preloading as intended. Of course, it is wonderful when, thanks to FFI, you can operate with data structures defined in C, and the API at the interface itself is simple and pleasant, only here FFI opens up a thousand new ways to shoot yourself in the foot, and its performance without JIT is relatively low.

At the same time, there are more advantages from the combination of technologies that lie in the foundation of the G8 than drawbacks. In addition, many of the features that Dmitry mentioned in the report can be felt already in version 7.4.

Alexander Lisachenko: School of Magic PHP




Alexander Lisiachenko, the head of web development at Alpari, a member of the program committee of PHP Russia 2019, the creator and lead developer of the aspect-oriented framework Go! Aop. He offered a look at the language through a prism - our subtitle does not lie! - of magic.

Just as intuition is a hidden logic, so the magic in a programming language is the exploitation of abnormal or little-known features of this language based on a deep knowledge of its internal structure, “curvatures” and loopholes.

Alexander showed a few tricks as a diverft that many of those who sat in the hall (there were a minority of them among the juniors) blew up the brain. The speaker gradually got close to how to use the quirks that he had discovered during the years of digging into the gut of PHP, for the benefit of coding.

Magical methods, non-standard ways of accessing properties, changing contexts, streaming filters — all this and much more has been dismantled by “maestro Lisachenko” from a pragmatic point of view. Although it was impossible not to note the paradoxical beauty of what PHP haters would prefer to call congenital flaws. We do not know, we do not know ... We like it.

Alexander paid special attention to aspect-oriented programming for PHP, which in full accordance with the principle of practice what you preach uses in the tail and in the mane and which just the same laid the basis for its framework Go! Aop.

Dave Liddament: Practical advanced static analysis




Dave Liddament, director of Lamp Bristol, shared with the public his work on advanced static analysis of PHP code. As the author of the open source tool SARB, or Static Analysis Results Baseliner, he unfolded a kind of roadmap for the audience to introduce static analysis, so that everyone could borrow from his review solutions and techniques according to his own understanding, his own stack and needs. Or to use the report as a holistic mini-guide for the introduction of static analysis.

Focusing on the importance of the development environment as part of an arsenal for static analysis, our guest sincerely praised PHPStorm, which seemed to pleasantly surprise the section moderator, Roman Pronsky from JetBrains, who oversees this IDE in his company.

Dave started with the need for basic checks:


Those and a lot of other tools for static code analysis will be found in one glorious GitHub repository .

For adherents of symfony, the report was doubly useful: to those who use the framework in their work, he gave a whole bunch of tips and tricks on the introduction of static code analysis.

Dave went further into the nuances of using more advanced tools, primarily Psalm, Phan and PHPStan. He made a separate emphasis on work in the context of Continuous Integration (and also recommended some tools to the listeners).

The classification of bugs and “almost bugs” from Dave was also cognitive, in the light of static code analysis and detailing exactly how they hit on the design. For example, even if the specified type of parameter is incorrect and does not generate an error in your workflow, however, as the project becomes more complex, it may easily turn out to be a rake, on which another team member will step. According to the statistics presented in the presentation, similar evolvability defects (flaws revealed during code evolution) account for approximately 80% of the bugs that emerge during code review.

And also ...




It is difficult to outline the conference program with a dotted line: all the conference content was useful, but a meticulous enumeration of all 22 reports, even with the shortest possible presentation of their theses, would have turned the report into an unreadable sheet, so mentioning just a few more.

Keeping the promise, Cyril Smelov from JetBrains plunged into the details of the internal structure of PHPStorm, including touching on how PHP is involved in creating the IDE.

The speech of Anton Titov from SpiralScout LLC turned out to be a rare case in the conference program, when thematic deviations from the “strictly PHP” course were made, but his story about developing hybrid PHP / Go applications using RoadRunner was definitely successful.

Tomas Votruba (Tomáš Votruba), a delegate from the Czech Republic, called a full house, in detail telling how to make refactoring of large legacy-code arrays less painful and speed up the process many times with the help of the solution for its authorship - Rector.

Dmitry Eliseev (ElisDN) read the report “Competent OOP: Organization of Reliable Business Logic”, in which he disassembled, among other things, how to divide UI and business logic.

Unconference and mitapas


Toward the end of the main program, instead of one of the standard blocks, the format Unconference was tested - an analogue of the “open microphone”: anyone could go out and make a mini-report on a topic that seemed to him entertaining. The pilot of such an “IT stand-up” was a success: Alexander Makarov told about what Yii3 would most likely be, a guest from Badoo shared a story about how they and their colleagues made a proxy for Xdebug, and finally, another spontaneous performance was devoted to the features of the work. with specialized label printers and check and bolt all this stuff to PHP.



In a separate, fourth hall, a set of application mitaps started in the afternoon (and they also found their audience):


In turn, the partners of the conference did not set up a “graveyard of racks”, but unobtrusive, amusing, and appropriate movement. ManyChat had online quizzes on PHP knowledge, a contest to create and “unravel” bots, and a cool regular expression crossword. In the corner of Badoo were cut in Tech Alias ​​- IT-version of the desktop Alias. Well, at the Paxful booth, “atypical purple elephants”, stickers and sweets from Estonia were waiting for visitors.





"Fixing" traversed


The afterparty became a pleasant in all respects case of cooperation within the community: its organizers arranged together with the initiators of the Beer PHP meeting. At the end of the main program, those who wish, and among them a fair number of speakers, moved to the "Red October" to continue the disputes in the "Kraft atmosphere."



What do we think about "elephants 2020"


If it is very concise, then PHP Russia 2020 - to be. In addition to the basic formats that have proven their relevance, the next conference will definitely have a new one. The organizing committee's wish list and changelog are still in the process of filling, but something is already clearly clear.


In general, stay tuned!



PS Finally - a small bonus. As some of you know, the native habrovchanin and member of the PHP Russia Program Committee Konstantin Burkalev also hosts IT podcasts. And the next, 104th edition of his SDCast is an interview that he interviewed two of the most highly worthy conference speakers, Anton Shabovty and Anton Morev. He talked with the first about asynchronous PHP, multitasking and long-livedness of PHP-processes, with the second about Rest API and GraphQL, the pros and cons of approaches, areas and tasks of application. Enjoy your listening!

Source: https://habr.com/ru/post/454028/


All Articles