3 ms·
Design patterns are on my reading list, but these days that list is much larger than my available free time. I agree with you, actually. My point wasn't that t
by thaumaturgy 19y ago
Design patterns are on my reading list, but these days that list is much larger than my available free time.
I agree with you, actually. My point wasn't that the design patterns themselves are wrong, or necessarily bad, it was that (I think) they'll tend to get used in situations where the programmer doesn't understand the immediate problem or solution well enough to deal with it directly.
Anecdotally, this came up somewhat recently when the question of whether or not it's "OK" to return early from a function got briefly passed around the net. I noticed a lot of instances where people were coming up with some pretty absurd reasoning to justify always doing it one particular way, the 'textbook' way if you will.
Myself, I think it's _sometimes_ OK to return early from a function. It depends on what you're doing. You have to understand the situation you're looking at, and all of the various circumstances around it.
So, the idea of "never return early from a function" isn't necessarily wrong, but it does indicate that the programmer probably doesn't really understand what they're doing.
- Tichy 19y agoIt's been a while that I read it, but I thought the original "Design Patterns" book was pretty good. You won't find something like the "return early from function" in it. I think it is best to read the original design patterns book, not the language specific clones (ie not "Design Patterns for Java" etc). Most patterns in the book are not that trivial, so I don't think you can apply them without understanding them (in general).