In VB6 what is the difference between Property Set and Property Let?
Property Set is for objects (e.g., class instances) Property Let is for “normal” datatypes (e.g., string, boolean, long, etc.)
Property Set is for objects (e.g., class instances) Property Let is for “normal” datatypes (e.g., string, boolean, long, etc.)
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 …
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 …
Polymorphism (in the context of object-oriented programming) means a subclass can override a method of the base class. This means a method of a class can do different things in subclasses. For example: a class Animal can have a method talk() and the subclasses Dog and Cat of Animal can let the method talk() make …
The Bridge Pattern makes a distinction between an abstraction and an implementation in such a way that the two can vary independently. I will use the example from Patterns in Java, Volume 1: A Catalog of Reusable Design Patterns Illustrated with UML, Second Edition You need to provide classes that access physical sensors such as …
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 …
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 …
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 …
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 …
I like Glass’ rules of 3 when it comes to Reuse (which seems to be what you’re interested in). 1) It is 3 times as difficult to build reusable components as single use components 2) A reusable component should be tried out in three different applications before it will be sufficiently general to accept into …