I was so pleased when I found this video. You have clearly explained in just 30 minutes what I have always struggled to put into words. Now I can just point them here instead.
@user-hu1jr6fb9k4 жыл бұрын
13:49 why is $transferDate beeing cloned while $amount is not?
@MarcoPivetta3 жыл бұрын
Forgot to say it there, but Money is already an immutable (at least common implementations in the wild)
@iancroasdell6 жыл бұрын
Defensive driving is like defensive coding ... great stuff
@TheMarkokene7 жыл бұрын
Did he start with "Prolly" ?
@jamesfurey7 жыл бұрын
Great talk! Thank you. :)
@dennismatveyev75487 жыл бұрын
copy paste is better than extend? Explain! Copy paste leads to violating DRY.
@shaunfreeman60567 жыл бұрын
Dennis Matveyev how about using traits, that's like a reusable copy/paste and does violate D.R.Y
@dennismatveyev75487 жыл бұрын
I have used traits and have seen it described as language-assisted copy and paste, but it is correct that it does not violate DRY, since it has one source copy and every other class just refers to it from afar, like a pointer
@MarcoPivetta6 жыл бұрын
DRY is about not repeating concepts, not about not repeating implementation: if you have the concept of "discount" twice in your system, that's obviously going to be a problem if they run out of sync, but repeating implementation details that are not part of the public API is OK and endorsed. Copy-paste is still better than a bad abstraction, and no, traits are to be avoided as well (explained in a newer version of this talk).
@loupax6 жыл бұрын
Interfaces are used to share design concepts Classes are used to share features Traits are used to share code When DRY mixes those up it causes more problems than it solves IMHO
@MarcoPivetta6 жыл бұрын
@@loupax and where would you share code? To me, most (if not all) traits can and should be replaced by external collaborators or pure standalone functions. Sharing the code leads to a lot of scope sharing bugs, and difficult to isolate code, which is also hard to test. EDIT: I just noticed that this is the very first version of this talk of mine. In newer versions, I clearly state that traits should not be used.