12:01 AM
[Minesweeper] New Users: 21, Games Played: 87, Bombs Used: 52, Moves Performed: 11676

2 hours later…
2:16 AM
@M.Doerner ha nice! I'm not very familiar with the Observer pattern but it makes total sense, here's to "patterns naturally emerge"! ...I'll sneak it in along with the missing annotations, thanks!

5 hours later…
7:08 AM
Nobody really uses the observer patter explicitly anymore because it has been baked into languages via events.

4 hours later…
10:48 AM

11:29 AM
Interesting question:
31

I’m still really new to learning to program. Just learning the syntax for a few programming languages at the moment. The courses I viewed for C# and Java touched only very briefly on getters & setters and it still didn’t make an awful lot of sense to me. So I researched them further and found tha...

If I understand correctly, those who argue against getters/setters would say that instead of:
Private FirstName as string
Public Property Get FirstName() as String
FirstName = FirstName 'yeah, I know, work with the pseudo code
End Property
Public Property Set FirstName (byVal theName as string)
FirstName = theName
End Property
One would use something like:
Private FirstName as string
Public Function GetFirstName() as string
GetFirstName = FirstName
End Function
Public Function AssignFirstName (byVal theName as string)
FirstName = theName
End Function
So effectively they're exactly the same thing the only difference is minor syntax. Is there something else I'm missing?
The 2nd example is just a Property Get and Property Set, but I have to come up with clever names that aren't Get and Set.

12:05 PM
@FreeMan the difference is that Property Get is a language feature that not every language has
and Function is something that every OOP language should have

12:59 PM
that is a side note to the question the OP asked, though. His question was in reference to Java and C#, so both of them have get/set.
Given a language that has get/set, though, is there any functional difference or is it merely semantics? If semantics, is there a real, tangible, significant difference, or has he just ID'd another holy war topic?

@FreeMan no, java doesn't

To me, the semantics is the whole point. In a language without properties, you have to rely on a convention and there's no guarantee that the convention is followed everywhere.
e.g. one API might have getFoo and setFoo while other API would have readFoo and writeFoo. That makes you wonder if there's a difference when in fact there may be none.
OTOH, in a language with properties, there's no double-guessing what foo should do.
I recall reading somewhere else that if there's side-effects, you should use function, otherwise use properties. However, in most (all?) properties-capable languages, there is no guarantee that a property isn't side-effecting, so that's yet another convention.

quack

