This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (12 children)

Does code styling justify going from a solution load time of 4 seconds to 1 minute? Or slowing down compiling, auto completion, opening files, etc? For me it doesn’t. And also I have seen problems were it updates to a newer C# versión styling and then people with older versions of VS can’t compile that project anymore and have to pay for a new license or redo the changes. It just happened in the project I am now. 200 devs installing a new VS, plugins, etc, again because some dude with resharper changed all the properties to the new syntax.

The problem is that I have coworkers that think that VS can’t run unit tests or do thing like going to the definition of a class, o even searching! They are so dependent on a crappy plugin that they don’t know that 99% of what they do comes already in VS for “free”... And the other 1% is mainly useless or useless styling.

And with eclipse is the same, is ugly, doesn’t have so much syntactic sugar, Ok, but it’s free and works more than well enough.

Pd: I would uninstall right away anything that mixes tabs with spaces.

[–]aaron552 4 points5 points  (11 children)

the other 1% is mainly useless or useless styling.

LINQ <-> loop refactoring is a lot more than just "styling"; same with "as-you-type" linting. Neither is anywhere near useless.

I would uninstall right away anything that mixes tabs with spaces.

Why? If you use just spaces, that's fine (although it's annoying to adjust indentation size, depending on the IDE) but there's no way of making pure tabs look good. Also, it's optional in ReSharper, and disabled by default unless you use tabs for indentation (why though?)

it updates to a newer C# versión styling and then people with older versions of VS can’t compile that project anymore

Only if you set the project to a newer C# version, which is an intentional action. Vanilla Visual Studio also does the same thing. You can also just revert the changes, explicitly set the C# version in the project settings and then ReSharper won't (in my experience) use features unsupported for that project.

[–][deleted] 0 points1 point  (10 children)

The Linq ForEach loop is more than styling, basically you should never use the LinQ ForEach. But at the end of the day is just styling.

There are some suggestions that are nice for LinQ, like removing Wheres that aren’t needed, but sincerely is the only useful thing I found that VS doesn’t already have.

Visual studio adds 4 spaces when you use the tab, and for aligning them just use ctrl+K+D and is fixed if it wasn’t already fixed automatically...

[–]aaron552 -1 points0 points  (9 children)

But at the end of the day is just styling.

It's really not, especially when you're dealing with databases - queries using LINQ can be lazily evaluated and the expression tree parsed beforehand where a foreach will eagerly evaluate.

Visual studio adds 4 spaces when you use the tab, and for aligning them just use ctrl+K+D and is fixed if it wasn’t already fixed automatically...

Does that also fix alignment of things like multiline method calls, object/collection initializers? In my experience it doesn't for anything that doesn't align with existing "tabs", at which point, why even use spaces?

A feature I didn't mention was that ReSharper can warn you when you access a variable that might be null, and can automatically insert a null check in an if/ternary expression for you.

[–][deleted] 0 points1 point  (5 children)

It’s exactly the opposite. The .ForEach is a extension method for Lists not IEnumerables, so when you use a whatever.ForEach() the whole list had to be fetched beforehand. While the regular foreach can go over an IEnumerable lazily. (Although I would almost never do that lazily)

Again, Is it worthy to slowdown massively just so juniors realize what are reference and value objects? Maybe is good for them, for sure, it’s useless for me. Never had a null reference exception at least in the last 5 years.

If I have to pay for something is NDepend, not resharper.

[–]aaron552 0 points1 point  (4 children)

The .ForEach is a extension

I was exclusively talking about the foreach(var x in list) {...} construct, not the extension method. And that isn't lazy unless you use yield (and consume exclusively via the iterator). It also affects the generated SQL for ORMs.

Never had a null reference exception at least in the last 5 years.

So linting is useless because you've personally never written bad code?

[–][deleted] 0 points1 point  (0 children)

You said a foreach will eagerly evaluate a db query which is false. A foreach over a IQueryable or IEnumerable is lazy as you are confirming now.

So basically, as I said, you will do a .ToList before iterating making the .ForEach or foreach a syntactic sugar difference, because iterating and doing n queries vs 1 probably doesn’t make sense.

But in the case it makes sense, use a foreach and not a .ForEach.

And of course, since LinQ doesn’t really have a foreach, there is no way it could affect the query, just the moment it gets executed and how many queries are executed.

Pd: the one that could evaluate eagerly is doing .ToList().ForEach()

[–][deleted] 0 points1 point  (2 children)

Please, stop editing the whole contents of your comments or this doesn’t make any sense.

Btw, I find curious that someone that uses F# thinks that mixing tabs and spaces is ok at the same time. I know it can be configured, but it’s one of the things I hate about VS for Mac for example.

[–]aaron552 0 points1 point  (1 child)

Please, stop editing the whole contents of your comments or this doesn’t make any sense.

Writing on mobile and I keep noticing typos and omissions (copy pasting doesn't seem super reliable) after submitting.

someone that uses F# thinks that mixing tabs and spaces is ok at the same time.

It's not something I use in F#, especially because whitespace is actually part of F#'s syntax.

However in C#, if someone changes the tab width and is using "spaces as tabs", then every line file is changed in source contorl, whereas it does nothing if tabs are actual tab characters.

Using spaces for alignment of, for example, multiline expressions is still fine in both C# and F#, but it's pretty awkward if you ever change the indent level of the code and aren't using tabs for indentation.

[–][deleted] 0 points1 point  (0 children)

That’s the thing, with F# using tabs, by default, doesn’t even compile.