DEV Community

Alexandru Florea
Alexandru Florea

Posted on

Quick useful notes for any project

I find these notes to work in any project context, from small personal ones, up to ones that power large businesses.

In no particular order:

  • record user actions based on a predefined template, eg User did Action on Entity/EntityDetail at Date. In our example context, it could look like:

    Mark deleted_ticket id 257 at 3/29/2019

  • use Soft Delete whenever possible. Having a deleted_at
    information is more useful than actually deleting the entry from the database. Even if you do regular Database backup, someone someday will delete something important, despite the many warning and confirmations pop-ups you have in the app, and you will (usually) not waste a ton of space by leaving the entry there, but marked as deleted. ORM usually have this feature, and will not return deleted entries in other queries.

  • have a quick way to debug on live. Frameworks usually ship a more upgraded var_dump alternative, like dump($var) from Symfony. That's all nice but you can supercharge that or even the simple var_dump by making it work only in a certain condition, like if IP=x or a debug Cookie is present. You do not want in the middle of the night when you get a call from Support that (hypothetical issue) all users see all the other users tickets, and you need to fix it, to show random debugging strings on the live pages.

  • showing a lot of data with pagination? Remember that MySql(and I believe SQL in general) does not have a default sorting order. On a large enough dataset, you could get entry ID 20.000 when moving from page to page. A quick ORDER BY id DESC is all that is necessary to keep your mind at ease. On a table without any prior Deletes/Replaces/Updates most of the times though SELECT will give results in the insertion order.

  • projects grow unexpectedly, requirements will change and then they will change back, haha. That is something normal, at least from my experience. Having a way to track everything is essential and products like Trello, Asana, Active Collab etc can be really useful. But try to have a readme.txt file with some essential comments about the project's design, useful comments, things to note when moving from dev to production etc. When someone pulls the code from git, that file will make onboarding more straightforward, but it should prove useful for yourself as well in the long run, when you will need to add or update functionality x. Tip: keep it in markdown, IDE's like PhpStorm will render it correctly as well as Gitlab/Github and many other tools used in development.

The list could go on. What other quick tips do you use?

Top comments (1)

Collapse
 
hussein_cheayto profile image
hussein cheayto

Useful article.
You can also add: planning, reporting (check what's done and what's left to finish the project)