Is there such a thing as having too many private functions/methods?
Posted
by
shovonr
on Programmers
See other posts from Programmers
or by shovonr
Published on 2011-02-13T23:26:39Z
Indexed on
2011/02/13
23:32 UTC
Read the original article
Hit count: 241
I understand the importance of well documented code. But I also understand the importance of self-documenting code. The easier it is to visually read a particular function, the faster we can move on during software maintenance.
With that said, I like to separate big functions into other smaller ones. But I do so to a point where a class can have upwards of five of them just to serve one public method. Now multiply five private methods by five public ones, and you get around twenty-five hidden methods that are probably going to be called only once by those public ones.
Sure, it's now easier to read those public methods, but I can't help but think that having too many functions is bad practice.
© Programmers or respective owner