« first day (3757 days earlier)      last day (1174 days later) » 
01:00 - 21:0021:00 - 00:00

mr5
1:04 AM
@Squirrelkiller it's CentOS Stream now
 
 
5 hours later…
6:33 AM
Buenos dias
 
 
2 hours later…
8:22 AM
[kesarling] People, I am trying to use the GoogleApi (github.com/vivet/GoogleApi) as suggested in the answer here (stackoverflow.com/a/61531795/11930602) but I am not able to follow the answer, as almost no docs are available on the API. Can anyone help me get started?
 
8:35 AM
Is it good or bad practice to have return types as classes in interfaces? Or should it mostly be generics?
 
should mostly be interfaces
but in some cases, it is just a pain to create an interface for some types
so, interfaces and generics, depending on the use case, and classes depending on the lazyness
 
What do you mean? Interfaces method's should return interfaces?
 
exactly that
interface IHelper {
    IAnswer Ask(IQuestion question);
}
 
Oh i see
So if i got this correct
the third one is the best?
@Wietlol
 
not necessarily
the second however is definitely the worst
and should be replaced by the third
the second just exists because of lazyness
 
8:44 AM
True
 
the first however sometimes is more appropriate than then third
that depends on what you are doing
for example, consider the interface "Provider"
 
I have managed to get into situations where if i use the first one, i keep passing in so many generics. So then i guess the third one is better?
 
interface IProvider {
    ? Get();
}
what should the return type be?
 
no idea
 
thats because you sometimes want a provider of strings
and sometimes a provider of lists
or a provider of numbers
the type is... "generic"
hence why we use a generic type
interface IProvider<T>
but for example, the helper, where we can ask a question and (hopefully) get an answer back, there it is very easy to determine what we can give them and what we can get back
you can give it a question and you can expect an answer back
you cant just give it an integer or a list
nor a string
none of those are questions
 
mr5
8:52 AM
@Zacharias maybe if you get to that point, it's time to make specialization of that interface and update the other dependencies.
 
@mr5 How? Breaking out code to smaller interface?
that handles less
 
that could work
notice the size of my example interfaces?
 
yes
 
that is approximately the size of my production code interfaces
(ignoring overloads)
 
So i guess you have a hellova lot of interfaces?
 
8:54 AM
yep
but actually no
 
Let's say with a realistic scenario of a interface for fetching orders etc
would this be any way correct way?
 
mr5
@Zacharias no I mean, if you often find yourself writing IProvider<ConcreteType>, maybe it's type to specialized it like ConcreteTypeProvider : IProvider<ConcreteType>
 
looks like a regular repository interface
 
yeah
 
although, this one in particular has 2 types
orders and invoices
 
9:00 AM
It should be split in two interfaces?
 
I would...
 
gotcha
 
mr5
As a mobile dev, whenever I deal with IO/CPU-bound operations, I always wrap it in Task
 
also, ye, most (if not all) of the repository actions should return a Task<X>
because you expect IO to happen
although, that might change depending on which technology you use
for example, in Java, I see no reason to use Task... (or the equivalent of it)
 
mr5
Yeah, if it happens that UI thread is not the default thread, then you're good.
 
9:04 AM
still unrelated to if it is a UI thread or not tho
 
mr5
@Wietlol in Android, you must or OS will forcefully crash your app.
 
android development sucks tho
:)
still, if you make a web service with asp.net, then you also have to think of concurrency
and to not block your threads
or your service will block up if it used more
but I dont have that problem either because I use AWS Lambda, so every concurrent call just goes to a different container running the same code
@mr5 still think Lambda sucks? :p
 
mr5
yeah that startup time is meh
 
@mr5 do you remember when Wietbot was fast?
 
mr5
did that happen?
ah yeah
that spammer
 
9:09 AM
not that
just normal behavior
it responded in like... sub-second
you can solve the startup time
 
mr5
it's normal for web apis though
 
but depending on what you use, you might not even have to
 
mr5
some google apis I used responded averaging 70ms
 
