#Imposter syndrome

48 messages · Page 1 of 1 (latest)

quasi solar
#

Guys I am worried about the very small details in my code, by small I mean small stuff such as breaking up even 2 lines of code into functions obsessively trying to right perfect code. It's not allowing me to enjoy coding. I feel like these small questions are blocking me from things that actually matter.

I feel like if I don't write perfect code I'm not as good.

silk osprey
#

no one is perfect

#

even the best devs u know, even those billion dollar companies end up having critical vulnerabilities in their code

#

because they do not write "perfect" code

#

i don't either, and no one does

silk osprey
#

function call is expensive

quasi solar
#

Thanks

#

How do I learn about all these anyway

#

How to properly structure code etc?

tepid plank
#

i remember at school some dude who was a perfectionist wanted me to remove a for loop since it was 'expensive'

#

and to hardcode it for each item instead, claiming that it wasent bad since it was only like 4 items

tepid plank
#

he does good content on this

#

and he even made a video about what you were talking about, which is too much abstraction

tepid plank
#

JMP

#

2 if you count the JPM at the end of the function

#

anyway its not nearly as bad as some other things

silk osprey
# tepid plank JMP

a function call requires:

  • push the return address
  • push arguments (maybe)
  • save register values (push to stack)
  • do your stuff
  • restore all the register values (pop from stack)
  • pop the return address from the stack and jump
silk osprey
#

that's called loop unrolling

#

that's a compiler optimization

tepid plank
#

it was in a non critical code area where it didnt mater if it took 2 nanoseconds instead of 1

tepid plank
#

for most use cases it really doesnt matter unless you are repeatedly calling functions over and over

tepid plank
silk osprey
silk osprey
silk osprey
silk osprey
#

cherry on the cake, if you're writing code in interpreted languages, function calls are way more expensive than compiled ones as they can't really inline most functions

silk osprey
tepid plank
silk osprey
#

i even participate in challenges which requires u to write code which runs as fast as possible

#

so yeah

#

thanks for the advice, i will keep that in mind

tepid plank
silk osprey
#

not really

ionic hull
#

Write shitty code

#

It will get better later on