Style Guide for Object Design: Release of the PHP edition

Posted on by Matthias Noback

The Object Design Style Guide is now available via Manning,

With a foreword by Ross Tuck

Today I've released the revised edition of my latest book "Style Guide for Object Design". Over the past few weeks I've fixed many issues, smaller and larger ones. Ross Tuck and Laura Cody have read the manuscript and provided me with excellent feedback, which has helped me a lot to get the book in a better shape. I added many sections, asides, and even an extra chapter, because some topics deserve more detail and background than just a few paragraphs. Oh, and Ross wrote the kindest of forewords to kick off the book. It's available in the free sample of the book.

The book will be available at the initial "preview release" price of 20 dollars (with a suggested price of 29 dollars) but only until April 15th. Use this link to apply the discount: https://leanpub.com/object-design/c/PREVIEW_RELEASE.

What happens on April 15th?

Over the past few weeks I've been talking with some fine people from Manning, publisher of tech books. This resulted in a contract with them. They will republish the "Style Guide for Object Design". There will be an e-book, but also a printed version, which is great.

The book currently has code samples in PHP and contains some PHP-specific suggestions, but the Manning edition will have Java code samples, and no programming language or ecosystem-specific advice, hopefully making the book useful and appealing to a larger group of object-oriented programmers. This is an exciting thing for me as a book author, because I may be able to reach more people in this way.

I know that some readers prefer to read the PHP version, so that's why the version as it is now will be available until April 15th. From that moment on, you won't be able to buy it anymore. However, if you've bought the e-book from Leanpub, you will be granted access to the Manning Early Access Program (MEAP) for the book, meaning that you will eventually be able to read the Manning/Java edition too. Once this is possible, I'll send out an email to existing readers, and update the Leanpub page with instructions for joining the program.

Changelog

If you already read (part of) the book, here's a summary of the most important changes, so you can decide if it'll be useful to download and read the new version. The full change log is in the back of the book and it includes linkes to the chapters and sections that have been updated.

  • Foreword

    • Added the foreword by Ross Tuck.
  • The lifecycle of an object

    • Rewrote the explanation about the two types of objects. What really defines these types is how they are related to each other. The first type uses the second type (services versus materials).
  • Creating services

    • Added a subsection: "Keeping together configuration values that belong together", which introduces a way to keep together configuration values that belong together.
    • Added an aside: "What if I need the service and the service I retrieve from it?", which answers a common question that was asked by the technical reviewer.
  • Creating other objects

    • Added a new section: "Don't use custom exception classes for invalid argument exceptions", explaining why you don't usually need custom exception classes for invalid argument exceptions.
    • Added an aside: "Adding more object types also leads to more typing, is that really necessary?", explaining some of the benefits of using object types instead of primitive types, just in case people are wondering if all that extra typing is really necessary.
    • Added another example to the section "Don't inject dependencies, optionally pass them as method arguments", explaining how you could rewrite the currency conversion logic using a simple services. Added a comment about the design trade-offs you have to make in this type of situation.
    • Added an aside about PHP's class-based scoping, explaining how it's possible that a named constructor can manipulate private properties directly.
    • Added a subsection "Optionally use the private constructor to enforce constraints" with an example showing how you can use the private constructor when you have multiple named constructors.
    • Finish the chapter with a new section: "The exception to the rule: Data transfer objects" about Data transfer objects, a type of object with less strict rules, which was not yet discussed in detail.
  • Manipulating objects

    • Added a new introduction, explaining the different types of "other" objects and what their design characteristics are in the area of object manipulation, covering Entities, Value objects and DTOs.
    • Add an aside: "A third-party library has some object design issues, what do I do?"
  • Retrieving information

    • Added an aside: "How do you handle ambiguous naming?", explaining how you can deal with query method names that could be read as verbs (e.g. "name").
  • Dividing responsibilities

    • Added this new chapter, which elaborates on how you can make some objects be responsible for changing state, and others for providing information. It has a new, more detailed example, which is also more realistic than the current one about a player and its position.
PHP object design Style Guide for Object Design release
Comments
This website uses MailComments: you can send your comments to this post by email. Read more about MailComments, including suggestions for writing your comments (in HTML or Markdown).
Wesley R. Williams

Its a big help if you have book for creating design. This article has a big help to us. Thanks for sharing your information.God bless!!

Łukasz

I've almost conviced my boss to buy this book for all my team members but there is a problem... I couldn't find any place to buy it - manning still don't offer your book even in meap.

Matthias Noback

Hi, thanks for convincing your boss ;) It took a little longer than I expected, but I' working hard to get ready for the MEAP. It could still take about a month before that moment though.

Łukasz

Can wait till then :) I understand that sometimes it takes longer than you expect (hello I''m a developer ;)) It's jus a pity that the best condensed programers book on the market is unavailable. I'll have to convince boss once again when it comes.

Matthias Noback

That's a great quote :)

Matthias Noback

Not sure if you've seen it already, but MEAP is available now: https://www.manning.com/boo...

Svetlozar Stoyanov

It's pity, that PHP version is not longer available...
Is it possible to buy the PHP version in any way?

Matthias Noback

I'd break my contract if I'd still sell it ;) Anyway, the new edition won't be very different (in terms of applicability for PHP devs; I'm a PHP dev myself). The code samples may be in Java, but that's really close to PHP anyway. So I really think that it should be a good buy for you when it's available later this year.

Svetlozar Stoyanov

I know, that there are not many difference, but some things in PHP doesn't exits, e.g. multiple constructors or packages. Also the most of the books are in Java and your books in PHP made the difference.

Isn't possible to agree with the publisher to have git repo with examples at least?

Matthias Noback

I'm actually in the process of discussing such a thing, I'll keep your request in mind and will make an announcement on my blog if I have more news. Thanks for sharing your wishes here!

Herminio Heredia Santos

I just bought the book and I'm excited to read it.

Matthias Noback

Cool, thanks!

Dmitry Bykadorov

Great work, Matthias!

Glad to read about your new book =)

Since you already started discussion with Manning, I think that I cant ask you about new book translation?

Matthias Noback

Thanks!
We should wait with that, yes :)