tags:

views:

1495

answers:

9

I'm relatively new to .NET programming (and OOP in general) and I want to make sure I'm not developing bad beginner habits when designing my applications.

If you were hiring a new .NET developer and had to get him up to speed relatively quickly, but also wanted to make sure he adopts best practices (e.g., single responsibility principle, unit testing, separation of concerns), what would be your recommended learning path?

I've been listening to the Polymorphic Podcast lately and, while listening to discussion of best practices is helpful, I'm finding a lack of screencasts and code examples aimed at providing an introduction to these best practices.

Thanks!

+10  A: 

If, as in your hypothetical example, I was hiring a new .NET developer and wanted to make sure they adopted best practices, I would start by making them look through my current code base.

Then I would recommend they read the following:

That should give anyone a pretty solid foundation in best OOP practices.

Bill the Lizard
+4  A: 

If you like screencasts, take a look at Autumn of Agile. There are not that many episodes out yet, but I believe he will cover a few of the most important best practices.

The episode plan looks something like this:

  • Agile Values and Practices Overview
  • Basic OO Design Principles
  • Design Patterns In Action
  • Unit Testing Basics
  • Mock Objects
  • TDD
  • Project File/Folder Organization
  • Source Control Basics
  • Continuous Integration / Build Automation
  • Agile Project Planning Principles
  • Overview of Domain Driven Design Core Concepts

The author of the series has also made the series Summer of NHibernate, which has been quite popular.

In addition to that, at dnr-tv Jean Paul Boodhoo has made five episodes on design patterns and two on test driven development, I would recommend taking a look at those also.

Erik Öjebo
A: 

Coincidentally, I'm halfway through reading a VB.net book (published by Apress) which is pretty good.

Although there are a wealth of great tutorials on the web, I thouroughly recommend buying a book, they are generally a lot more professional in their approach.

And as crazy as it sounds I find it much better NOT to sit at my computer while learning programming! I always read a chapter or two then go to my computer and do it for real.

DisgruntledGoat
A: 

I am helping a friend that is exactly in the situation you mention. He is a HW guy that used to work with C in the past.

I think the best approach is mentoring and coding. I explain him a few concepts and then ask him to program some code. We just built a simple calculator in multiple platforms (WCF, Silverlight, XNA,..) and using some well known patterns (state, MVP...).

I force him to use good programming practices and refactor the code by asking him new features based on his mistakes. For example if he coupled a couple components like the View and the Controller I would ask him for a new view... this obviously makes him to rewrite a bunch of code and he realizes there are better ways...

In this way he is the one coming up with the natural decoupling and what is more important the "why is good". I am very pleased with the results so far; he is very happy with unit testing and how it allows him to easily change the code for good.

IMHO separation of concerns and unit testing are better explained and understood by coding and having to implement new features; specially for new programmers. Once he buys in I would recommend him to read "Design Patterns" by the GOF or some of its simpler varians.

MMind
+7  A: 

There are two separate, though related, goals:

  • To be a good OO developer

and

  • To be a good .NET Developer

Being excellent at the later will require being at least good at the former, but both will require hard work. Don't get locked into the Microsoft mindset, or even a .NET one - you need to develop familiarity across a wide range of the field.

If you have the flexibility to do so, find yourself a job or a team where someone experienced is willing to do some mentoring.

Next, recognise that you'll need to do a lot of reading, both online and off. If your reading speed is average or lower (around 250 words per minute or less), then you should consider attending a training course on reading techniques - I've done a course with Write Group (New Zealand) and trebled my reading speed.

In terms of books, Object Thinking from the Microsoft Press would be a good starting point; I'd follow that with Programming .NET Components (Juval Lowy) and Smalltalk Best Practice patterns (Kent Beck), then The Pragmatic Programmer (Hunt and Thomas).

After that, troll around (on StackOverflow or elsewhere) and find lists of recommended books and blogs. Keep reading - try to read a new book on a new topic at least every two months, if not monthly.

Bevan
A: 

IMO you can not teach the best practices to someone. Best practices need to be attained and to do that someone has to accept that he is not the best. To write a good code developer needs to read someone else's good code. This way he will adopt the best practices.

Beside this he has to keep his eye and ear open to any good screencast or some good books like "Code Complete", "Writing Secure Code" etc...

Pradeep
+2  A: 

I see many good resources here, but most are focused on reading and study material. While these are definately essential, I find that they don't really click until I have actually used a pattern or hueristic or concept or whatever one or more times.

Because of this I would recommend the reading but when you sit down to code start working with NUnit and practicing TDD (or BDD, etc). This will help you to do two things.

  1. It will pressure you to decouple your classes. It is hard to really test code with many dependencies. If you want to really get in there and write tests you will need to decouple. This is a good place to start applying all the recommened reading. :)

  2. TDD will help you to think about how you want to interact with your code before you even write it. I find that thinking about a design abstractly is different from actually coding the interface from the outside, and the latter is more useful in fitting the pieces together.

Jamal Hansen
A: 

i would recommend uncle bob's book: http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445

Ray Tayek
+1  A: 

I think you need to first understand that being a "good" programmer who understands OOP and best practices would takes time and experience. There are no magic combination of books, blogs, or training to replicate time in the trenches.

My advice, based on my own experience, is to not worry too much that you aren't following best practices and just write code. If you are new to OOP or .NET you are going to do silly things. You are going to do the opposite of "best practices" until you've made enough mistakes to learn from them.

The theory of specificity training states that you should specifically do that which you want to become better at. This means to write a lot of code to get better at writing code.

Now, once you are writing a lot of code without fear, you will need to supplement with outside knowledge. In order of importance:

  1. Work directly with others who have more experience than you. This is the fastest way to get up to speed.

  2. Read other OOP .NET code. Open source is great for this! Study it, extend it, add features to an OSS project even if you never commit.

  3. Read books. I specifically mean books... not blogs. Books have more room to expand on a topic and are best for people who really are starting from scratch on a given topic. I recommend Code Complete as a great first book.

  4. Read the 'nets. This includes blogs, stackoverflow, etc.

Good luck!

Chad Pavliska