The Bloat

5 points by milkandcigarettes


algernon

I look at that screenshot with the ifs, and can't help but wonder why...

for key in ["description", "generatorType", ...]:
  if key in song:
    payload[key] = song[key]

...would be hard? Collect all the keys with a grep and some sed, throw them in an array, loop over them, and you have a couple of hundred lines less. No tokens necessary. And with a few hundred lines less, maybe the rest would be easier to clean up too - also token-less. Having maintainable code makes me warm and fuzzy inside, and I'm happy to spend five minutes to clean a large block of ifs up at least.

vittorioromeo

Perhaps I am missing the point, but if the code is indeed throwaway because "we just need it to work", why does it matter if it's bloated/ugly if it gets the job done?

If you expect the code to be changed in the future and you don't personally have time to debloat it by hand, you could ask the same LLM that generated it do simplify it for you.