RE: For-Foreach:
That is interesting. However, I find it a little funny that the author uses post-incriment while talking about micro-benchmarking; in C++ there can be a lot of extra cost to post-incriment so I've got in the habit of using pre-incriment at all costs. Of course the overhead is negligible for built in types like INT, FLOAT and such but custom classes and whatnot…well, that's a funny mistake as long as its in someone else's code.
Off to read the others now.
If I may stray off topic a tad for a sec, it's still relevant in most respects though (to people new to C#/.net).
Hi John,
Inheritance and polymorphism is over emphasised in learning literature IMO, when learning it's very easy to get caught up inheriting from everything to keep things DRY, this is bad as it creates very tightly coupled code that makes your libraries almost useless for any other applications. If you are trying to write unit/integration tests for existing code you will quickly learn why inheritance can be overused very easily.
The less talked about paradigm is Interfaces, these are what make things like the 'foreach' statement very powerful. By using the ICollection interface and overriding the necessary methods you can create your own collection types that can be iterated using foreach.
It's taken me a while but I've finally got my head around unit testing and it was interfaces that provided the 'aha!' moment, by creating your own interfaces you are creating an api that you can then plug your inherited classes into as dependencies. Test driven development pretty much enforces this style of architecture and well worth investigating once you get the language basic down.
Windows .Net loves you to inherit from their classes as it ties you tightly to the technology, I don't think this was deliberate but it does make things easy when creating user controls etc. By using interfaces though you can then separate the internal logic of your custom control behavior from the api and reuse it in other platforms (think gaming or web tech).
Check out some vid's/books from Robert C. Martin (Uncle Bob) on S.O.L.I.D design, well worth a look.