Lee Kelleher

Elegant Objects by Yegor Bugayenko

Posted on

At last month's Code Cabin, I was chatting with Steve Temple about Ditto and best coding practices, he suggested that I read Elegant Objects by Yegor Bugayenko, as it made him think totally differently about object-oriented programming.

Lee with Elegant Objects book

Looking around Yegor's blog, I liked his ideas, so I ordered the book ... I even noticed a small CSS bug on his blog and submitted a fix for it. I do love open-source!

A day or so later the book arrived and I couldn't put it down. The blurb on the cover says it all...

TL;DR There are 23 practical recommendations for object-oriented programmers. Most of them are completely against everything you've read in other books. For example, static methods, NULL references, getters, setters, and mutable classes are called evil.

I started coding with BASIC (on a Spectrum 48K) as a kid, then "professionally" as a web-developer since 2000 doing Classic ASP/VBScript. The vast majority of my coding comes from a procedural background, I knew I had bad habits when doing OOP, but oh boy, whilst reading the book I had no idea how much I was "doing it wrong".

The book has many principles that I agreed with in theory, but I wasn't sure how I would practically apply them. The majority of the development I do is with C#/.NET and Umbraco CMS implementations, where most of the anti-patterns (as outlined in the book - such as returning null object values) are a common occurrence.

Given the insight into how to develop clean, maintainable object-oriented code, I feel that I can at least improve on my own application and library code.

If you are an open-minded developer, who is looking for new and thought provoking ideas, I would definitely recommend this book.

Volume 2 of Elegant Objects is due out at the end of the year, see Yegor's website for updates.

Elegant Objects book cover