r/ProgrammerHumor • • Nov 25 '22

Meme Coding strategies

Post image
52.2k Upvotes

385 comments sorted by

View all comments

Show parent comments

87

u/CanadaPlus101 Nov 25 '22

That's the dream, isn't it?

6

u/BetterOffCamping Nov 25 '22

It is not. I've done it. Once you understand the complicated mess (often a big ball of mud or spaghetti code) you can identify the edge cases.

With an understanding of core design patterns, the core logic can be simplified, while edge cases can be moved to independent classes with a strategy pattern, chain of responsibility, adapter, or some other pattern.

Sometimes it can't be done that way, of course, but one usually can better clarify the edge case visibility and group it at the very least.

Edit: automated tests must be built that verify the new version output matches the old output.

1

u/CanadaPlus101 Nov 26 '22

Hey, good for you! I've done some work I'm pretty proud of too but I've never had clients to deal with (poverty life FTW).

0

u/[deleted] Nov 25 '22

[deleted]

10

u/Malijaffri Nov 25 '22 edited Nov 25 '22

⚠️⚠️ Copy-Paste Bot ⚠️⚠️

This bot stole part of this comment, and it doesn't even make sense out-of-context: https://www.reddit.com/r/ProgrammerHumor/comments/z4ay66/coding_strategies/ixqmd60/

Report -> Spam -> Harmful Bot

Edit: I am a human volunteer. Check out my source code on Wikipedia.

6

u/CanadaPlus101 Nov 25 '22

So do you have this running on your main account?

7

u/Malijaffri Nov 25 '22

This isn't some kind of bot or script. I am a human volunteer, and this is something I do manually whenever I find something like this in the wild. I don't look for them either. I use this as my own account, and simply dislike the overflow of harmful bots these days. I have this message copied to my notepad (mobile user) and just copy it here and change the source link whenever I find one. I still hold out some hope that we can overcome this epidemic :)

6

u/CanadaPlus101 Nov 25 '22

Oh. You might want to change it to "human volunteer" like the image-to-text people do. Thanks for the hard work!

11

u/elon-bot Elon Musk ✔ Nov 25 '22

Due to unforeseen circumstances, you will now be receiving your salaries in Elon Bucks, accepted at any Tesla location!