- Posted by Shay Friedman on August 31, 2009
A while ago we decided on my team that we needed to increase our code quality. We were excited about that and thrilled to get it started with.
Then we looked at each other eyes, saw the passion to write better code but… something was missing!

When you think about it – how do you write better code? how do you increase your code quality?
With the help of the great people on StackOverflow, I managed to gather a list of principles that can take your code to the next level:
Testing
Learn how and write write write tests! you don’t have to go for TDD, but remember to test your code and make sure it runs as it is expected to before it leaves the dev environment. Tests include unit and regression tests.
You can use NUnit, TypeMock for .Net languages or other testing frameworks (every language has some).
Code Reviews
Allow other developers to go through your code before you’re done with it; You and them will learn from that.
There are tools to help you with the code review process like Crucible.
I must say it’s magic! we implemented that on our team immediately (no tools currently, we just sit with each other) and several bugs have already been prevented because of that in only a few weeks!
Standards
Agree on coding standards and stick with them. This will help you understand other developers' code, reduce different code blocks that handle for the same issues and prevent bugs eventually.
Standards include:
- Coding standards – naming conventions for example.
- Exception handling standards – how to handle exceptions throughout the application.
- Logging standards - how and when to write log entries.
- Whatever you and your team decides on.
You can enforce standards with third party tools like: FxCop, StyleCop or Code Style Enforcer.
Use Tools to Help you Code Better
Like Resharper.
Design Reviews
Design before you start coding and get your design reviewed before implementing it.
Read Related Books
Like Code Complete: A Practical Handbook of Software Construction
or other books.
Talk and Meet with your Team
Talking makes wonders. Talk with your colleagues frequently and schedule a weekly meeting where every developer presents one interesting or important piece of code he/she have written during the week.
Coding
- Try to simplify the problem as much as you can.
- Try to break the code into small and well defined functional units (folders, files, namespaces, classes, methods) to keep the codebase logically organized and well structured.
- Document the code. Document it so your colleagues will understand it without your help.
Source Control
Work with a source control system like SubVersion, CVS, Git, Team System or others.
Learn Other Languages
Even if those languages are not appropriate for your production code, you can find ideas in them and you can build your own internal tools with those languages.
My recommendation - learn IronRuby!
Own a Build Machine
A continous integration machine which automates the build process is a life saver. It can automatically build the application after every commit (or whenever you tell it to), run unit tests and create a setup project that people can immidiately go and install. It saves so much time! it also saves you from hitting your head against the wall when doing these repeating tasks youself.
Look here for a list of continuos integration applications.
I liked what Mark has written so I'm going to finish with that: "Quality is Free -- quality is conformance to specification and is built-in, not bolted on".
All the best,
Shay.

- Posted by Shay Friedman on August 25, 2009
Hi readers!
I'll start with the announcement - I'm writing a book! it is called "IronRuby Unleashed" and it will be published by Sams Publishing who has brought the world the great Unleashed series.

What is the Book About?
Well, I bet you've guessed it already - the book is about IronRuby. With version 1.0 right around the corner, it is more than important to have some reference books so developers can get started in no time.
The book is a ~500 page reference and guide book. You will start by learning the Ruby language (an essential part for IronRuby devs, I'd say) - from the basic to the advanced subjects. Then you will get to know IronRuby - how to use it in simple and complex occasions. On the third part of the book, you will go through different frameworks and learn how to take advantage of them with IronRuby (WinForms, WPF, Ruby on Rails, ASP.Net MVC and more). Eventually on the last part, you will be guided how to extend IronRuby and add your own touch to the language.
The table of contents (subject to change):
- Part 1 - Introduction to IronRuby
- The Ruby Language
- The .Net Framework
- The DLR
- Getting Started with IronRuby
- Part 2 - The Ruby Language
- The Basic Basics
- Methods, Blocks, Classes and Modules
- The Standard Library
- Advanced Ruby
- Part 3 - IronRuby Fundamentals
- .Net Interoperability Fundamentals
- Object Oriented .Net in IronRuby
- Part 4 - IronRuby and the .Net World
- Data Access
- Win Forms
- WPF
- ASP.Net MVC
- Ruby on Rails
- Silverlight
- Unit Testing
- Using IronRuby from C#/VB.Net
- Part 5 - Advanced IronRuby
- Extending IronRuby using C#/VB.Net
Who is it for?
I tried to write the book in a way developers from both sides, Ruby and .Net, can benefit from it. In addition to that, because of the structure of the book (basics to advanced), people who want to learn their first programming language might find the book helpful as well.
Generally, If you are interested in IronRuby, I believe you will find what you're looking for in this book.
Why Did I Do It?
Hmmm... Tough one... firstly, I really believe in IronRuby. I think it is a killer language which gives developers so much power with such a small effort. For me it was something I had been waiting for for a long time - a language that is fun to work with but still is powerful. By the time I started writing the book I didn't even know how big of a fan I would become...
Secondly, I wanted to know how it would be like to write a programming book (hint: not easy at all!).
Thirdly, I needed something to make mom and dad proud :-)
Where Can I Read Sample Chapters (and purchase purchase purchase!)?
I'm glad you asked. The book is already on Amazon and the Safari Books Online ready for pre-ordering.
The book is also on the Rough Cuts program, which means that a few chapters are released while they are in development so you readers can get a sneak peek, express your opinions and help make the book better. You can access the chapters via the Safari Books web site.
Well, that's about it. I'm still working on it, but the finish line is nearby.
Hope you'll enjoy it,
Shay.
- Posted by Shay Friedman on August 25, 2009
Hi there,
This is the first post for this blog. I'm thrilled to start with it and I hope you'll like it.
I will continue to maintain my previous blog at http://blogs.microsoft.com/blogs/shayf so it will be kind of a mirror of this blog.
Enjoy your stay!
Shay.
- Posted by Shay Friedman on August 1, 2009
I know I do. If you want too, please rate and vote up the suggestions on the Microsoft Connect site:
IronRuby VS Integration: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=479957
IronPython VS Integration: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=475830
Yes we can!
Shay.