if you have a single layer of services (which your public facing services should have), then cold starts should even be around 100ms
if you use something like thundra for example, you could even just keep your containers running
which results in rarely having cold starts at all
although, I got lost in the configuration of thundra, so I just built my own :D
which was sufficient for my use case
 
If Lambda's are slow, it simply means you're using database connections and whatnot that take time to setup. Don't do that, or use AWS databases since there is no real overhead establishing connections from a Lambda.
 
9:15 AM
Yes i will make it all Tasks, its asp.net web app indeed. Thanks for the help!
 
[kesarling] umm guys, this public DbSet<IAsset> Assets { get; set; } is not allowed, is it?
[kesarling] Interface as a template?
 
@Hozuki is there not? I thought connecting to an RDS was quite a pain for the performance
hence why RDS Proxy was created
 
@Wietlol If you connect to a managed AWS SQL or NoSQL using their packages, performance is superb. It's quite possible they use that RDS Proxy you speak of underneath, but I don't see that as a developer.
 
hmm... I do indeed just use a general sql library, might be interesting to see what happens if I use the AWSSDK.RDS ... or whatever it is called
 
mr5
AAWWSSDDKK.RRDDSS
 
9:21 AM
RDS Proxy is a separate service though, code wouldnt just create it
it is basically an intermediate layer between your applications and the database to handle connection pooling
 
I'm not sure how it works, just that it does ^_^
Perhaps it uses some kind of shared connection pooling managed by AWS
FWIW using something that has a HTTP API, like CouchDB, also gives splendid performance in lambdas
 
\[**[mr5](https://discord.gg/PNMq3pBSUe)**] 🚑❗⚠ Important News everyone! ⚠️❗🚑
Chrome removes the path query displayed on search bar.
[mr5] UX team is probably thinking what could they display in this part.
 
9:54 AM
[Hozuki Ferrari] That's bloody stupid.
[Hozuki Ferrari] Safari does that too, and it's infuriating
 
since when will chrome have that?
 
mr5
10:37 AM
already have
on the most recent update
stable release
is "most recent" redundant?
 
11:04 AM
"most recent" is subject to change though
also, it is ambiguous
 
11:20 AM
most recent == latest; not ambiguous
recent is a direction in time: more recent, less recent
 
but... my chrome says it is the latest, but I doubt it is the same latest
on the other hand, my beta chrome says I need to update really soon
 
same as what?
 
gradual deployment
you might have received an update that I dont have yet
 
You doubt your chrome's "Latest" version is the same as gradual development?
 
so while I think I am on the latest, a new version might have been deployed
 
11:25 AM
Ah I see
Well then it's the latest version available to you
 
12:23 PM
I cannot install wget on FreeBSD for ppc :')
everything sucks
 
> everything sucks
hey! that's my line!
 
the pony says: yay
 
 
1 hour later…
1:45 PM
@mr5 Is this how you enable your web app to login with Google, login with Apple, etc.?
@mr5 I've used IdentityServer4 for an API, but I did that using Visual Studio. Using VS Code to create an app IdentityServer4 that uses IdentityServer4 may be slightly different.
 
2:18 PM
Correction: @mr5 I've used IdentityServer4 for an API, but I did that using Visual Studio. Using VS Code to create an app that uses IdentityServer4 may be slightly different.
 
2:35 PM
I think my client has a fetish for keeping me out of the loop
 
mr5
2:58 PM
@BlackPanther yes. We've used that library from my previous employer several times already but I'm on the client side. Now I'm learning how to implement in on the server side :)
 
@mr5 Can you clarify this:
> We've used that library from my previous employer several times already but I'm on the client side
@mr5 That's great. Are you implementing it in an ASP.NET Core MVC web app?
 
mr5
As a client who consumes the service. We get tokens from third parties (Google, Facebook, Apple), forward it to server to identify the clients because tokens includes name,<id>,<email>, and that's sometimes enough to make a "registration"
ASP.NET Core but I think it doesn't matter whether it's on web app or web apis since it's going to get implemented as a server but web app being the client also.
So far, I'm on this ERR_SSL_PROTOCOL_ERROR
although I've already grant my localhost as a trusted CA
 
@mr5 you could also use... AWS Cognito :)
 
3:14 PM
@mr5 Is the service the OAuth provider?
@mr5 I didn't know a JSON web token includes <id> and <email>
 
mr5
@Wietlol looking at their example, it looks like it's a client library.
 
@mr5 Is the process for doing this the same for a production app?
 
mr5
@BlackPanther yeah, I could make an oauth provider using IS4
 
@mr5 I mean the service you refer to here:
> As a client who consumes the service
 
mr5
@BlackPanther I think so
 
3:17 PM
@mr5 Cognito is a full authentication service
full OAuth2 handling of user logins, client application authentications, identity provider support, etc
everything you need without the pain of implementing it
 
mr5
It's the IIS that doesn't cooperate with me
@BlackPanther ah no. Clients are not oauth providers.
 
ah IIS
 
@Wietlol I wanted to ask you about this example you created paste.ofcode.org/PBeJkP7W5wfCEJa84TMxfa. you can do the same thing without using an interface, so what is the advantage of using the interface IAbbreviationResolver instead of just hard coding different implementations of the Resolve method in the classes AbbreviationsDotCom and GoogleAbbreviationResolver, e.g. doing this paste.ofcode.org/sswkT8hpYqESniHdw6tZjn
 
because now, in your code, you can use an IAbbreviationResolver without knowing which implementation it is
 
mr5
@Wietlol I can't find AWS Cognito docs on how to implement it on ASP though
 
3:25 PM
because ASP sucks :D
 
mr5
@BlackPanther yeah, it can include those thing. But the only reliable data there is the name of the user. Ids and email are sometimes not provided.
For the Apple thing, they have a good approach on how to always provide user email but not necessarily the true email.
I wish the ietf would adapt it in their standards.
or whoever is in charge for doing it
 
@Wietlol Maybe it's because I went to sleep really really late, but I don't get this explanation. Can you clarify what you mean?
 
mr5
@BlackPanther you can "switch"
Say, abbreviations.com is down, then you can easily fallback in Google
 
when you have another class that wants to use it, how would you make that?
 
@mr5 you go to sleep really late. How do you stay sharp?
 
mr5
3:31 PM
By easy, there's not so much code to change. Only the registration to replace that one on the DI container.
I C sharp :D
 
> Allocation failed. We do not have sufficient capacity for the requested VM size in this region
Seriously azure!?
 
mr5
@BlackPanther nah, I actually have a good sleep schedule this week as compared from previous months and I actually find myself better speaking now irl
it only took me few good sleeps to get back to normal again.
@Squirrelkiller kek. busy region
 
@Squirrelkiller wat?
did Azure just tell you "our data centers are too smol"?
 
They absolutely did
For one damn VM
 
3:35 PM
@Wietlol You have to instantiate either AbbreviationsDotCom or GoogleAbbreviationResolver, which instantiates two different implementations of IAbbreviationResolver (i.e. instantiates the concrete classes that implement IAbbreviationResolver). To then use IAbbreviationResolver you have to do IAbbreviationResolver x = ....?
 
mr5
if user.contains('squirrel')
    throw new RandomErrorException()
 
@BlackPanther but who instantiates the instance?
 
@mr5 I've never seen this in practice. Don't you need a conditional statement to do this switch?
 
mr5
@BlackPanther yep. It's preferred that way because it requires less effort and it's testable.
As for an example, you may look at Botler's source code.
 
@Wietlol The type consumer instantiates the instance of AbbreviationsDotCom or GoogleAbbreviationResolver, i.e. the code that calls new AbbreviationsDotCom or new GoogleAbbreviationResolver. Is this right?
 
3:39 PM
indeed
and everyone else doesnt need to know which of the two it is
 
mr5
It has two caching service. Firebase is down so it currently uses MonkeyCache but the "switch" is on build time, but you get the idea.
 
they only need to ask for an IAbbreviationResolver
this is the preferred way of doing a waterfall flow
 
@mr5 Yeah, that improved the communication part of your skills you talked about improving.
 
mr5
As in my GF notices it too :D
I can elaborate slightly better than few months ago.
What more if I develop good sleep habbit
I wish I have the discipline of Roel
Or other regulars here
 
heh... "discipline" :)
 
