Message from @porco

Discord ID: 480360627752271882


2018-08-18 12:56:51 UTC  

He's a wannabe coder now, so he has big opinions

2018-08-18 12:57:03 UTC  

>said the hamburger coder

2018-08-18 12:57:22 UTC  

The only thing I code is my insulin pump

2018-08-18 12:57:33 UTC  

in my case it's not the interfaces that are too distinct, it's the classes that are not distinct enough

2018-08-18 12:57:41 UTC  

Get it? The joke is that I'm diabetic because I'm fat

2018-08-18 12:57:45 UTC  

for example, my `WikiPageListRepository` could also be `MySQLWikiPageListRepository`

2018-08-18 12:57:56 UTC  

`VideoSearchEngine` could be `HttpVideoSearchEngine`

2018-08-18 12:58:31 UTC  

but in the end, all those interfaces expose a tiny bit of replaceable functionality

2018-08-18 12:58:33 UTC  

tbh I'd thought that since they all use Search part then linkin them to ISearch should be enough

2018-08-18 12:58:40 UTC  

But then again I'm not the one hosting porn indexing site

2018-08-18 12:58:44 UTC  

ISearch would be waaaay to big

2018-08-18 12:59:10 UTC  

https://cdn.discordapp.com/attachments/189467888657235970/480360007628488704/Screenshot_2018-08-18_14-59-06.png

2018-08-18 12:59:26 UTC  

`ISearchQueryGenerator` generates search queries for the links

2018-08-18 12:59:39 UTC  

`SearchQueryGenerator` implementation does this, using the HTTP Request

2018-08-18 13:00:01 UTC  

soon, I will have a new implementation, that does this out of the request log

2018-08-18 13:00:31 UTC  

https://cdn.discordapp.com/attachments/189467888657235970/480360345282674698/Screenshot_2018-08-18_15-00-25.png

2018-08-18 13:00:43 UTC  

`IVideoSearchEngine` is a very simple interface

2018-08-18 13:00:51 UTC  

it allows you to search videos

2018-08-18 13:01:01 UTC  

the implementation of `IVideoSearchEngine` uses ElasticSearch

2018-08-18 13:01:25 UTC  

Now I could substitute this with an implementation running Lucene and use both at the same time if I was retarded

2018-08-18 13:01:38 UTC  

because I always only use `IVideoSearchEngine` and never the concrete implementation

2018-08-18 13:01:48 UTC  

that's the reason for having an interface for everything

2018-08-18 13:01:54 UTC  

also what you saw there is only the DI container

2018-08-18 13:02:09 UTC  

the DI container needs exactly ONE interface and the classes it passes through

2018-08-18 13:03:05 UTC  

```csharp
public interface IExample {
IExample Test(string name);
}```

2018-08-18 13:03:15 UTC  

This part from your code baffles me

2018-08-18 13:03:35 UTC  

But maybe because I haven't experienced much with interfaces at all

2018-08-18 13:04:02 UTC  

you can have a fluent interface
```csharp
something.WithThat().WithThis()```

2018-08-18 13:04:09 UTC  

that's what it is for

2018-08-18 13:04:44 UTC  

https://cdn.discordapp.com/attachments/189467888657235970/480361408467566604/Screenshot_2018-08-18_15-04-37.png

2018-08-18 13:04:51 UTC  

the implementation then returns itself

2018-08-18 13:14:37 UTC  

It kinda makes sense that you could do it. Guess I need more IRL programming rather than write programs to pass tasks

2018-08-18 13:25:23 UTC  

the difference is clear:

```csharp
var url = searchqueryGenerator.WithTerm("asian").WithPage(13).WithOrientation(Orientation.Straight).Compile();```
vs
```csharp
searchqueryGenerator.WithTerm("asian");
searchqueryGenerator.WithPage(13);
searchqueryGenerator.WithOrientation(Orientation.Straight)

var url = searchqueryGenerator.Compile();
```

2018-08-18 13:25:50 UTC  

depending on the scenario, either 1 or 2 is the more readable one

2018-08-18 13:26:50 UTC  

Why not
```csharp
var url = searchQueryGenerator.WithTerm("asian")
.WithPage(13)
.WithOrientation(Orientation,Straight)
.Compile();```

2018-08-18 13:27:09 UTC  

yes that's the same, that's version 1 but with new lines

2018-08-18 13:27:16 UTC  

but in order to have this, it must return itself

2018-08-18 13:27:40 UTC  

Why not just go with ver1.5 aka new lines

2018-08-18 13:27:52 UTC  

I copy pasted that from my viewmodel

2018-08-18 13:27:57 UTC  

I use it inline HTML

2018-08-18 13:28:08 UTC  

I don't want to have newlines in my `<a href`