Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My biggest fear with getting back into C# (I have rudimentary .NET skills) is that although I may find the solution to a problem, it will not be the optimal solution. What is the best way to ensure that I am not just getting the job done, but that I become a competent C# programmer?

share|improve this question
    
Never get hung up on the optimal solution, that is rarely, if ever, the goal. –  Ryathal Mar 8 '12 at 15:03

3 Answers 3

up vote 5 down vote accepted

Having gone through this exact transition myself, I can tell you that the biggest mistake is to start just writing things the same way you would in Java. With LINQ, extension methods, tuples, lambda expressions, using(IDisposable){...}, etc. there are a million nicer ways to do things in C#.

The best thing I did was to buy "C# 4.0 in a Nutshell" and read it cover to cover. Read a chapter a day and you'll be good.

share|improve this answer

Note that while C# started out quite similar to Java-at-the-time, it has diverged somewhat in recent years. Read a couple good books--I'd recommend Skeet's C# in Depth, for example, which quite aptly covers changes in the language from 1.0 to 2.0 to 3.0 (and, in the 2nd edition of the book, to 4.0 as well).

In a more general sense, you aren't the only person to worry that your solutions may not be optimal, and this worry certainly transcends Java or .NET. As you continue to ask questions, read the code of skilled programmers, and gain experience with your language and platform, these fears will gradually diminish. I think it's a good thing that you are concerned, though! There are many who aren't, and they don't improve.

share|improve this answer

The key is to be lazy. Think to yourself, "Which solution will result in the least amount of code to maintain, where broken components can be edited without affecting others, and the inevitable issues are easy to find and fix?"

Also realize that no solution is optimal. That doesn't have to stop you from inching your solutions toward optimal over time. When you discover a better why of doing something - LINQ, functional composition, naughty nurses - embrace it and make it yours.

Say to yourself, "I am not optimal, but I understand why MVC is better than what came before it, I understand American cinema is ossifying, and I make a mean cheese cake." Yes!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.