mr5
3:42 PM
Wietlol also sleeps late
I can see him awake at 4am lol
lurking in AWS as his social media =P
@Wietlol I've seen some DI that you can provide the service a name. In case of more than one implementation have been registered but with different names, how do you think it gets resolved?
 
I assume it gets resolved like trash
 
mr5
Maybe by providing attributes in the parameter?
lol
 
same as assuming that the constructor invoke is correct
I also assume that is trash
so, I always use .AddX<IService>(provider => new MyService())
when there are multiple implementations, it chooses... either the first or the last
but you can then do .GetRequiredService<IEnumerable<IService>>() and you get all of them...
iirc
still trash though
 
mr5
it maybe useful for resiliency where services can be offered from other regions as well.
 
Yeah we have like 15 implementations of an interface, and we just inject them as IEnumerable<IService> in the constructor
And then basically go services.First(s => s.CanDo(input)).Do(input)
 
3:50 PM
@Wietlol You mean, any other code outside the type consumer that executes IAbbreviationResolver x = new AbbreviationsDotCom or IAbbreviationResolver x = GoogleAbbreviationResolver doesn't need to know whether IAbbreviationResolver is AbbreviationsDotCom or GoogleAbbreviationResolver?
 
yep
 
@Wietlol But if they ask for an IAbbreviationResolver then they would not be able to use any methods from AbbreviationsDotCom or GoogleAbbreviationResolver?
 
yep
this is an example
^ that is the AbbreviationResolver interface
the first link is where it is used
private val abbreviationResolver: AbbreviationResolver = get()
this just says "give me whatever AbbreviationResolver I am supposed to use"
and then it goes: val (definitions, suggestions) = abbreviationResolver.findDefinitions(abbreviation)
ez-pz
but no one knows if it is the one from abbreviations.com or from google.com
or both?
and in what order?
or perhaps another service that provides it
that is the job of the dependency container
 
@Wietlol And is not knowing whether IAbbreviationResolver is AbbreviationsDotCom or GoogleAbbreviationResolver useful because you can cast from either IAbbreviationResolver to AbbreviationsDotCom or from IAbbreviationResolver to GoogleAbbreviationResolver?
@Wietlol In other words, is not knowing whether IAbbreviationResolver is AbbreviationsDotCom or GoogleAbbreviationResolver useful because you can cast from IAbbreviationResolver to whatever implementation of IAbbreviationResolver you need?
 
where I could just simply say single<AbbreviationResolver > { AbbreviationsHtmlScraper() } but I put it in a separate function for SLA reasons
@BlackPanther nope
it is useful because you dont care who provides you the definitions, you just care that the abbreviation is resolved
so, you need to ask a resolver to do it, but you dont care who it does, to care who does it is someone else's job
also, when you change, you dont have to change all the code, only the part where you decide which one to use
 
4:02 PM
@Wietlol Thanks but those Kotlin code makes understanding the significance of not knowing whether IAbbreviationResolver is AbbreviationsDotCom or GoogleAbbreviationResolver difficult.
 
why?
 
I have never seen Kotlin code until now and:
35 mins ago, by Black Panther
@Wietlol Maybe it's because I went to sleep really really late, but I don't get this explanation. Can you clarify what you mean?
 
mr5
you just need coffee dude
source: dude trust me
 
@Wietlol which classes implement AbbreviationResolver in that Kotlin code?
 
in that code? none so far we care
that one
 
mr5
4:10 PM
think of an interfaces like a "contract"
you hand them out jobs to do
if they don't perform well
you terminate the contract
and choose another implementors
 
it is a html scraper, it will just pretend it is a very simple browser and just read the html
 
mr5
two months of not doing Kotlin now it looks alien to me.
 
@Wietlol So when you call the method val (definitions, suggestions) = abbreviationResolver.findDefinitions(abbreviation) what happens? As far as I can see AbbreviationResolver doesn't have a default implementation for findDefinitions.
 
