142 reputation
4
bio website
location
age
visits member for 2 years
seen Jun 25 at 23:29

Dec
13
awarded  Critic
Mar
19
comment What skills should I cultivate to become a development/technical lead?
+1 for highlighting that 'lead' roles often involve much more management than technical skills
Jan
24
awarded  Scholar
Jan
24
accepted event listener pattern in api - what should adding the same listener twice do?
Jan
3
comment event listener pattern in api - what should adding the same listener twice do?
I was referring to it specifically in the context of the listener pattern
Jan
2
comment event listener pattern in api - what should adding the same listener twice do?
My main strategy so far has been to 'use a similar pattern to the surrounding environment' - ie: the most common pattern used in the rest of the code/language I'm integrating with. The 'crash early' strategy would definitely catch a lot of potential issues, but I've never actually seen this used in practice, so it might be surprising to an API user (though the more I think about it, I'd consider it a 'good' surprise since it would help catch bugs)
Jan
2
comment event listener pattern in api - what should adding the same listener twice do?
There's not necessarily an issue where there are problems with adds/removes (as the question should apply to any program, not just the one I'm working on), though I definitely see how this pattern would specifically make it clear that the API is using option #2 (or a slight variation of it, where removal is by id instead of by listener)
Jan
2
comment event listener pattern in api - what should adding the same listener twice do?
@DocBrown - in the specific case that is the reason I asked the question, we don't have much option to change. I know it's not a huge deal to use one option or the other, so the question is more of a conceptual one - are there any reasons based on architecture/design/reliability (ie: besides user preferences) to choose one pattern over the other?
Jan
2
comment event listener pattern in api - what should adding the same listener twice do?
The implementations of case #1 that I'm familiar with generally go by reference - if foo == bar, then it would overwrite, otherwise, it would have one foo and one bar as listeners. If it always overwrote, it wouldn't be a set, but a single object that represented an observer.
Jan
2
awarded  Student
Jan
2
asked event listener pattern in api - what should adding the same listener twice do?
Nov
13
awarded  Supporter