Hacker News new | ask | show | jobs
by hs 6449 days ago
"I can’t stand having 60% of the work day tied up with: copy-and-paste chunk of code, then tweak for new field names, then make sure to update the correct database fields, add validation, ad nauseum."

no wonder with that approach (copy paste, field names, etc) ... one will get bored

a good approach is "do without"

how do i write better, simpler code w/o copy paste

how do i eliminate using field names (i don't know in php, but maybe use list and map ... nullify the need for temp variables)

maybe do w/o database? maybe use in memory persistence, load once, write every time?

how about javascript validation instead of php equivalent? better user experience

how about cutting the 100 loc (peppered with temp var, fn, loops and other nasties) to 5 loc (say using map, apply, lambda, closure -- again, i don't use php)

i do notice that codebase that has limits (like can't be > 1000 loc) is usually better than the no-limits equivalent

"do without" will force u to think and it's more fun because your code won't be similar to others' boilerplate

the code probably won't be 'best industry practice' aka code that coworkers/employers will appreciate; however, the beauty of your own code can only be enjoyed by you only ... and i think that itself is a great reward

but of course u can't hide from responsibility when the code breaks, otherwise one can always blame the copy-paste or legacy codes -- anyway holding the responsibility alone is a priviledge, not liability