Hacker News new | ask | show | jobs
by JanJansen 4916 days ago
I work on a pretty huge C# code base. Use of LINQ is the least of it's problems. If anything I'd say one problem is people not knowing about things like lambda expressions, linq, generics or whatever. It can really make code harder to parse when it's written in ways that don't take advantage of the full power of the platform.
2 comments

Yes until we get to:

List<List<Tuple<int, Dictionary<string, object>, string>>>

If you're doing that it's crap code; you should have defined a few named object types. Maybe your "Dictionary<string, object>" is e.g. actually a "PropertyMap". this is not a problem in the c# language.

See also: "primitive obsession" http://c2.com/cgi/wiki?PrimitiveObsession http://sourcemaking.com/refactoring/primitive-obsession

Not at all - you just missed a few facts that need considering. Lets rip it to bits some more:

It's in system.windows.forms isn't it? Don't really want that dependency and associated resolution being dragged in to a web app otherwise the compiler has to load the entire assembly's metadata.

Also, it requires full trust.

Oh and finally it isn't serializable.

Which is why we end up with SerializableDictionary<K, V> which is even longer and is an adaptor for Dictionary<K,V> which implements serialization.

That's why it all sucks.

And I haven't even included ConcurrentDictionary thread safety yet.

The whole thing is a fucking mess.

The typical experience isn't that bad, let alone "The whole thing is"
In my experience, that kind of stuff is usually a problem mainly because of C#'s verbosity from lack of type inference. Although, with 4 unnamed elements there, it might start making sense to create a new type, and then it's just "List<List<MyRecord>>".
How much of that C# code pre-dates the availablilty of those features?
Some of the code was certainly written before those features was available, especially some C# 4 features. I'm sure someone might look at my code someday and wonder why I didn't use async and await. I'm talking about code written today though.