#Copy paste code: yay or nay

1 messages · Page 1 of 1 (latest)

pale vessel
#

@sudden fox

sudden fox
#

alright, programming shortcuts

#

so you dont think that using shortcuts, to speed up game development is a good practice?

pale vessel
#

i can agree with snippets, as long as you keep m precise and single tasked for a very usual template

#

i just dont agree with copy pasting code that you think you understand that you didnt already completely write yourself

#

like for example, if i see anything like an example on google as a solution to a problem, i neer copy paste that. but a character controller that i wrote for another game that can be applied to this game i do copy, cuz i wrote that code myself. though i will still check if i remember every bit of it and if not i might rewrite it anyway as it may have been too long ago

sudden fox
#

then, even if it is a little 'cheaty' doesnt using snippets almsot turn it into a sort of code blocks situation

#

as long as you understand what the parts do, the machine works the same. whether you forged the cogs by hand or not

pale vessel
#

for example, do you use a for loop snippet?

sudden fox
#

yea easily. i use for loop snippets, i use raycast snippets alot too

#

honestly, my code is a bit sloppy. thats without debate. but as a hobby game dev, especially solo, you gotta cut corners to bring a product

pale vessel
#

thats fair, and i do to so i would be a hippocrit if i was against it, but at some point, you use them so much that if you dont have the snippet anymore, you may need to look up how exactly you need to structure the for loop

sudden fox
#

alot of the times, you make a sorta 'kinda works' and then fix it as problems arrise

#

and its fair that, you have to decide where you want to sit on a game development team

pale vessel
sudden fox
#

you have to get good at one thing, no matter what. whether that be art, sound, level design, or programming

#

you dont want to use shortcuts for everything, or you never become good at anything

#

in all honesty, ive been programming for a long time, but my code is pretty dogshit. i think i made it to 5 kyu on codewars?

#

i dont even know where to start on making better code, that actually does what needs to be done.

#

because you either google solutions, and then go thru the documentation to figure out what every piece of thier code does

#

or you jsut reuse your own, and risk learning incorrectly

pale vessel
#

like for example, just for aesthetics sake.
i started inversing if statements to prevent indentation...

#

like:

if (x == true) {
  //do stuff
}

to

if (x == false) {
  return
}
// do stuff
#

this is also for eadability sake, once you get used to that is pretty nice to not have stuff move to the right so much

sudden fox
#

thats tue. what tools do you use? when learning new things?

#

do you study other peoples codes

pale vessel
#

um, well i usually just pick something to learn, and then try to start a project for it so i can use it directly, and then its just looking at a lot of documentation or even source code

#

like for example, i learned golang by writing my own programming language transpiler in it which got transpiled in an assembly style language

sudden fox
#

just curious do you do mostly 2d or 3d

pale vessel
#

i usually come up with a game first, then decide based on it if it should be 3d or 2d