4 ms·
I guess I'm one of those bad programmers who does "weird things" , I often create a string with my entire page and then output it. I thought it made more sense
by clintavo 18y ago
I guess I'm one of those bad programmers who does "weird things" , I often create a string with my entire page and then output it. I thought it made more sense since I now have a string that I can run regexes on or find/replace if necessary. Also it makes it easy if I decide I want to cache the page somewhere, I think I must be "dumb and gets things done."
- mixmax 18y agoI think there's a wee bit of differnece between creating a string with a whole page because you don't know that you can jump in and out of PHP mode and creating a string with a whole page in order to do regex'es on the string :-)
- Ramone 18y agoPHP (I assume we're still talking about PHP) has had output buffering for about a decade. So yeah that is a weird thing. ;)
- johnrob 18y agoI've done this before. If you're the sole owner of something, and especially if there will never be a designer in the mix, I think it makes sense to stick with what you are (and more importantly will be) familiar with. I once used python string substitution as a poor man's template system, because I knew that when I came back to that code months/years later, I'd still know how string formatting works w/o having to refer back to documentation.
- dasil003 18y agoNothing really wrong with that per se. The problem is if at one point you decide that's just the way to do things and you never learn new approaches. If you want to be a good programmer you have to try different things and learn the pros and cons for yourself. Best practices are a decent jumping off point, but developers often overestimate their own best practices that they've learned while working on certain types of projects. It's especially insidious among very smart developers who work in a narrow field, because their reputation causes their wisdom to be mis-applied by junior developers and cargo-culters.