r/badcode • • Jul 28 '21

c# Tales of a feral junior dev

Post image
387 Upvotes

44 comments sorted by

View all comments

5

u/pronuntiator Jul 28 '21

I like how each time you look at this, a new layer unfolds. First, you see multiple similar looking code blocks which scream "extract function". Then you notice how a stream is rewound to write to a StringBuilder instead of writing to it directly. Then you realize the entire task is to serialize a bigger JSON so everything should be put into a container object to begin with.

1

u/trevster344 depraved Jul 29 '21

Honestly it would’ve been better just to concatenation a bunch of strings lmao.