Sketches with PHP Russia 2019: clean code, dark magic



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

    During the period of the “great pie-freeze glaciation” - large PHP conferences in Russia have not been held for as many as nine years - the community around the language has a need for such a meeting place. At the same time, high hopes were pinned on the event, and the task to please all interested was seen as extraordinary. But fear has big eyes, and healthy paranoia has good peripheral vision: the experience of IT events on our organizing side, together with the power of “PHP magic” on the side of the program committee and the authority of its participants in the industry, made it possible for us to organize a mature event on the first try.

    Almost 500 people arrived in PHP Russia. The online audience was also quite big - several hundred viewers connected. The basis of the program was “cemented” 22 reports, including five from eminent foreign speakers, as well as three meetings and performances in the improvisational format Unconference in a separate stream.



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

    Alexander Makarov, co-organizer of the conference
    - We thought for a long time in the program committee and finally shook the grid so that the puzzle worked out: we abandoned the idea of ​​putting the English speakers in a separate stream, we watched the reports to be mutually balanced. Relatively speaking, so that the most hit ones go in parallel and not one pulls the majority of the audience. Of course, there were conceptual connectives inside each track: for example, right after the speech by Dave Liddament, who, speaking about the static analysis of PHP code, paid a lot of attention to PHPStorm, the report of Kirill Smelov started in the same room, where the device of this IDE was sorted out, and for a story about innovations in PHP 7.4 was followed by a presentation on 8.0.

    About topics


    As it was intended , the lion's share of performances 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 capabilities, work with specific frameworks and even machine learning using the PHP stack were highlighted.



    Key Papers


    The program committee approached the selection of reports scrupulously, therefore it was problematic to identify the “coolest” ones: there were no frankly passing blocks in the program, at least according to the results of the first feedback from the guests. So, as an example, we had to single out several of the following:

    • the most crowded;
    • the most anticipated;
    • the richest in surprise.



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




    Nikita Popov, one of the most active and prominent core developers of PHP itself, deservedly got into the headliners of the conference. His report is a cross between a changelog with author comments (plus code examples) and a visionary excursion into the future of the language. Consistently and succinctly, Nikita explained what awaits us in PHP in the next version and beyond.

    According to the estimated timeline, the alpha release of version 7.4 will take place on June 6, 2019, and the release of 7.4 GA will be rolled out on November 21. Well, a year later, in December 2020, the “eight” fanned by rumors will be released.

    The main thing that will get implemented in PHP 7.4:

    • typed properties;
    • FFI - Foreign Function Interface, for working with external functions in C;
    • arrow functions;
    • - preloading;
    • - operator ??=;
    • - covariant return types;
    • - weak links (WeakReference);
    • - adding an operator for arrays.

    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 necessarily be explicitly initialized, and if its default value is not specified, it will not become null - no, in such a situation an exception will be thrown. Also, among other things, typed properties will help to translate into PHP something like the ones still missing in the intersection types language. In other words, specify several types for arguments at once.

    The second major change in PHP 7.4 is the debut of arrow functions. These are one-line anonymous functions - useless, as some developers are sure, syntactic sugar, although others find it just the same useful.

    It is also impossible to deprive the operator of attention??=that was previously absent in the language. Here's what it does: if the parameter on the left does not exist in the expression 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 considered obsolete in version 7.4, there were several of them. Processing the ternary operator from left to right has been thrown into the dustbin of history - in the G8 this syntax will generate an error. The priority of the concatenation operator will also be reduced: if it is used together with the addition or subtraction operators, they will be processed first.



    At the end of the speech, Nikita was inundated with questions that he tried to answer as objectively as he could, thanks to which the listeners received several valuable tips.

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

    Dmitry Stogov: The most interesting thing in PHP 8





    The line, which Nikita Popov started, was continued by another prominent contributor to the PHP core - Dmitry Stogov, lead engineer at 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 PHP performance and has built his story with the same emphasis.

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

    We say "interesting" - mean JIT? Not really. Yes, indeed, just-in-time dynamic compilation promises a performance boost in version 8.0, but ... only in synthetic tests, in real applications, even a slowdown is possible, albeit insignificant. However, improvements are possible.

    Then the “meat” began: Dmitry went deep into the basics of PHP and JIT in it, explaining along the way “what is wrong with JIT”, and shared with the audience how JIT, the pre-loading mechanism and FFI and for due to what they are designed to increase 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, create prototypes without extra work ...

    But, as an honest engineer, Dmitry not only outlined the dizzying possibilities that will be available in the eighth version of the language, but also warned of its shortcomings, but rather, "non-optimality." Of course, it’s great that with preloading scripts are loaded at PHP startup, however, they can’t be replaced without restarting, and some may not work with preloading as intended. Of course, it’s wonderful when, thanks to FFI, you can operate on data structures defined in C, and the API itself is simple and pleasant, only 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 pluses from the combination of technologies that lie in the foundation of the G8 than minuses. 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




    The full room after lunch was gathered by Alexander Lisachenko, head of web development at Alpari, member of the program committee of PHP Russia 2019, 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 logic that is hidden from reason, so magic in a programming language is the exploitation of abnormal or little-known capabilities of this language based on a deep knowledge of its internal structure, “distortions” and loopholes.

    Alexander demonstrated as a divertissement several tricks that many of those sitting in the hall (and there were a minority of juniors among them) blew up the brain. The speaker gradually got closer to how to use the tweaks that he discovered over the years of digging in the gut of PHP, for the benefit of coding.

    Magical methods, non-standard ways of accessing properties, changing contexts, stream filters - all this and much more “maestro Lysachenko” took apart from a pragmatic point of view. Although it was impossible not to note the paradoxical beauty of what PHP haters would prefer to call innate flaws. We don’t know, we don’t know ... We like it.

    Alexander paid special attention to aspect-oriented programming in 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 foundation of its Go! Aop.

    Dave Leading: Practical advanced static analysis




    Dave Liddament, Director of Lamp Bristol, shared with the public his best practices regarding advanced static analysis of PHP code. Being the author of the open source tool SARB, or Static Analysis Results Baseliner, he unfolded a kind of roadmap for the audience to implement static analysis, so that everyone could borrow from his review solutions and techniques that he thought fit his own stack and his needs. Or to use the report as a holistic mini-guide for implementing static analysis.

    Emphasizing the importance of the development environment as part of the 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:

    • Linting.
    • Checks for compliance with programming standards (including for assessing the consistency of code that is written inside the command), for example using PHP CS Fixer .
    • Security code analysis. As such a tool, the speaker recommended Security Checker from SensioLabs, the authors of Symfony.
    • Checks for forgotten var_dump.
    • Automatic synchronization check composer.json and composer.lock (composer validate)

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

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

    Further, Dave delved into the nuances of using more advanced tools, primarily Psalm, Phan and PHPStan. He made a separate emphasis on work in the conditions of Continuous Integration (and he also advised some listeners on the tools ).

    The classification of bugs and “almost bugs” from Dave was also informative, in the light of static analysis of the code and with details of exactly how they hit development. For example, even if the parameter type is incorrectly specified and does not cause an error in your workflow, however, as the project becomes more complex, it can easily turn into a rake that another team member will step on. According to the statistics presented in the presentation, such evolvability defects (flaws revealed during the evolution of the code) account for approximately 80% of the bugs that come out during the code review.

    And also ...




    It is difficult to outline the conference program: all the conference content was useful, however, a scrupulous listing of all 22 reports, even with the shortest possible summary of their theses, would turn the report into an unreadable sheet, so let’s mention just a few more.

    Keeping a promise, Kirill Smelov from JetBrains plunged into the details of the PHPStorm internal device, including how PHP was involved in creating the IDE.

    Speech by Anton Titov from SpiralScout LLC turned out to be that rare case in the framework of the conference program when a thematic deviation from the course "strictly in PHP" was made, however, his story about the development of hybrid PHP / Go applications using RoadRunner was definitely successful.

    Tomáš Votruba, a Czech delegate, called a full house, telling you in detail about how to make refactoring large arrays of legacy code less painful and speed up the process by several times using the decision by his authorship - Rector.

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

    Unconference and mitaps


    Toward the end of the main program, instead of one of the building blocks, the Unconference format was tested - an analogue of the "open microphone": anyone could go out and make a mini-report on a topic that seemed interesting to him. The pilot of such an “IT stand-up” was a success: Alexander Makarov spoke about what Yii3 is likely to be, a guest from Badoo shared a story, how he and his colleagues made a proxy for Xdebug, and, finally, another spontaneous presentation was dedicated to the features of work with specialized label printers and a check and screwing this whole thing to PHP.



    In a separate fourth room, after lunch, a set of applied mitaps started (and they also found their audience):

    • "Laravel vs Symfony: a comparison of incomparable."
    • "How to Contribute to Symfony and Why Do It."
    • "How to use Yii2 in Enterprise? Get the best practices from Symfony! ”

    In turn, the conference partners did not arrange a “cemetery of racks”, but an unobtrusive, entertaining and appropriate movement. ManyChat had online PHP quizzes, a contest to create and untangle bots, and a cool regular expression crossword. In the corner, Badoo cuts in Tech Alias ​​- an IT version of Alias ​​desktops. Well, at the Paxful stand, visitors were waiting for “atypical purple elephants”, stickers and sweets from Estonia.





    "Securing" the past


    Afterparty became a pleasant case of cooperation within the community in all respects: the organizers arranged it together with the initiators of the Beer PHP meeting. At the end of the main program, those who wanted, and among them a fair number of speakers, advanced to Red October in order to continue the debates in the “craft atmosphere”.



    What do we think about the “elephants 2020”


    If very concise, then PHP Russia 2020 - to be. In addition to the basic formats that have proved their relevance, there will certainly be a new one for the next conference. The Wishlist and Organizing Committee changelog is still in the process of filling, but something is already clear for sure.

    • Without a doubt, we will continue to make Unconference: people are happy with the format and ask for more.
    • We will try to order a piece of elephants. At PHP Russia 2019 they were not: it turned out that the rights to them belong to the guys from France, and they are very slow - they need to be ordered for 4-6 months.
    • Almost certainly we will bring the same Marco Pivetta, who was in our program, but fell off at the last moment for reasons beyond his control. We also have views of the father of Symfony Fabien Potencier. In the end, we will try to bring Rasmus Lerdorf too: we called him to the first conference, but he had intersections with other events.

    All in all, stay tuned!



    PS Finally - a small bonus. As some of you know, Konstantin Burkalev , a native Habrovsk resident and member of the PHP Russia program committee, also hosts IT podcasts. And the next, 104th edition of his SDCast is an interview that he took from two highly deserving conference speakers, Anton Shabovty and Anton Morev. He talked with the first about asynchronous PHP, multitasking and long-lived PHP processes, with the second about the Rest API and GraphQL, the pros and cons of approaches, areas and tasks of application. Have a nice listening!

    Also popular now: