Writing declarative PHP

Поделиться
HTML-код
  • Опубликовано: 26 сен 2024

Комментарии • 25

  • @daylen577
    @daylen577 Год назад +4

    As a software developer of 15 years, I love writing declarative stuff, but imperative is almost always objectively better if working on a larger codebase, especially when doing so with multiple people. I remember in high school having my brain explode when I was told during math that I should not feel like there was limited space, and that I could always just grab a new piece of paper; more lines isn't inherently worse. Showing your steps and having everything be self-explanatory is more important 9/10 times.

  • @ChrisDaugaard47
    @ChrisDaugaard47 Год назад +6

    You're a really good teacher. Very clear, great pace and to the point. Keep up the great work!

  • @CHSKnight
    @CHSKnight Год назад +1

    Very informative. Thank you

  • @kurshadqaya1684
    @kurshadqaya1684 11 месяцев назад +1

    Amazing!

    • @aschmelyun
      @aschmelyun  11 месяцев назад +1

      Thank you! Cheers!

  • @mmalouf
    @mmalouf Год назад +1

    Please do more videos like this

  • @bitfirewall
    @bitfirewall Год назад

    Nice video. Subbed. Video idea: show writing some helper functions to make custom code more declarative.

  • @brunoggdev6305
    @brunoggdev6305 Год назад

    Inspiring!

  • @alnahian2003
    @alnahian2003 Год назад +3

    Mannn! It's like a breathe of fresh air.
    How can I learn more on declarative php? What are the best practices I should follow?
    I'm reading Adam Wathan's "Refactoring to Collections" book and trying to implement achieved knowledge in my code. But furthermore, what else books I can read?

  •  Год назад

    Good stuff!

  • @nowieszco868
    @nowieszco868 Год назад

    Nice. It's quite strange for me in Laravel, that almost everything is accessible from static methods. I'm so used to load everything as DI (symfony). It's for me more visible and more self explaining then (that we can browse direct source from the constructor).

  • @lucasayabe
    @lucasayabe Год назад +1

    A better way to classify something as declarative, is identifiyng if it's side effect free, because it describes a computation, and this computation can be executed without considering the context or order (in other words being composable), because it relies only in itself.
    Using this definition, the wrapping PDO example isn't declarative, because it causes a side effect, the declarative solution in this case is using something like an IO monad from Haskell, that let's you compose the computations and lazy execute the side effects. Besides this disclaimer, this example continues to bring an good abstraction.
    the video implies that the fluent interface pattern is equivalent to declarative programming, but as explained previously, if it causes a side effect, the use o fluent interface isn't declarative. That said the laravel helpers example is declarative in both of the examples, because the "imperative example" don't cause any side effect in his execution and all the function calls could be composed in one unique computation before the execution.

  • @scvroin
    @scvroin Год назад

    So, use what php or a framework/library provides, or use a value object with the right behaviors and chain them together?

  • @clintwinter4802
    @clintwinter4802 Год назад

    I've never seen someone use `print` instead of `echo` before!

  • @DeepStreamBits
    @DeepStreamBits Год назад

    Basically it's just creating abstractions to make the code more readable, right?

  • @kunduz2652
    @kunduz2652 Год назад

    what is ide name

    • @StevenOBird
      @StevenOBird Год назад

      Looks pretty much like VS Code

  • @kunduz2652
    @kunduz2652 Год назад

    show how to build a site from scratch with php

  • @Ihavetoreturnsomevideotapes
    @Ihavetoreturnsomevideotapes Год назад

    PHP 🤢

    • @StevenOBird
      @StevenOBird Год назад +6

      "Look mom, I'm on the PHP hate train!"
      Dude, its 2022. PHP is still viable.

  • @mikopiko
    @mikopiko Год назад +1

    Very interesting indeed!

  • @CodeWithBehram7497
    @CodeWithBehram7497 Год назад

    Simply explained really like your videos 🎉

  • @techatival
    @techatival Год назад +2

    Functional programming is also called declarative programming. I am right?

    • @lucasayabe
      @lucasayabe Год назад +1

      No, FP is a paradigm inside the group of declarative programming paradigms like procedural programming is a paradigm inside the group of imperative programming paradigms

    • @techatival
      @techatival Год назад

      @@lucasayabe Ah, so many paradigms. Thanks for your clarification.