Best Practice: Utility Class or not

P

panik

Hi,

I'm busy building a small windows application, and as I'm fairly new to OOP
programming (have worked about 2 years with C# now), I would like some
advice.

I have two windows forms that share a few sets of functionality. I'll
explain:
Form A has a list of Clients. Each Client has a list of Projects as children
(displayed in a TreeView). This form has a few functionalities for the
Clients like: NewClient and DeleteClient.
Form B has also a list of Clients. Each Client has a list Databases as
children (displayed in a TreeView). Here too, the form makes it possible to
add a Client, or remove one.

I was wondering how I can have both forms share the same functionality.

Right now I created a Utility Class, called Handling, that has a few Methods
(NewClient, DeleteClient) so in my Mouse or KeyDown EventHandlers of *both*
forms, I can call Handling.NewClient();

Is this a correct way of doing it? Or should I better instantiate a Client
Class? I wanted to avoid to create a new object, as the only thing that
happens when adding a Client is adding a record to a database and a node to
the TreeView.

Thank you for the advice.
Vincent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top