Thursday, October 2, 2014

1st of 3 Books That Changed My Life: @unclebobmartin's Agile Principles, Patterns, and Practices in C#

I was thinking lately that from all the books I've read related to my professional life and career, there are three that stand out. I can not decide which one had a bigger impact because each effected a different part of my life. So there is not one better than the other. I will write three blog posts about each book. They will be presented in the chronological order I read them.

-------------------

I started reading Robert C. Martin's Agile Principles, Patterns, and Practices in C# about one year after I started working for Syneto. At that point, I had more than five years of programming experience and I was quite familiar with many concepts.

However, in almost all my career I worked alone. There was no chance to me to interact with other programmers, to find out about new and cool stuff from others directly. I've heard about Agile and Extreme Programming, but when you work alone you see things differently.

I could not find any satisfying online documentation back then, and there was nobody to recommend me the right books to read.

This lone programmer figure had to go under a major rework after I've got to Syneto. Suddenly I was surrounded by programmers with whom I had to collaborate. Fortunately for me, I worked with people for a long time, so the social side of the integration went well. And with social development came teachings and recommendations and a huge flood of information exchange. One of the books recommended both by colleagues and managers was Robert C. Martin's Agile Principles, Patterns, and Practices in C#.

This was not the first book I've read at Syneto. Not even the second one. It was just "the next book to read" on a long list after a year or so of intense personal and professional development. All the previous books were important and had a great impact, but none of them changed more the way I write code than this one.

Because Robert C. Martin's Agile Principles, Patterns, and Practices in C# had a profound impact on how I write code, I nominate this book one of the three life changers.

Before this book I was thinking about the structure of my code in a naive way. I had my personal experience, I heard about and knew a couple of design patterns, I even knew the basics of code structure and form.

So how this book changed the code that I commit to the version control system every day?

  1. My methods are less than 4 lines long. On average they are 2 lines long. Some methods are still huge and they may have 10-15 lines of code. But they are so rare, that they don't affect the statistics very much.
  2. My architecture is decoupled.
  3. My dependencies are inverted.
  4. My classes have a high cohesion. I once actually managed to create a class, together with +Vadim Comanescu, that we considered a perfect class: 6 public method and 6 private variables. All methods were using all private variables.
  5. I made naming things right one of my top priorities. Rarely can I write a method name that is not changed at least 3 times before the code is committed.
  6. I use design patterns in a much better informed fashion. The book helped me understand them better, and especially to understand possible use cases and scenarios.
  7. ... I could continue with other reasons. But I will stop now. I think these alone are enough. No need to write up another ten or so of them.
That is why I consider this book "The Programmer's Bible". Each software developer, regardless of the programming language or paradigm he or she uses, must read this book. It is quite long, about 600 pages, but it is not a difficult read. Robert C. Martin has a great talent to keep you hooked. I remember that some design patterns were so exciting stories that I just could not stop reading.

So, what are you waiting for, find a copy this extraordinary book and read it.

No comments:

Post a Comment