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 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
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
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 … Read more
The disconnect you see is not of FP vs. OOP. It’s mostly about immutability and mathematical formalisms vs. mutability and informal approaches. First, let’s dispense with the mutability issue: you can have FP with mutability and OOP with immutability just fine. Even more-functional-than-thou Haskell lets you play with mutable data all you want, you just … Read more
Use an interface if you want to define a contract. I.e. X must take Y and return Z. It doesn’t care how the code is doing that. A class can implement multiple interfaces. Use an abstract class if you want to define default behaviour in non-abstract methods so that the endusers can reuse it without … Read more
A property is one kind of member. Others might be constructors, methods, fields, nested types, conversions, indexers etc – depending on the language/platform, of course. A lot of the time the exact meaning of terminology depends on the context. To give a C#-specific definition, from the C# 3.0 spec, section 1.6.1: The following table provides … Read more
For me, this 1996 Quote from Uncle Bob (Robert C Martin) summarises the LSP best: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it. In recent times, as an alternative to inheritance abstractions based on sub-classing from a (usually abstract) base/super class, we … Read more
You could have MovablePatch(Renderer* renderer, CircleAppearance circleAppearance) where CircleAppearance gathers the other info. However, clean code and other books that generalize about what good code should look like, are aiming for 80 percent of the code out there. Your code seems to be “closer to the metal” than the typical LoB (Line of Business) variety. … Read more
You can subclass the concrete implementation, so this works: class Path(type(pathlib.Path())): Here’s what I did with this: import pathlib class Path(type(pathlib.Path())): def open(self, mode=”r”, buffering=-1, encoding=None, errors=None, newline=None): if encoding is None and ‘b’ not in mode: encoding = ‘utf-8’ return super().open(mode, buffering, encoding, errors, newline) Path(‘/tmp/a.txt’).write_text(“я”)