How do you organize your Utility functions?

I am programming in ASP.NET environment and Im thinking about dividing my utility functions into 3 classes - Presentation.cs, Business.cs, Data.cs. What do you think? How do you organize your office functions?

+2


source to share


3 answers


I organize my utility functions based on the type of data they process. I also give the class and filename the Util suffix to distinguish it as a generic utility class. For example,



  • PresentationUtil.cs
  • EnumUtil.cs
  • LambdaUtil.cs
+3


source


It depends on what they are doing. In many ways, I group my utility functions into classes based on what they work. I tend to ignore the guidelines that specify the minimum number of methods for each class; if it makes sense for a method to belong to a class because it works with a specific data type, then it goes into the class, the number of methods must be damned.



However, utilities are usually the main candidates for extension methods these days. So the factors are quite common.

+2


source


Usually my class composition is determined by looking at the type of data being used or the relationships between methods that I have to organize.

Then I wrap up my utility classes in the .Utilities namespace and physically split them into a folder with the same name.

This usually means that whatever is contained is used for service purposes.

0


source







All Articles