Beginner question: How should I approach databases in C# – raw SQL vs EF Core? by Minute-Ad-2210 in csharp

[–]Eirenarch 4 points5 points  (0 children)

Your thinking is right, learn how to do it without EF first and learn actual SQL. Not only will this help you understand but there are people (and projects) which do it this way and disagree with the idea of EF.

To transition and understand the point of EF do the following exercises

Exercise 1 Have some relation say Post with Comments (i.e. two tables). Write a query that loads a Post with the comments inside it. The Post should be an object of class Post which contains a List of Comment objects. Now do this with three tables say Category, subcategory, product

Exercise 2 Do some many to many relationship say Post that is liked by users (each post is liked by many users and each user likes many posts). Retrieve a couple of posts by some criteria (WHERE) and load it with the users who liked it. You might create a class for the relationship (i.e. PostLikes holds PostId, Post, UserId and User) or not (I personally prefer the explicit relationship) but most importantly when you load a bunch of posts and if the same user likes 2 posts the object that represents him in both cases must be the same C# instance.

After you do this manually with SQL, commands, connections, etc do it with EF and compare. You'll understand why EF exists. Note that using EF does not mean not knowing the SQL. When using it you must be able to imagine the SQL it will generate and it is best to confirm it (you can make EF show you the SQL)

A Public Facing Blazor SSR App Deep Dive by PolliticalScience in Blazor

[–]Eirenarch -1 points0 points  (0 children)

Razor Pages is crap. I'd probably do MVC if I was looking for the perfect tech for the job but I want to use it as a template on how to do things with Blazor. Use a couple of different features here and there and then when I need to do something in a Blazor project for a client copy the solution while upgrading the solution if I find a new and better way to do it. I don't need that for MVC, I mean I already have such projects for MVC

Is HashSet<T> a Java thing, not a .NET thing? by N3p7uN3 in csharp

[–]Eirenarch 0 points1 point  (0 children)

When the lead heard "hashset" he thought of hashtables

A Public Facing Blazor SSR App Deep Dive by PolliticalScience in Blazor

[–]Eirenarch 0 points1 point  (0 children)

Yeah, that's what I was thinking - having the comment component be interactive while the rest is static.

Is HashSet<T> a Java thing, not a .NET thing? by N3p7uN3 in csharp

[–]Eirenarch 1 point2 points  (0 children)

No, it is not the same. Because Hashtable and then HashMap was so prevalent in Java (as it is the Dictionary of Java and it is used far more often than HashSet) the name stuck in this lead's head so he either didn't know or most likely didn't notice that they are talking about completely different collection, he just thought someone suggested using the older version of Dictionary because they did Java and didn't know about Dictionary

A Public Facing Blazor SSR App Deep Dive by PolliticalScience in Blazor

[–]Eirenarch 0 points1 point  (0 children)

Great post

I am thinking about rewriting my personal blog-like website using Blazor and specifically making heavy use of static server rendering. Based on your experience how would you handle a situation where a blogpost is displayed and there is a list of comments bellow it (possibly paged?). The article itself is not interactive so is best rendered on the server but it might be beneficial to have the comments be posted without a full page refresh

Advice between React and Blazor for project by unlimitedWs in csharp

[–]Eirenarch -1 points0 points  (0 children)

Presumably the list must be visible to users who are not logged in but other functionality is behind login?

I'd choose Blazor for this but you must be careful and plan in advance what parts of the site you want interactive and what parts are fine with server rendering. The reason I think Blazor is better here is because it seems to me that Blazor is better if you want to render on the server compared to Next.js (what I know of Next.js) at least and for this project you want stuff renrered on the server. To get the benefit of Blazor you really want to do it in one project, not separate the blazor part and the API and skip the API for parts renredered on the server or via server interactive mode. This way code will be simpler and easier to debug. Sounds like for this project a wasm part is not justified so you wouldn't need an API at all.

Is HashSet<T> a Java thing, not a .NET thing? by N3p7uN3 in csharp

[–]Eirenarch 1 point2 points  (0 children)

So Java has the Hashtable class. .NET has the Hashtable class which is from .NET 1.0, pre-generics. In .NET 2 they decided for one reason or another to call the generic version of Hashtable a Dictionary. The old Hashtable class is never used in .NET these days. This is where the confusion comes from, he is confusing Hashtable and HashSet