it doesnt
and it shouldnt
it is a contract interface
it only says "my implementors have the implementation of this method"
 
Okay, I see. But in the code abbreviationResolver.findDefinitions(abbreviation) you pass the argument to the method AbbreviationResolver.findDefinitions which has no implementation body?
 
4:16 PM
no, I dont
 
Does anyone have any idea regarding plugin based web application?
 
that function does not exist
 
You mean like, micro frontends?
 
like wordpress
 
the interface says "my implementors have the implementation of this method"
 
4:17 PM
where user can install and uninstall plugins
 
I can't think about the whole plan
 
@Wietlol What exactly is the statement val (definitions, suggestions) = abbreviationResolver.findDefinitions(abbreviation) doing?
 
I am also not sure if I have asked this question properly
 
it says
1, invoke function 'findDefinitions' from the implementation of the 'abbreviationResolver'
2, pass the 'abbreviation' to that function as arguments
3, get the first and second value out of the result and put them in the local variables 'definitions' and 'suggestions'
 
4:25 PM
@Wietlol Thanks. That's clearer now. Is it dependency injection that chooses which implementation of IAbbreviationResolver is called?
 
in my code, it is
it doesnt have to be
 
@Wietlol I think that in simple terms (ignoring dependency injection) the reason that using IAbbreviationResolver is useful is that in your code IAbbreviationResolver passed in from another type as a parameter to a method or function can be either AbbreviationsDotCom or IAbbreviationResolver via implicit type casting. @mr5 is this what you mean by:
@Wietlol Great. So in C# it's possible to also have a statement equivalent to val (definitions, suggestions) = abbreviationResolver.findDefinitions(abbreviation) and then dependency injection picks which IAbbreviationResolver implemention's function to call?
 
no
dependency injection is a separate topic
there are 2 steps you take at the same time
 
In C# it's possible to also have a statement equivalent to val (definitions, suggestions) = abbreviationResolver.findDefinitions(abbreviation)
This one is correct
 
step 1: it uses the implementation based on whatever is assigned to abbreviationResolver
 
4:33 PM
Albeit in C# it's var
 
step 2: the abbreviationResolver in this case is assigned through the dependency injection
 
||google "Does albeit come from although be it"
 
@Squirrelkiller Thanks
 
damn
They do have some germans there, just clobbing words together like that
 
4:36 PM
Is this correct?:
5 mins ago, by Black Panther
@Wietlol I think that in simple terms (ignoring dependency injection) the reason that using IAbbreviationResolver is useful is that in your code IAbbreviationResolver passed in from another type as a parameter to a method or function can be either AbbreviationsDotCom or IAbbreviationResolver via implicit type casting. @mr5 is this what you mean by:
 
not via casting though
 
4:48 PM
@Wietlol Let's switch to C#. Here's an example of what I'm trying to describe as the reason that using (i.e. creating) IAbbreviationResolver is useful paste.ofcode.org/3ZQQCaTkm3xa4ekKg4gvjy (scroll down to line 36)
 
no, you cannot cast like that
 
@Wietlol Okay, but explicitly you can right?
 
no
    // Now we care
    // Here we want the implementation of IAbbreviationResolver that is AbbreviationsDotCom
no you dont
you do NOT care which implementation is used
you ONLY care that abbreviations can be resolved
 
Okay, understood. So how would you write that code differently?
 
just c.Resolve(stuff);
 
5:03 PM
@Wietlol I looked at this code of yours again paste.ofcode.org/TaF6cNwuTCjkNMKbteuBk4 and paste.ofcode.org/PBeJkP7W5wfCEJa84TMxfa.
@Wietlol The return await resolver.Resolve(abbreviation); calls IAbbreviationResolver.Resolve(...). If you do not care which implementation of IAbbreviationResolver.Resolve is used when IAbbreviationResolver.Resolve(...) is called, then how can you control whether the Definition that is returned is from invoking http requests to abbreviations.com or from doing a Google search with the abbreviation?
 
you control that by specifying it when you create the instance of the waterfall
when you do new WaterfallAbbreviationResolver(new List<IAbbreviationResolver> { new AbbreviationsDotCom(), new GoogleAbbreviationResolver(), })
 
