I've been thinking lately about certain services like logging and how to implement them. As I've heard, the classic choices are ones mentioned in the title. I'd like to get your opinions on the pros and cons of the two. Or if you have yet another solution that's even better, let's hear it. For the worse solutions on the other hand, I think there's simply too many ways to do things badly so let's not get into that :).
My take:
- Constructor arguments
- Pros: the class is more reusable. I think it's more scalable
- Cons: if the amount of shared things increase, the amount of constructor arguments can also increase leading to a mess.
- Pros: the class is more reusable. I think it's more scalable
- Singleton
- Pros: The code's probably cleaner all around (not sure).
- Cons: less reusable and scaling upwards can indeed cause more work a lot of the code base is already implemented with singletons, I'm guessing.
- Pros: The code's probably cleaner all around (not sure).
I appreciate all participation and in particular, the views different from mine.


Sign In
Create Account


Back to top









