Several years of SOLID-aware development

Jasper Stafleu (30.Jun.2017 at 13:30, 45 min)
Talk at Dutch PHP Conference 2017 (English - US)

Rating: 3 of 5

At some point in our career, we have all written code that we considered good, but needed full code replacement later on, even though the functional change requested was very small. When this occurs, it is often an indication of lack of either understanding or correct application of the SOLID principles.

Several years ago, I attended a talk on the principles, and it prompted me to try to be more aware of applying them to my code. From this I learned several lessons, the most important one being that almost no one takes the time to determine if they apply them at all, let alone correctly. It caused me to add an additional iteration to all my coding and code-review in which I actively ask the question: “Is it SOLID?”

But simply knowing the SOLID principles is not enough; you need to understand the why and how as well, which are actually a lot harder. These are important as the principles themselves are somewhat open for interpretation, which complicates applying them significantly. In this talk, I won’t focus on each of the principles themselves, but I’ll use examples of breaking two of the lesser understood ones and the problems this causes to highlight the reason why SOLID development is so important.

Who are you?

Claim talk

Talk claims have been moved to the new Joind.in site.

Please login to the new site to claim your talk

Want to comment on this talk? Log in or create a new account or comment anonymously

Write a comment

 
Please note: you are not logged in and will be posting anonymously!
= five minus one

Comments

Rating: 4 of 5

30.Jun.2017 at 14:20 by Max Roeleveld (10 comments) via Web2 LIVE

A more detailed look at two of the SOLID principles. Not a beginner's overview.

Rating: 3 of 5

30.Jun.2017 at 14:33 by David Higler (9 comments) via Web2 LIVE

An indepth talk with some good insights.
Tips: Try to speakup a bit more flowing english. And also give some examples of hou you should do it.

Rating: 5 of 5

30.Jun.2017 at 14:41 by Steven Gerritsen (8 comments) via Web2 LIVE

Great talk

Rating: 1 of 5

30.Jun.2017 at 16:10 by Anonymous


Rating: 4 of 5

30.Jun.2017 at 16:41 by Jip Spinnewijn (3 comments) via Joind.in iPhone app

Very interesting talk with clear examples. I did not really understand the problem with the abstract factory though and final classes should be no problem when mocking interfaces instead of concrete classes ?

Rating: 1 of 5

30.Jun.2017 at 17:39 by Jeroen v.d. Gulik (78 comments) via Joind.in iPhone app

Interesting talk but I have to say I disagree with a lot of the examples. Specifically the Dependency Inversion examples didn't seem to actually be about dependency inversion. I missed examples about Dependency Injection, and more specifically about trade-offs when to apply SOLID principles

Rating: 1 of 5

30.Jun.2017 at 19:27 by Youri Thielen (23 comments) via Web2 LIVE

To be honest, I expected more from this talk. A few things I would like to point out:
- Dependency Injection Principle was used where Dependency Inversion Principle was meant. They are related but not the same.
- When you talked about the open/closed principle, focus was a lot on the PHP language keyword 'extends'. The "open for extension" part of the open/closed principle is actually about the concept of changing a class'/module behaviour, this can be done trough extending a class but composition should be preferred. "Composition over inheritance" was not mentioned.
- The Liskov examples were pretty much spot on
- The examples regarding DIP were not that great to be honest. They missed the essence of the DIP principle. Also, the examples could have been a lot simpler.
- There are good reasons to use the final keyword in PHP. Also, don't mock what you don't own (regarding your complaint about not being able to mock a Doctrine class)
- Suggesting not to use the private keyword was not backed by a good reason.

Rating: 2 of 5

30.Jun.2017 at 21:44 by Erik de Bos (19 comments) via Web2 LIVE

I expected a more in depth evaluation of SOLID, with practical examples. Instead this was a rather basic walk-though of the principles.

Rating: 2 of 5

30.Jun.2017 at 21:55 by Tom den Braber (16 comments) via Web2 LIVE

I agree with Youri Thielen's comment.
In addition, you somewhere mentioned about using @throws annotations that it does not matter whether you name a specific type or just 'Exception'. In my opinion, this is not a very good idea. If an exception is annotated by its exact type, it can be caught by exactly that type (assuming that the one who writes a corresponding try/catch clause looks at the @throws annotation). In that way, you don't have the risk of catching exception you did not expect (in contrast to the situation when using 'Exception' or 'Throwable' in your catch clause.)

To end on a more positive note: somewhere in the talk you mentioned that 'you should not be using the "extends"-keyword too much', and I can only agree to that.

Rating: 1 of 5

30.Jun.2017 at 23:23 by Pulkit Swarup (7 comments) via Web2 LIVE

Talking about SOLID Principles and choosing the right examples to explain the principles is a really tricky.

Although, the presentation started on a right note picking up principles which are least understood and discussed, but there is a reason i.e. the right examples and that was precisely which was missing.

Rating: 2 of 5

01.Jul.2017 at 15:44 by Peter Meijer (14 comments) via Web2 LIVE

I was expecting a different talk based on the title. Not a 'recap' of SOLID.

Rating: 3 of 5

01.Jul.2017 at 20:38 by Deniz Zoeteman (8 comments) via Web2 LIVE

Okay talk, was interesting to hear these opinions, and I agree on some points. However, it would have been nice to have some solutions given to the problems talked about.+

Rating: 4 of 5

03.Jul.2017 at 09:45 by Niels van Esch (26 comments) via Web2 LIVE

a solid (pun intended) talk on some of the less understood parts of SOLID. It had a few misunderstandings of the finer details of the the principle in it, but these were negligible. Talk was given with good energy

Rating: 2 of 5

03.Jul.2017 at 10:59 by Vladas Dirzys (15 comments) via Web2 LIVE

The presenter looked confident. Also I think it's good idea not to talk about every SOLID principle in depth but only about the chosen ones. However, the given examples didn't make much sense. In addition on how not to do it, the presenter could have had examples of how to do it.

I had serious doubts if the presenter really understands the DIP (and others). I would like to look at the examples and try to analyse them again, but can't find the slides.

Rating: 1 of 5

04.Jul.2017 at 10:39 by Marcos Loureiro (24 comments) via Web2 LIVE

I'm not a guru, but that were parts that actually I'm afraid of those who took you seriously, like
- fixing bugs by extending
- final keyword is bad
- don't use private variables (really?)
- cannot mock Doctrine due to the way they do the Query object
(rule of thumbs, don't mock what you don't own, make integration tests for the parts that touch plugins/libraries/bunbles/... and then mock those services for your own code)

Rating: 3 of 5

10.Jul.2017 at 09:54 by Maarten van Middelaar (9 comments) via Web2 LIVE

It was a nice overview with emphasis on the two less understood principles. I was expecting a bit more examples and experience based on the title though.

© Joind.in 2017