Junior Code Review: Cache, N+1 Queries and "Messy" Code

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

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

  • @satishksharma
    @satishksharma 12 дней назад +10

    Thank you for reviewing my code and giving your precious advice. I will care on it.

  • @tiborkovacs198
    @tiborkovacs198 12 дней назад +8

    I’m an aspiring junior developer who just finished my studies and am focusing on the Laravel + Inertia + Vue.js stack. I've learned so much from your videos-thank you very much! I really appreciate your junior code reviews.

  • @minthantoo3509
    @minthantoo3509 12 дней назад +6

    Was waiting for your video all week long. Happy 40.

  • @adilomer7415
    @adilomer7415 12 дней назад +4

    One of the things I learned from you a few months ago is the importance of including a README file and other stuff. I’m currently working on a project, and once it’s done, I’d like to have you review my project if possible so I can keep improving my skills for future projects.

    • @LaravelDaily
      @LaravelDaily  12 дней назад

      Sure, if I have more free time then, and if it's valuable for others. And you would probably need to wait for at least a few weeks for the review. Email me povilas@laraveldaily.com then.

  • @ЖеняХристенко-е3ы
    @ЖеняХристенко-е3ы 12 дней назад +1

    Thank you! Great, it is helpful for me!

  • @kemal6039
    @kemal6039 11 дней назад +2

    Great video as always. One thing about using @class directive, I'm using vscode and it doesn't autocomplete tailwind classes when it's inside the @class directive. And it sometimes can be annoying to type all the classes by hand. That might be why they went with that approach.
    To work around this, I give the classes in default html class attribute and then move it into @class directive. I can suggest this approach in case anyone else finds it annoying.

  • @ranostaj-dev
    @ranostaj-dev 11 дней назад

    Good tips, regarding the SQL performance I rather use Query Builder than Eloquent Relations, especially in this scenario this could be a better option and such a list could be written using one Query

  • @373323
    @373323 12 дней назад +1

    awesome review, very interesting and educational

  • @LoganathanNatarajanlogudotcom
    @LoganathanNatarajanlogudotcom 11 дней назад

    Thank you!

  • @odehadejoh9966
    @odehadejoh9966 12 дней назад +1

    I completely agree that the balance could have been calculated in the query.
    But a lot of the time, I see that programmers only want to use SQL to fetch data, forgetting that it can also transform data as required.

  • @marcelaodev
    @marcelaodev 12 дней назад

    Great content!

  • @mdatiqurrahman2561
    @mdatiqurrahman2561 12 дней назад +1

    Hey Povilas,
    Thanks for your video! I've been following your tutorials since 2019, and they've helped me a lot in improving code quality and optimization. If possible, could you please make a video on when developers should use raw queries versus Eloquent? While reviewing junior developers' code, I noticed they often mix raw queries with Eloquent without knowing when each approach is appropriate or what the best practices are.

    • @krekas
      @krekas 12 дней назад +2

      When you can't get the result without basic eloquent features, then use raw. I think it's simple as that.

    • @LaravelDaily
      @LaravelDaily  12 дней назад +1

      There's no one-size-fits-all advice. I guess it's preferable to use Eloquent, then in some cases you may switch to Query Builder (search my video on "whereHas vs Join"), and if that doesn't work, THEN you try to switch to Raw.
      But this is mostly my personal opinion, other devs may have different perspective.

    • @mdatiqurrahman2561
      @mdatiqurrahman2561 12 дней назад

      @@krekas I know, but some cases they use raw queries where it's possible to use eloquent or DB queries.
      However, for the complex reports, sometimes it's better to use raw query instead eloquent.

    • @krekas
      @krekas 12 дней назад

      @mdatiqurrahman2561 for reports, you might need a lot of sql functions to get data like min, max, avg, etc. Then, without raw I don't think it's possible

  • @trexlm
    @trexlm 12 дней назад

    Nice video, thanks :)

  • @marcelaodev
    @marcelaodev 12 дней назад +2

    I assume there was no tests.
    A very simple test would have catch the factory issue.

  • @iamriwash7943
    @iamriwash7943 12 дней назад

    can u make video about stored procedure with laravel

    • @LaravelDaily
      @LaravelDaily  12 дней назад

      I don't really use stored procedures so I can't make a video, sorry

  • @earavichandran
    @earavichandran 12 дней назад

    Sir, is it possible to seed a particular table data in Database seeder? I mean, for example, i have subject table with some specific subjects and students table with student data like name regulation semester etc... When i run db:seed , i need to populate the student data and subject data (not random fake data) Is it possible? Apologize me i my question is wrong...
    Thank you.

    • @felixmensahafedzo70
      @felixmensahafedzo70 12 дней назад +2

      It's totally possible. I do something similar by seeding the data from a JSON file.

    • @earavichandran
      @earavichandran 12 дней назад

      @felixmensahafedzo70 Thank you for your valuable suggestions 🙏🙏

    • @felixmensahafedzo70
      @felixmensahafedzo70 12 дней назад +1

      ​@@earavichandran You're welcome

    • @LaravelDaily
      @LaravelDaily  11 дней назад +2

      Yes it's surely possible, you don't have to seed fake data, you can get it from any source you want, like your own database or external files.

    • @earavichandran
      @earavichandran 11 дней назад

      @LaravelDaily Thank you for the valuable information sir

  • @chikugerson5291
    @chikugerson5291 5 дней назад

    ​ @LaravelDaily on the N+1 queries whats the ideal number of queries that should be made to a DB so as to know when the queries are well optimized...I might have missed it

    • @LaravelDaily
      @LaravelDaily  5 дней назад

      There's no specific number, depending on the page. The lower, the better.