5 ms·
This isn't too hard in some languages and I prefer it, but there are other languages (like C#) where class names are long and descriptive (e.g. ImmutableSortedD
by smt88 8y ago
This isn't too hard in some languages and I prefer it, but there are other languages (like C#) where class names are long and descriptive (e.g. ImmutableSortedDictionary) and it becomes harder to read instead of easier.
- noblethrasher 8y agoC# offers a way to mitigate that, somewhat. I often have something like this among the top level `using` statements. using FooMemo = System.Collections.Immutable.ImmutableSortedDictionary<string, Foo>;
- alok99 8y agoYou can do similar in C++. The problem is when the number of long types and variable names grows, you end up with classes and functions full of `using`, which gets confusing fast.
- WorldMaker 8y agoAlso `var` is such an important mitigatory for this in C# that it continues to astound me that some of the worst offenders also eschew `var` in C#. You really don't need the redundancy of `ImmutableSortedDictionary<string, Foo> localCache = new ImmutableSortedDictionary<string, Foo>()`, it's not some sort of Prolog assertion where the strict tautology makes different code than `var localCache = new ImmutableSortedDictionary<string, Foo>()`.
- kstenerud 8y agoThe problems start when you open code to see var localcache = cachemaster.cacheFor(foo); Now you have no idea what it is until you dig into the (hopefully correct) API docs, or use an IDE that can untangle things.
- guitarbill 8y agoI don't buy it. It's one jump to method definition away, which even an editor without IDE capability should be able to manage. But also, this is what dynamic languages look like, and people still manage to be productive. (I'll agree it can be a bit tricky with LINQ and anonymous types in C#, but I think `var` usage is worth that trade-off)
- shermanyo 8y ago^ Your line of code is 85 characters though.. Would you bother to split this line somewhere? (if trying to conform to an 80char limit)