At what point should you change your script to a function
Posted: Thu Jul 12, 2007 6:17 am
I'm still not in the habit of creating functions or classes in whatever I write. Really I am just asking for some advice about how often I should be writing functions. I don't fully understand OOP yet so we'll leave this out.
Do you create a function at every change possible or do you tend to use them as soon as you see yourself writing the same bit of code twice?
Do you see it worth the hassle of having to work out a function that can handle 2 types of situation but run similar code or do you find it best to whack an if statement around 2 similar pieces of code?
Do you create a function at every change possible or do you tend to use them as soon as you see yourself writing the same bit of code twice?
Do you see it worth the hassle of having to work out a function that can handle 2 types of situation but run similar code or do you find it best to whack an if statement around 2 similar pieces of code?