Better HN
topnewbestaskshowjobs
Log inSign up

kromenak

2 karma · joined Aug 6, 2021 (5y ago) · 3 submissions

Submissions

comment 2y ago · link · parent

Totally agree - I appreciate and understand (and agree with) the enum idea.

But stating “don’t use booleans” is a terrible absolutist ideas that will lead to terrible code. Imagine a student reads it, takes it to heart, and starts creating dedicated enums for every logic branch in their code.

comment 2y ago · link · parent

I got a Roomba to replace an Eufy, assuming it’d be better because it was more expensive.

Well, it was not! It had similar effectiveness to the Eufy, but lacked manual controls. It also refused to go places the Eufy would (like a dark carpet) and constantly tried to return home after only a cursory clean.

That kind of turned me off on Roomba. Not saying this is why they might be having trouble, but it reflects my experience and feelings toward them.

comment 2y ago · link · parent

I've used C# quite a bit due to the Unity game engine. Moment to moment, it's pretty enjoyable to code in and easy to read. The cross-platform nature is usually really nice too (C# DLLs typically work on all platforms without issue).

However, I do have a few complaints:

We spend a lot of time fighting the garbage collector. This leads to awkward situations where certain variables that would ideally be function-local need to be made into member variables so we can reuse the memory each frame. This makes our code more complex and less local.

The choice to make "class" vs "struct" dictate whether memory is allocated on the heap or stack is annoying. I think there are a lot of problems with this: overloading keywords borrowed from C/C++, not being sure where memory will be allocated unless you go check the type definition, not having the option to instantiate a single type in both memory areas.

At first glance, you think C# doesn't have to deal with pointers. But in reality, just about everything IS a pointer, just with no syntax to indicate it. The fact that (almost) everything can be null makes code more complex.

I also find some of the syntax introduced in newer C# versions hard to read - but I guess I also feel that way about C++!

Ultimately, I still really enjoy/prefer C or C++. Despite their flaws, they give you a lot of options and a lot of control that I sometimes wish I had in C#.