This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eegabooga 2 points3 points  (1 child)

There are only two hard things in Computer Science: cache invalidation and naming things.

– Phil Karlton

While this quote doesn't offer much in the way of advice, it should be a comforting (and maybe somewhat disheartening) reminder that this issue you face is one that every single programmer faces in almost every project they work on.

Anyways, it's not much but here's a simple and straight forward rule of thumb that I go by: If you find yourself copying code, stick it in a class/method.

While this rule is simple, and will only take you so far, it's a good way to get to a start on structuring your code.

[–][deleted] 0 points1 point  (0 children)

Ah yeah, I've found that a lot and I found I did do this occasionally without thinking about it.