Should I extract specific functionality into a function and why?

Posted by john smith optional on Programmers See other posts from Programmers or by john smith optional
Published on 2012-10-01T07:46:46Z Indexed on 2012/10/01 9:49 UTC
Read the original article Hit count: 247

Filed under:
|

I have a large method which does 3 tasks, each of them can be extracted into a separate function. If I'll make an additional functions for each of that tasks, will it make my code better or worse and why?

Edit: Obviously, it'll make less lines of code in the main function, but there'll be additional function declarations, so my class will have additional methods, which I believe isn't good, because it'll make the class more complex.

Edit2: Should I do that before I wrote all the code or should I leave it until everything is done and then extract functions?

© Programmers or respective owner

Related posts about java

Related posts about design-patterns