A precursor to my logic with this topic:
- I mainly work with Windows Forms applications
- I use modules to host commonly used methods throughout my application
- I always leave everything collapsed in every file and only expand what I’m working on or things I need to review
#2 Gives me a sort of MVVM style code pattern. I have a module called modHandling. This one module has 6,936 lines including white spaces. I used regions in this module to segregate certain methods by what part of the application they are for.
Between lines 2,098 and 6,936 I’ve used 11 regions. I didn’t always have regions here, but I’m so glad I added them, because now when I go to look for the method that creates columns for a certain gridview, I just scroll down the file until I see the region hosting it. Then I expand that region, and scroll down to the specific method for the particular GridView I’m working on, and then expand that.
Sure, I could CTRL+F and search “Sub CreatePRColumns” (because I remember the names to all these methods by heart), but that literally doesn’t feel right to me. From what I’ve discovered, there is no way you can get that same segregation with my particular situation without using regions and still make it easy to navigate visually.
All in all, programming ultimately comes down to two things: Skill and Efficiency. If regions make a programmer more efficient (such as myself), use them. If not, don’t. Easy as that.