Egregoros

Signal feed

Timeline

Post

Remote status

Awkward spot where I don't know if my code is garbage or the AI / everyone else on the planet are just overcomplicating things.

I let it pull out a few utility functions into a new file and it went
from utils import foo, bar

like bro. Just import utils...
Am I crazy?

it defines functions INSIDE main()
WHY? Are those good patterns, are those bad patterns that ape good patterns because I told it to stop doing OOP? Are they just bad and I am the one who is right?
I can't tell at all anymore

Replies

5
@WandererUber tbh, anti-patterns are things understood in hind sight.

If you are doing C++, I've enjoyed writing the program like a script in main, and got to take advantage of closures for functions.

There was not a lot of code that benefited from being made into a function, but the things that did were super easy because of closure.
@hazlin @WandererUber >I can't tell if these clothes are good
move in the clothes and see where and how the clothing inconveniences you
>I can't tell if this code pattern is code
maintain the code over time. Add new features, adapt it for a different target, upgrade a library to a slightly incompatible version and change your uses, swap libraries, take out part of your code and use it elsewhere, reuse part of your code in a slightly different case, come back to your code two years later and see if you can still understand it when you do these things, etc.
It's exactly the same. Clothes are good or bad based on how the clothes copes with a body in movement. Code patterns are good or bad based on how the pattern copes with a codebase in movement.

Which is indeed understood in hind sight.