Sorry for the long title. Here is a sample situation that I encounter often with windows forms applications. Much of the code in my application is centred around the UI so it so happens that most of my code is in the main class (MainWindow). Here is an analogy of how I am planning to break up my code. I will have to write a compressed file to the disk when the user performs an action. So it would look like this. Is this a good practice. This is just an attempt to organize my code better.
Public class MainForm
Private Sub TempButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TempButton.Click
Compression.CompressFile(fileStream)
End Sub
End Class
Public Class Compression
Private Sub New
'Private constructor
End Sub
Public Shared Sub CompressFile(ByVal inFile as stream)
End Sub
Public Shared Sub DeCompressFile(ByVal inFile as stream)
End Sub
End Class
That is a common pattern.
However, such functions should go in a
Module(orstatic classin C#).