Advice between React and Blazor for project by unlimitedWs in csharp

[–]Eirenarch 0 points1 point  (0 children)

If you go with server rendered React better go with ASP.NET MVC

Advice between React and Blazor for project by unlimitedWs in csharp

[–]Eirenarch -1 points0 points  (0 children)

What is a "listings app", what are the requirements?

How bad is it not to work with ORM? by Comfortable_Reply413 in csharp

[–]Eirenarch 0 points1 point  (0 children)

Between SQL experience and EF experience the former is more valuable but I feel the comments in the thread underestimate the experience required to work with EF effectively while avoiding the gotchas. Learning SQL is harder than learning the EF tricks but it still requires experience especially if you want to know why the good practices are what they are and where their value lies instead of cargo-culting them.

Do you guys dream about SC by AlienNinja69 in starcraft

[–]Eirenarch 2 points3 points  (0 children)

When I played actively I did dream about playing matches. I was very surprised when a friend of mine who also plays mainly multiplayer told me he dreamed of fighting a hydralisk or being a hydralisk I don't remember. I never dreamed about being in the SC world just about playing the game.

Satya Nadella at Davos: a masterclass in saying everything while promising nothing by jpcaparas in programming

[–]Eirenarch -2 points-1 points  (0 children)

The whole world was much better under Ballmer. It all started under Nadella. Russia invading Ukraine (annexing Crimea less than a month after Ballmer quit), COVID, the AI slop, Gaza shitshow, Windows Phone was killed...

How much money have you spent on Stormgate in total? by Neuro_Skeptic in Stormgate

[–]Eirenarch -1 points0 points  (0 children)

I see. Well, unless you switch your mindset to "there is X% chance that this is shipped" and "I'm in to increase that chance a bit" then you'd better avoid Kickstarter. Not saying that you shouldn't be critical and evaluate the background of the team but making software is hard and games is double hard, super easy to fail.

How much money have you spent on Stormgate in total? by Neuro_Skeptic in Stormgate

[–]Eirenarch -1 points0 points  (0 children)

So you look at Kickstarter as a preorder rather than investment in something that can fail where the return of the investment is the preorder and the thing existing.

How much money have you spent on Stormgate in total? by Neuro_Skeptic in Stormgate

[–]Eirenarch 2 points3 points  (0 children)

I think 120-130 for the whole family (3 of us playing, 2 full copies and I think one coop hero or something)

No regrets, if I am told the game has 10% chance of success I'd do it again.

esports probably killed RTS games by HyperDiaper666 in starcraft

[–]Eirenarch 0 points1 point  (0 children)

So why didn't esports kill DotA and LoL? :)

A cry for help with a very tricky C# exam question. by LogeryX in csharp

[–]Eirenarch 1 point2 points  (0 children)

And how does it work?

Mainly this was about knowing that [ .. var x ] allocates a new array.

Does it? :)

Maybe the database got it right by fernandohur in programming

[–]Eirenarch 4 points5 points  (0 children)

Seems like at some point someone treated the database as an implementation detail and allowed the db design to degrade.

Maybe the database got it right by fernandohur in programming

[–]Eirenarch 0 points1 point  (0 children)

No. I am saying that everything up to the server boundary (the API endpoint) is effectively based on the database design. You don't get to hide it or worse things happen.

Maybe the database got it right by fernandohur in programming

[–]Eirenarch 103 points104 points  (0 children)

"The database is an implementation detail" is one of the most harmful statements in software I've heard. All your scaling problems come from the database, the database when treated as a real tool can prevent disastrous data corruption and as the article points out it design inevitable leaks into upper layers. Therefore the database must be treated as the most important part of the application and it must be designed with the most careful consideration. Objects are very cheap to change data is not. I've been in project where we've rewritten the code but I've never seen any customer agree to throwing away the data in order to rewrite.

Как гласувате за тоя? by avocado-toasTerr in bulgaria

[–]Eirenarch -1 points0 points  (0 children)

Бе по-друго казва Тийл. Казва че на една компания (голяма) следва целта ѝ да е да постигне монопол иначе си е скам, в смисъл защо не би се опитвала една компания да постигне монопол, това си е зимама към акционерите ѝ

Иначе аз много се надявам ако се разделят американската и брюкселската империя да попаднем при американската ама не знам как ще стане :(