the whole idea of setters and getters is to abstract away possible sideeffects
avoiding sideeffects in such areas makes no sense, because sideeffects are object-internal implementation detail
and as such they shouldn't be part of the API
Foo Foo
{
get;
set
{
Foo = value;
NotifyPropertyChanged(nameof(Foo));
}
}
it makes no sense to require the calling code to do the property-change notification, because properties shouldn't encapsulate sideeffects
and the same applies for getters and setters
consider something like the following:
class QName
{
private string namespace;
private string localName;

public String QName {
get { return $"\{{namespace}\}{localName}"; } set { /* parse value and store in separate fields */ } } // omitting implementations to acccess backing fields here public String Namespace { get; set; } public String LocalName { get; set; } } 1:31 PM I see what you mean, but doesn't that break the encapsulation because qName.LocalName = "\foo\bar";? In my mind, a good API should have only one way to do something. @this hmm ... it's not strictly necessary to expose the setter for QName Yeah, that'd make more sense. on the other hand having that setter allows you to easily handle receiving a QName and disassembling it But I take your point that a property can have a side-effects. I was thinking about designs like this: class Bad { public string UserName { get; set; } public string Password { set; } public void Login(); } class Better { public string UserName { get; } public void Login(string username, string password); } @this I wouldn't judge it that way... it just seems like these are different usecases one is "Credentials" and one is "AuthenticationService" I would rermove the Login from Bad, though 1:37 PM My issue lies with the fact that the former requires temporal coupling whereas latter has a more intuitive API. Right, the Bad san Login() would be fine as a credential object. but let's say it's a Credential.... class CredentialA { public string UserName { get; set; } public string Password { set; } } class CredentialB { public string UserName { get; set; } public void SetPassword(string password); } I think Resharper will ding the former one for having a setter-only property. 2:07 PM So, from the "poor, simple-minded man" perspective, there's really no difference at all if the language supports both. 2:17 PM No, not really. But when you think about it, that's kind of a vacuous statement. Remember, at the end of day, it's just a some memory address that flips some bits around. all fancypants like private access modifier, const statement, class block and whathaveyou are ultimately handled by the compiler. It's for our benefits, not so much for the CPU's benefits. 3:02 PM @FreeMan until you implement MVVM in VBA; then your ViewModel classes' Property Let procedures need to invoke OnPropertyChanged to notify the bindings - public fields are not strictly equivalent; properties are useful when there's additional logic needed beyond "assign the backing field value" Same in C#: a WPF ViewModel that doesn't notify on property change won't work as intended ;-) 3:23 PM @MathieuGuindon it's not a difference between Public fields and Property Let/Get, it's the difference between Public Property Get PrivateValue and Public Function readPrivateValue. Or, I don't understand what you're saying which is equally more likely 4:01 PM @FreeMan Why Function AssignFirstName be a function? It's not returning a value and AIUI should be a Sub @FreeMan you have a BloatedUglyWalrus with 100 "properties". One of them is height. You are not sure if it's a property on the class. Want to hunt through get*** and set*** in the object browser? @this No, but what's the difference between myBloatedUglyWalrus.Height = 30 and myBloatedUglyWalrus.setHeight 30 in terms of functionality? That, I think, is what the questioner was asking. In either case, I need to hunt through 100+ properties/methods looking for the proper way to assign the height of my BloatedUglyWalrus... A sequenceequals test using two variant arrays fails when the arrays are the same but one member is vbnullstring. Should I report this as a bug? @IvenBach hush you! #pseudocodefail 4:14 PM @Freeflow looks like a bug, which Assert implementation are you using? the strict one or the permissive one? 4:34 PM @Vogel612 I'd forgotten there were two. Does this help 'Set Assert = CreateObject("Rubberduck.AssertClass")' yup, you're using the stricter one could you check whether the behavior persists with CreateObject("Rubberduck.PermissiveAssertClass")? I'm afraid the permissive version also fails. @Freeflow what is the corresponding member set to ? if Null or something like that, then Null = vbNullString ought to fail, permissive or not it might be also Missing the debugger window of the screenshot shows they should be equal ... @Freeflow could you assert against Array("Hello", "ThereWorld", "")? Check the debugger windows, Luke.... 2 4:39 PM Using "" for both assert classes gives a pass. so ... umm ... use the farce, @this 2 My immediate problem is sorted. Hmm, the VBA MVVM framework has got me wondering whether RxVBA would be possible... reactivex.io have to use objects instead of delegates ofc, but still... how do we find out whether the third element was a vbNullString or "" now? 4:42 PM well, vbNullString is a null pointer. "" would be a zero-length BSTR (e.g. an initialized pointer) yea, the question is whether the assert was wrong in the first place or whether we actually have an issue with comparing vbNullString to confirm, this is a matter of having both sides using "" or vbNullString but not mixing the two, right? I'd say permissive assert should compare "" as equal to vbNullString yes, it should and strict assert should not 4:44 PM strict, using C#'s rule what you said hmm that's weird I thought I updated the permissive long time ago to use variant comparsion instead of C#'s comparison. History says otherwise. Sorry, a further input. The code that generates myResultHBT assigns vbnullstring to the array and not "" which is why myExpectedHbt was using vbnullstring in the first place. the permissive ought to be use VarCmp I'm confused now. so originally, it was comparing vbNullString to vbNullString and failing, but it passes when you compare vbNullString to "" ? and is this limited to the array, or do we get the same behavior when comparing the 2 directly using AssertAreEqual? This is the internal code  ublic Function HelperGetHBT _ ( _ Optional ByVal ipStart As Long = 1, _ Optional ByVal ipRun As Long = 0, _ Optional ByVal ipEnd As Long = 0 _ ) As Variant Dim myHBT As Variant myHBT = Array(vbNullString, vbNullString, vbNullString) Dim myStartRun As StartRun Set myStartRun = HelperGetPositiveStartRunFromAnyStartRunEnd(ipStart, ipRun, ipEnd) 'Determine head If myStartRun.Start = 1 Then myHBT(0) = vbNullString Else myHBT(0) = VBA.Mid$(p.Value, 1, myStartRun.Start - 1)

End If

'Determine Body

wow... Just ran across a 6-year-old answer from @Comintern on diy.se. I pinged him there, told him he's missed. I hope he comes back. I hope he's still with us...

5:13 PM
@FreeMan my working assumption is that he's back under nda. just a hunch though.

Seems more like a Do Not Contact contract.
We pay you heaps of \$ but you shall not communicate with anyone while under our contract.

@mansellan Yeah, but it's been more than a year, hasn't it? (It seems that way...)
His last "disappearance" was less than a year, if I recall.

I think you need a pair of ruby red slippers and click three times and say his name 3 times and he'll appear.

5:28 PM
I'll see if we still have my daughter's...
Beetlejuice`, Beetlejuice, Beetlejuice!
...
Nope. :(

I'm trying to remember... did Rumplestiltskin have 3 times and appear thing?
My mind says no, it's just a guess my name thing
Forgot about Beetlejuice. Indeed he did have that 3 times and appear thing.

Don't recall. Don't feel like DDGing