5:17 PM
@Wietlol My jaw literally dropped, I wanted to post that Vince McMahon gif but don't know how. I didn't know an interface could make this possible. So when Resolvers[0].Resolve() is called the Resolve method in AbbreviationsDotCom is called?
 
yes
 
And when Resolvers[1].Resolve is called the Resolve method in GoogleAbbreviationResolver is called?
 
yes
but the waterfall class doesnt care which ones they are or in which order or how many
you could in theory just add a bunch of google search ones and it will just retry a bunch of times
although, in that case, you probably just want another class that just loops over the same one
 
Okay, thanks. I understand a bit better now, the significance of interfaces
@Wietlol And because of this:
public async Task<Definition> Resolve(String abbreviation)
    {
        IList<Exception> exceptions = new List<Exception>();
        foreach (IAbbreviationResolver resolver in Resolvers)
        {
            try
            {
                return await resolver.Resolve(abbreviation);
            }
            catch (Exception ex)
            {
                exceptions.Add(ex);
            }
        }

        throw new AggregateException($"Unable to resolve the abbreviation '{abbreviation}' by any of the {Resolvers.Count} resolvers.", exceptions);
when you do new WaterfallAbbreviationResolver(new List<IAbbreviationResolver> { new AbbreviationsDotCom(), new GoogleAbbreviationResolver(), }) like @mr5 was saying:
2 hours ago, by mr5
Say, abbreviations.com is down, then you can easily fallback in Google
Right?
 
that is what the waterfall is for, yes
or if the abbreviations.com says "I dont recognize this as an abbreviation"
or other reasons for failure
 
5:28 PM
Is this WaterFall resolver a standard thing in software engineering, or did you just make it up for your example?
 
I made it for this example
normally, you start off with only one implementation of your interface
for example, in Wietbot, I only had the implementation of abbreviations.com
you only make the waterfall as soon as you need it
 
@Wietlol That's cool. Your examples are really good, as long as they're not in Kotlin :D
@Wietlol I'll keep that in mind
And this too:
2 mins ago, by Wietlol
you only make the waterfall as soon as you need it
@Wietlol In Visual Studio Code, when I write the code:
List<string> list = new List<string>();

            IEnumerable<string> seq = list;

            seq.
The compiler only shows methods in IEnumerable<string>, not methods in List<string>. So how is it then that when you do ew WaterfallAbbreviationResolver(new List<IAbbreviationResolver> { new AbbreviationsDotCom(), new GoogleAbbreviationResolver(), }) the return await resolver.Resolve(abbreviation) statement in the foreach loop calls the Resolve method on the concrete classes AbbreviationsDotCom or GoogleAbbreviationResolver?
 
5:49 PM
@Wietlol Looking at the .NET Framework source code. List implements IList<T>, System.Collections.IList, and IReadOnlyList<T>
IList<T> implements ICollection<T>
Then ICollection<T> implements IEnumerable<T>
 
yes
 
My guess is that IAbbreviationResolver.Resolve calls the implementation of IAbbreviationResolver.Resolve, that is, calls the Resolve function in Implementation 1 which is AbbreviationResolver or the Resolve function in implementation 2 which is GoogleAbbreviationResolver. Right?
Or is it that referencing IAbbreviationResolver refers to the implementation of IAbbreviationResolver, not IAbbreviationResolver itself?
Then IAbbreviationResolver.Resolve proceeds to call the Resolve method on the instance (i.e. implementation) that was referenced via IAbbreviationResolver
 
it is not a reference
are you familiar with other languages?
 
Not really, Java, but I don't really code in Java anymore
 
6:04 PM
hmm... maybe it is just better to search for documentation/examples then
 
@Wietlol A type is not a reference. A variable is a reference.
 
if my explanation isnt clear, then there is a big chance that explaining it again wont do much better
a variable is also not a reference
 
@Wietlol really
 
a variable is a container that can contain a value
the value could be a reference
 
@Wietlol Your explanation is very clear. It is just this that I'm not sure about:
32 mins ago, by Black Panther
The compiler only shows methods in IEnumerable<string>, not methods in List<string>. So how is it then that when you do ew WaterfallAbbreviationResolver(new List<IAbbreviationResolver> { new AbbreviationsDotCom(), new GoogleAbbreviationResolver(), }) the return await resolver.Resolve(abbreviation) statement in the foreach loop calls the Resolve method on the concrete classes AbbreviationsDotCom or GoogleAbbreviationResolver?
@Wietlol Yes, a reference to an object. My mistake.
@Wietlol So then this is correct:
 
6:09 PM
@BlackPanther because Resolve is not a method from Abbreviation or Google
 
9 mins ago, by Black Panther
My guess is that IAbbreviationResolver.Resolve calls the implementation of IAbbreviationResolver.Resolve, that is, calls the Resolve function in Implementation 1 which is AbbreviationResolver or the Resolve function in implementation 2 which is GoogleAbbreviationResolver. Right?
 
it is a method from the interface
 
@Wietlol so:
IAbbreviationResolver a = new AbbreviationsDotCom();
a.Resolve();
Calls the method Resolve in the interface IAbbreviationResolver but the implementation (i.e. the implementation body) in AbbreviationsDotCom is executed?
 
> Calls the method Resolve in the interface IAbbreviationResolver
NO
it calls the method from AbbreviationsDotCom.Resolve
but it figures that out behind the scenes
 
@Wietlol You mean
it calls the method Resolve in AbbreviationsDotCom?
 
6:29 PM
@Wietlol Do you know how the compiler does this?
 
6:57 PM
not entirely
I think Roel and I had a conversation about it a while back
we have an idea how it is done, but not sure it is the case in C#
 
Thanks.
@Wietlol Did you and Roel decide that the compiler calls the method AbbreviationsDotCom.Resolve because the concrete class AbbreviationsDotCom being an implementation of the interface IAbbreviationResolver means that AbbreviationDotCom is IAbbreviationResolver, and so IAbbreviationResolver is AbbreviationsDotCom?
@Wietlol What do you both think happens when you do:
58 mins ago, by Black Panther
IAbbreviationResolver a = new AbbreviationsDotCom();
a.Resolve();
 
7:39 PM
@Wietol The code:
            List<string> list = new List<string>();

            IEnumerable<string> seq = list;

            IList<string> list2 = list;

            WriteLine($"type of list: {list.GetType()}, type of seq: {seq.GetType()}, type of list2: {list2.GetType()}");
Prints:
type of list: System.Collections.Generic.List`1[System.String], type of seq: System.Collections.Generic.List`1[System.String], type of list2: System.Collections.Generic.List`1[System.String]
So the static type of list2 is IList<string> but the runtime type of list2 is List<string>. So for an interface, at run-time the interface type is converted to the concrete type that implements the interface. The fact that at run-time an interface type is converted into its (concrete) implementation makes sense because an interface does not contain executable code 1
 
8:00 PM
Sara Chipps on January 28, 2021
We’ve got big things planned. And small things. So much stuff. Check it out!
 
8:25 PM
@Wietlol I don't think an interface can implement an interface, since only concrete types like structs and classes can implement an interface, or maybe I'm wrong? So when there's a hierarchy of interfaces like this:
public interface IList<T> : ICollection<T>
public interface ICollection<T> : IEnumerable<T>
@Wietlol What does that hierarchy mean? Does it mean that IList<T> inherits from ICollection<T> which inherits from IEnumerable<T>?
 
8:57 PM
A tiny adjustment to this:
1 hour ago, by Black Panther
So the static type of list2 is IList<string> but the runtime type of list2 is List<string>. So for an interface, at run-time the interface type is converted to the concrete type that implements the interface. The fact that at run-time an interface type is converted into its (concrete) implementation makes sense because an interface does not contain executable code 1
Even if the interface did contain executable code (i.e. a default implementation), the run-time type of the interface is still the concrete type that implements the interface. I tested this.
 
01:00 - 21:0021:00 - 00:00

« first day (3757 days earlier)      last day (1174 days later) »