Clean code best practice in PHP. Less DB calls or friendlier code [closed]

152
August 11, 2021, at 7:40 PM
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed yesterday.

Improve this question

Have a question about best practice in PHP web development. What's more important, less SQL calls or cleaner code?

For example

I have an application, whenever an event is saved it will update to the users google calendar.

When its saving the event, the user and event classes are being called.

Option 1. On event update, event class will get the event details, user class will get the user details. The event and user details will get passed to the calendar class which will update the calendar.

Advantage: less DB calls. Disadvantage: more messy because the event and user data has to get properly passed to the calendar class.

Option 2. On event update, calendar class will be called with the event id. The calendar class will get the user and event details (by calling the event and user class independently or another way) and update the calendar.

Advantage: very easy to call a calendar update, just pass the event id. Disadvantage: more DB queries as the calendar class also gets the event and user data.

Would love to get your opinion

Rent Charter Buses Company
READ ALSO
Upgrade python version in GCP Composer

Upgrade python version in GCP Composer

We have a GCP composer with Python version 3I would like to update the version to Python 3

154
How to combine a front-end library and Node tool in one package without front-end bloat?

How to combine a front-end library and Node tool in one package without front-end bloat?

I have two libraries which I'm considering combining into oneOne is a front-end library (although it can be used in Node), the other is a command-line tool, with some Node dependencies

157
Group numbers from array that are right after each other [closed]

Group numbers from array that are right after each other [closed]

Want to improve this question? Update the question so it focuses on one problem only by editing this post

189
PHP environment behind nginx based proxy will not work

PHP environment behind nginx based proxy will not work

I want to run two different PHP based applications on one docker hostTo achieve that I am running an nginx proxy based on https://github

160