I currently have a VB.NET class named “Customers” and it’s been steadily growing in size and I now have a couple dozen functions in it. Is there a way of maintaining the functions in the same class? Since they still use common private methods, but group them by similarity.
For example:
Class Customers
-GetData
---GetCustomerObject()
---GetCustomerFieldx()
-Lists
---GetSomeList()
---GetAnotherList()
-Maintenance
---AddCustomer()
---DeleteCustomer()
---UpdateCustomer()
UPDATE: I guess I wasn’t clear on where I wanted this grouping to occur. I want the groupings to be almost like namespaces/classes in IntelliSense when I use my Customer class. I currently use Regions but they only help when seeing the code, not when using the class.
I’d not recommend regions to group content in your files on a general basis.
If your file grows to such a size that you feel you need to group things to regain control then that is a hint you should try to refactor the class into several classes each responsible for a subset of what the original class did, so that you do not end up with the untestable mess that is the God object