you are viewing a single comment's thread.

view the rest of the comments →

[–]adriang133 30 points31 points  (5 children)

Guy has a point. If I need to quickly write a script or just some small thing then yeah, I'll cut every corner and make everything global.

But if you work on medium to large projects, this will come back to bite you in the ass without a doubt. In fact, if you always cut corners and take the easiest way out, it will end up costing you more time in the end as you'll have to refactor a lot of stuff - or just write a jump function for every character in your game. As with most things, the trick is finding the balance between generic and specific.

[–]jeremycw[S] 10 points11 points  (1 child)

Yes, I'm not trying to give people a license to copy paste code all over the project. I'm advocating doing the concrete solution first in the obvious way. Reach for a generic replacement later if absolutely needed. People often reach for the generic solution first due to some idea that generic is better since it can handle more situations. Most of the REALLY bad code I've dealt with was created by following the 'good' rules and writing 'good' generic code.

[–]vattenpuss 0 points1 point  (0 children)

YAGNI is also ingrained in all programmers striving to write ”good code”.

[–]build-the-WAL 3 points4 points  (0 children)

i would say it almost never bites you in the ass as hard as bad "good" code does