When I create an application, I usually create a static class that contains static methods and properties that I cannot figure out where to put elsewhere.
This is not a very good design, but this is what: it gives me a place to localize a whole class of design decisions that I have not yet thought through. As a rule, when an application grows and is refined through refactoring, it becomes clearer where these methods and properties should really be located. Fortunately, the state of the refactoring tools is such that these changes are usually not exclusively painful.
I tried to do it differently, but the other way basically implements the object model before I know enough about my application for the proper development of the object model. If I do this, I will spend a lot of time and energy coming up with a mediocre solution that I must reconsider and rebuild from scratch at some point in the future. Well, well, if I know that I will refactor this code, how about skipping the design phase and creating unnecessary complex classes that actually don't work?
For example, I created an application that is used by several clients. I realized quite early that I needed to have a way to separate methods that should work differently for different clients. I built a static utility method that I could call at any time in the program where I needed to call a custom method, and got stuck in my static class.
This worked perfectly for several months. But there came a time when he was just starting to look ugly. And so I decided to reorganize it into my class. And when I looked through my code, looking at all the places where this method was called, it became completely clear that all the configured methods really should be members of an abstract class, client assemblies should contain one derived class that implements all abstract methods, and then the program is simply necessary to get the assembly name and namespace outside its configuration and instantiate the custom function class at startup. It was very easy for me to find all the methods that needed to be configured, since all I had to do was find all the places that my load-a-custom-feature method called. It took me most of the day to go through the entire code base and streamline this project, and the end result is really flexible and reliable and solves the right problem.
The fact is that when I first applied this method (in fact, it was three or four interconnected methods), I realized that this is not the right answer. But I did not know enough to decide which was the correct answer. So I went with the simplest wrong answer until I got the right answer.
Robert rossney
source share