News for hackers. Stuff that matters.
Re:Why I hate all articles about design patterns (2016) by apo on Sunday March 04, 2018 @08:20PM (#16517984)
Bizarre. The article doesn't explain much about why the author hates design patterns. The best I could come up with is in this passage:

Perhaps I’m being unfair to Design Patterns, but those articles [about design patterns] seem like the worst kind of tech writing, the most likely to inspire useless discussion that doesn’t help move a team forward. Catering to software developers perfectionism tends to be bad for business. And this particular type of article seems to be the most extreme in that regard.

To recap, DP articles:

- are the worst kind of writing (still no explanation)

- likely to inspire useless discussion (sometimes play is a lie?)

- catering to perfectionism (this can be said about any tool)

The article reminds me of many folks I've met who despise analysis and planning. They're constantly getting themselves into trouble that requires quick action. When it works, the chalk the success up to their quick action. They denigrate project planning tools of nearly every stripe. They're also typically very bad communicators and don't manage time well.

But in the end, the need for quick action resulted from the immense dis-ease the person feels around planning, brainstorming, and up-front analysis. The cycle repeats on every project.

There must be an anti-pattern that describes this kind of behavior...

Re:Why I hate all articles about design patterns (2016) by peterevans on Sunday March 04, 2018 @09:39PM (#16518318)
To me, this essay read more like a troll; a mish-mash of complaints and anecdotes that don't frankly make any sense when put together. But the author succeeded in getting to the first page of HN, so–congrats?

As such, it's hard for me to bring myself to respond to any one point in the piece. It'd be quite easy for most of us to do so, but I suspect that was the intention.

Re:Why I hate all articles about design patterns (2016) by freshhawk on Sunday March 04, 2018 @08:59PM (#16518148)
I thought it was explained really clearly at the very beginning: It's what those cargo cult architecture conversations are full of. The ones where people sound smart but aren't actually designing anything useful.

I think the author might be taking it a bit too far, but they are certainly describing a real thing that I see all the time. Which is bad engineering choices made without thinking and then justified with a string of design pattern terms, used incorrectly.

Re:Why I hate all articles about design patterns (2016) by wmccullough on Sunday March 04, 2018 @09:27PM (#16518260)
> “The ones where people sound smart but aren't actually designing anything useful.”

I’ve been part of lots of teams and teams composed of great and poor levels of talent and I’ve never seen this type of behavior which you describe. Usually the folks getting up in arms over architecture are pissed because folks with experience shot down their idea for reasons of pragmatism and the individual couldn’t handle it because of ego.

Re:Why I hate all articles about design patterns (2016) by milesvp on Sunday March 04, 2018 @11:13PM (#16518671)
You may have been lucky. One of the worst messes I had to make work was nonsense a senior dev was working on up until he quit. It was a mess of object oriented wankery that soured me to even the term 'object' for years. He needed to implement 6 funtions with a couple of sql statements to do session handling in php, and instead there were factories and visitors and repositories and facades and I couldn't tell you what else this guy was thinking. He was supposed to be done, and it just needed deployment, but it ended up taking me 3 months, and a half dozen late night deployments and rollbacks before I managed to get it working. If I'd been more experienced at the time I would have ripped it all out and just implemented the 6 functions we needed, but I really assumed he'd had a good reason for the nonsense he'd written.
Re:Why I hate all articles about design patterns (2016) by josephg on Monday March 05, 2018 @12:56AM (#16519071)
Years ago I was a TA for first year computer science. I graded my students' assignments on code style, with reference to automatic grades generated by a test suite.

One of the most interesting things I learned was how much variance there was in code size between submissions. I would first read an assessment from a good student which was completely correct and 500 lines long. The code would seem reasonably clear, compact and well written. Then I'd pick up the next assignment, which had also gotten 100% on the automatic tests and it would be only 150 lines of code. And the code wouldn't seem any more compact or unreadable compared to the first - they both looked like decent solutions; but one of those solutions had implemented the same spec in 3x less code!

And then I'd pick up a submission by a weaker student who got 50% of the automarking results done. The submission would be 600 lines, and you could see the sweat that had gone into writing it. The student was clearly struggling to keep track of all the moving parts in their code. If that was all I looked at I would have assumed the assignment would have taken 1000 lines to implement, and be way too hard for my first year students.

(In case you're wondering, there was no difference in programming languages, tooling or knowledge. All students were using the same environments to write plain C code.)

The lesson I learned was that its very hard to tell whether you or your coworkers are actually using a good approach to solving your problems. I never hear people say things like "Oh, I think this different abstraction could save us 70% of our code". But having seen enough examples I think its usually the case that those abstractions exist. We just (bizarrely) don't seem to spend any time looking for them. Intuitively I would expect that bad abstractions would be obvious in code, but that seems to be often not true in practice. After reading the first students' submission I usually would still have no idea how long the average correct submission was going to be.

Re:Why I hate all articles about design patterns (2016) by watwut on Monday March 05, 2018 @03:28AM (#16519607)
It seem clear to me that both students described in second paragraph produced good code, although the shorter one was better. The second paragraph student was clearly behind them. It just does not seem hard.

I heard colleagues say "if we split this away, join these two classes into one and hide it under interface, it will be simpler/shorter". The word abstraction was not used, but it was abstraction they were talking about.

So maybe it depends on local culture, whether people talk about how things are done overall or whether they focus on idioms only.

Edit: fixed typo in clearn/clear

Re:Why I hate all articles about design patterns (2016) by geezerjay on Monday March 05, 2018 @10:19AM (#16521561)
> instead there were factories and visitors and repositories and facades and I couldn't tell you what else this guy was thinking.

Factories: generate objects whose type can freely change. See polymorphism.

Visitors: create any operation you'd like to implement without having to change a type. See open/close principle.

Repositories: separate SQL voodoo from your code and establish a dedicated component to handle database transactions.

Façade: isolate the world from all the gory detail in a manner that you are free to change both the component and its clients. See separation of concerns.

I find it more worrying that the code developed by a senior developer was dumped just because the junior developer who replaced him was entirely clueless and not obly unable to understand existing codebut also unable to even grasp basic design problems that justify the senior developer's decision.

Recommended reading: https://en.m.wikipedia.org/wiki/Wikipedia:Chesterton%27s_fen...

Re:Why I hate all articles about design patterns (2016) by milesvp on Thursday March 08, 2018 @01:24PM (#16546381)
I find it more troubling that someone would think they needed any of these patterns to implement php sessions.

What you fail to grasp was the code was so completely unnecessarily complicated that it introduced a fuckton of subtle bugs that were difficult to track down. Things would look like they're working, and then reports of terribly broken behavior forcing an emergency rollback followed by days of trying to figure out what bullshit state things were in to repro the problem.

Worse, is so much of the code was some misguided attempt to future proof the code in ways that make no sense. When your code will never have more than a couple dozen simple sql queries you will never benefit from a polymorphic sql class intended to allow the swapping out of your sql backend with another vendor. It's easier just to rewrite that small piece of code when the time comes.

Just because you can implement fizzbuzz using a dozen design patterns doesn't mean the problem actually requires it.

Re:Why I hate all articles about design patterns (2016) by itronitron on Sunday March 04, 2018 @11:49PM (#16518802)
that reminds me of all the EJB/JBoss/Spring nonsense that soured Java for a lot of people... presumably it was a necessary step but it would have been nice to just skip ahead to web services
Re:Why I hate all articles about design patterns (2016) by watwut on Monday March 05, 2018 @03:28AM (#16519608)
Web services are done with spring now.
Re:Why I hate all articles about design patterns (2016) by itronitron on Monday March 05, 2018 @08:07AM (#16520751)
If anyone has written a review of the current state of the art with spring and web services I would be interested to read that.
Re:Why I hate all articles about design patterns (2016) by rosser on Sunday March 04, 2018 @08:34PM (#16518039)
> There must be an anti-pattern that describes this kind of behavior...

Well, the anti-pattern that describes this kind of logic is the Straw Man. If all Design Pattern articles were theoretical blah blah blah, The Fine Article might have a point. They aren't. Not even the majority. As long as we just point to the (bad) minority, and act as if they're representative of the whole, then we can continue to hate all articles about design patterns, and play — because this is just as much a form of "play" as the "learning" or "avoiding" techniques being decried — in our preferred, and specifically unstructured way.

Re:Why I hate all articles about design patterns (2016) by euske on Sunday March 04, 2018 @09:28PM (#16518265)
Can you pick one DP article that seems good to you, please? I won't complain about the article you'll mention. In both OP and your comment, the lack of a concrete example irks me.
Re:Why I hate all articles about design patterns (2016) by geezerjay on Monday March 05, 2018 @04:05AM (#16519719)
It seems to me that those making blanket statements on how design patterns are bad or useless are actually the ones who have an obligation to support their baseless assertions. Meanwhile, it seems rather obvious that similar problems can be solved by similar solutions, and experience derived from solving those frequent problems can be levetaged to avoid reinventing the wheel every single time that very same design problem pops up. These solutions have a name: design patterns. It boggles the mind how some people insist in claiming that reusing tried and true solutions is useless.
Re:Why I hate all articles about design patterns (2016) by couchand on Sunday March 04, 2018 @10:41PM (#16518578)
All of Ward's Wiki.
Re:Why I hate all articles about design patterns (2016) by mcphage on Sunday March 04, 2018 @10:37PM (#16518564)
> The article doesn't explain much about why the author hates design patterns.

The author doesn’t hate design patterns. They hate articles about them.

Re:Why I hate all articles about design patterns (2016) by itronitron on Sunday March 04, 2018 @11:55PM (#16518825)
personally, I can't stand to read any article about an 'MVC variant' that has some new idea for how to delineate the difference between model, view, and controller
Re:Why I hate all articles about design patterns (2016) by beobab on Monday March 05, 2018 @04:12AM (#16519743)
This. I spent a good long while trying to find out how I was "supposed to do it", only to find out "there are loads of ways", and "it depends".

This left me feeling like nobody really knew, and that everyone was just chucking dirt and hoping it stuck.

Re:Why I hate all articles about design patterns (2016) by geezerjay on Monday March 05, 2018 @04:32AM (#16519838)
It's not that nobody knows. It's as some frameworks prefer to shoe-horn the MVC pattern to their particular implementation which has some nuances, and therefore prefer to create a whole new jargon to dance around that fact. In some cases there are even frameworks who force gui responsibilities onto the model and don't even provide any controllers and yet still feel entitled to call what they did as MVC.

Meanwhile,

Re:Why I hate all articles about design patterns (2016) by YouKnowBetter on Monday March 05, 2018 @04:30AM (#16519830)
Or as a friend of mine would put it: Coding is closer to art then to sience, and briliant code more like poetry then math.

I've been in this industry for over 35 years. On dark days I'd give my left leg for working templates and strickt design patterns. On good days I love the close to absolute freedom we have.

Re:Why I hate all articles about design patterns (2016) by skizm on Sunday March 04, 2018 @08:34PM (#16518041)
I think the author was saying he hates articles about design patterns, not the actual patterns themselves.
Re:Why I hate all articles about design patterns (2016) by Can_Not on Monday March 05, 2018 @08:28AM (#16520871)
> There must be an anti-pattern that describes this kind of behavior...

Sounds like a cowboy coder.