Results 1 to 1 of 1
March 27th, 2013, 04:29 PM #1
Best time saving device: Code using best practices
- Join Date
- January 18th, 2005
I just had to make another major change to my site and it was pretty simple because the original code was clean. Sometimes when you build your site your code is a little out there because you don't know exactly what you want or you hit a problem and add a fix. But I'm telling you, go back later, I don't care how long it takes and fix up the code.
Change hard coding to soft coding (i.e. use a variable instead of an actual value). Get all your indentions straight. If the same piece of code is needed in multiple places, create a function, etc. Function needed for several files, put it in its one file and import it. It might be a pain, but believe me in the long run you will save lots of time.
This sort of goes against the adage if it ain't broke don't fix it, and sometimes it is frustrating because you screw up working code, DO IT ANYWAY.
You probably will be cursing me as you fix up the working code, but once its done and months go by you'll see I am right.
I have found good code is very self explanitory even without alot of comments. Son don't forget to use variable which make sense :-)Expert who says Moo