Hacker News new | past | comments | ask | show | jobs | submit login

What are the odds that people actually:

1) use the advanced features and not tripping themselves

2) use it frequently

3) and got a lot of productivity boost out of those features

I would imagine most people will download 3rd-party libraries (open source or not) and tools to become productive. Not so much on the C# advanced features.




I work in a Microsoft shop in a 6 person team of C# programmers. We follow the language closely, try to compete with each other keeping up with new language features (among other things!), and take whatever benefits we can from new stuff. When generics appeared in 2.0 it transformed our coding style. When LINQ (the language feature, not the LINQ to SQL ORM) was added it was transformed again. There hasn't been a major paradigm shift since but we've found handy places to use optional parameters, type covariance and contravariance, tried to handle the new dynamic keyword like dynamite, and we've definitely got plans for the new async features coming out in C# 4. I can tell you from attending technical conferences that we are not an atypical bunch.

So to answer your question, the odds are very good! :)


Actually, the new features introduced in C# increases developer productivity quite a bit. More importantly they increase the readability of code by cutting down on the repetitive stuff. Once some one uses LINQ, lambdas and dynamics its hard to go back.


Can you explain how they can cut down lots of repetitive stuff?

Not to knock you down but my experience with Java is that libraries typically help a lot as opposed to syntax.


Go look at any documentation or discussion of any non-Java language, and see their examples of using their sequence abstractions, or generators (yield), or first-class functions. Those are not ideas which are unique to C#.

If you just want to see a piece of code in C# that would have to be written totally differently in Java to be readable (unless you use some quite abstract third-party libraries like Guava to help) I picked one of my Stack Overflow answers at random: http://stackoverflow.com/questions/2966592/how-to-refactor-t...


That example is definitely looks great.

... and yes, as a Java developer, I use Guava once in a while and I do JavaScript as part of my job as well and I do appreciate first-class function.

Typically the problems that functional features solve are filtering and transformation and yet most often than not I happen to solve them at the SQL layer (be it JPQL or straight up SQL).


Once you start thinking of your object model as data, you can do amazing things. Want to find all the types in your system that implement an interface and spin them up?

     var rules = 
		AppDomain.CurrentDomain.GetAssemblies
		.SelectMany(a => a.GetTypes())
   		.Where(t => typeof(ISecurityRule).IsAssignableFrom(t))
   		.Select(t => Activator.CreateInstance() as ISecurityRule)
   		.OrderBy(r => r.Priority);
You can then run a chain of responsibility by writing

    var allowed = rules.First(r => r.Check(someObject) != null);  
    //Check returns null when a rule isn't relevant to the object being checked
it's pretty sweet for metaprogramming when you can run queries against your codebase


That is definitely sweet.

Java has AOP and extensively use Annotations (Attributes in .NET) and the approach there is definitely heavier than what you wrote above.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: