Jeff Atwood says that code folding gets overused, and abused. I do use code folding, especially when I am reading someone else’s code. I typically fold by indentation, it gives me a nice overview of the file and its artefacts. I can choose to open a fold, optionally recursive, and focus only on that part.
By usage I believe that code folding is primarily for reading the code, not for writing it. The programmer writing the code should not worry about which parts of the code should fold and which should not. Leave it to the reader. It is not a function of the data, it is a function of the view. So I prefer not to pollute the code with folding directives and such. Folding has not helped me in organization of the code either.
If there is a lot of boilerplate code, I would prefer that it is in fact NOT folded exclusively. It can lead to a good starting point for refactoring the code. It can be valuable if it is assisted with multiple, handy ways of navigating the code.
Of course these are my preferences, and that is how it should be. Editors should allow programmers to use their own way of folding code and viewing it. If folding gets enforced, it sure is going to irk some programmers.

August 12th, 2008 at 2:42 am
Hey! I just found this blog and it’s great reading. I will definitely check back regularly!