Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

closed as off-topic by MichaelT, GlenH7, Kilian Foth, Dan Pichelman, gnat Oct 9 '14 at 7:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – MichaelT, GlenH7, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

Never get hung up on the optimal solution, that is rarely, if ever, the goal. – Ryathal Mar 8 '12 at 15:03
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

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