Should every single object have an interface and all objects loosely coupled?

It’s useful for objects which really provide a service – authentication, storage etc. For simple types which don’t have any further dependencies, and where there are never going to be any alternative implementations, I think it’s okay to use the concrete types. If you go overboard with this kind of thing, you end up spending …

Read more

What we should use instead of a “manager” class in a good OOP design?

You almost said it already: This class gets several responsibilities (original emphasis). This violates the Single Responsibility Principle. Additionally, the word Manager suggest an object that manages other objects, which is at odds with the object-oriented principle that objects should encapsulate both data and behavior. This quickly leads to the Feature Envy code smell. Dividing …

Read more

How do you define a Single Responsibility?

The Single Responsibility Principle There are many obvious cases, e.g. CoffeeAndSoupFactory. Coffee and soup in the same appliance can lead to quite distasteful results. In this example, the appliance might be broken into a HotWaterGenerator and some kind of Stirrer. Then a new CoffeeFactory and SoupFactory can be built from those components and any accidental …

Read more

Difference between OOP basics vs SOLID? [closed]

the answer is simple: languages or concepts which don’t support Encapsulation, Abstraction, Inheritance and Poly are not object oriented. If you do something object oriented you can always apply these OO basics, because they are available. One doesn’t call such things principles. SOLID in return is optional. When developing an OO design you should strive …

Read more

When to use a Class in VBA?

It depends on who’s going to develop and maintain the code. Typical “Power User” macro writers hacking small ad-hoc apps may well be confused by using classes. But for serious development, the reasons to use classes are the same as in other languages. You have the same restrictions as VB6 – no inheritance – but …

Read more

When do you write a private method, versus protected? [closed]

public and protected methods form the ‘interface’ to your object, public for developers using (delegating to) your class, and protected for developers wishing to extend the functionality of your object by subclassing it. Note that it’s not necessary to provide protected methods, even if your class will be subclassed. Both public and protected interfaces need …

Read more