3 ms·
Root -> Scripts --> Template ---> Pages -> Stripe -> CDN Although my methods have improved greatly over the years, in which I like to try and stick to no
by mattbgates 4y ago
Root
-> Scripts
--> Template
---> Pages
-> Stripe
-> CDN
Although my methods have improved greatly over the years, in which I like to try and stick to no more than a single page or two nowadays, I aim for the KISS method. In every file, I have a header:
/*
NAME: file.php
DATE: 4/10/2023
PURPOSE: this file processes the data that was passed to it
NOTES: leaving any notes for my future self
*/
Nice to keep track of everything with Git too but the main file has it all.
Best advice: the less you have to guess, the more you can stay ahead.
Pretend as if other people are reviewing your code and you don't want them to get lost. In your case, its your future self: if I need to come into this code at a later time to either debug a feature or add a new feature, how long will it take me to figure out what my code is doing? It's basically like leaving yourself easy-to-follow breadcrumbs.
Fill your code with an important header. Try to add a comment to every section of code, if not every line. Be descriptive. The little extra time you take explaining what your code is doing and maybe even why will save you heaps of time in the future. The other good thing is that if you ever sell your code or hire someone to manage your code, you have left a detailed paper trail for them, so they don't have to just follow your code.
I picked this up from my first job. I was hired to fix bugs in an existing program by a half dozen programmers that never left comments for each other. So I upgraded the code as much as I could to leave comments along the way for future devs. Didn't really matter in the long run, as a few years after I left the company, the boss had sold the windows application to another company, who in turn destroyed it, so they could promote theirs.
But I've always kept to this documentation mentality for my best practices.