mercredi 9 mars 2016

C#/.net Reuse code chunks

In my project, there are a lot of code chunks that a reused under different conditions. These chunks are just a few lines of code. The calls of these chunks are spread all over the program and some of theme depend ob which mode the program is running.

I now want to provide this code in a easy to access way with a good performance. I've two attempts in mind.

a) Create a static class with functions, each containing one chunk of code. b) Creating several small classes (components) each with an execute method holding one chunk of code.

I'm not sure which is a clean way to handle that situation or if there is any best practice approach. If you need more information, just let me know.

Aucun commentaire:

Enregistrer un commentaire