Live data from Hacker News

Patterns.dev

patterns.dev

11–20 of 158 posts

Re: Patterns.dev

#12
Does anyone remember the Yahoo design patterns library? It was mostly for UX pattern (eg: ways to "Rate an object") and it was really good.

Almost 20 years ago.. damn.

https://creativecommons.org/2006/02/14/yahoodesignpatternlib...

https://web.archive.org/web/20060221111812/http://developer....

They had a great comparison of the different behaviors leaderboards could encourage in users.

Re: Patterns.dev

#13
post #12

Does anyone remember the Yahoo design patterns library? It was mostly for UX pattern (eg: ways to "Rate an object") and it was really good. Almost 20 years ago.. damn. https://creativecommons.org/2006/02/14/yahoodesignpatternlib... https://web.archive.org/web/20060221111812/http://developer.... They had a great comparison of the different behaviors leaderboards could encourage in users.

Oh, the second link is amazing. I love the old web, and that brought a lot of nostalgia.

Re: Patterns.dev

#14
I wish people would stop promoting the singleton pattern: in almost every case I’ve seen, singletons are unnecessary tech debt and solve a problem that’s better solved with some form of dependency injection (and I don’t mean the XML/YAML monstrosities various frameworks force on you but rather constructor arguments or factory functions)

Re: Patterns.dev

#15

I wish people would stop promoting the singleton pattern: in almost every case I’ve seen, singletons are unnecessary tech debt and solve a problem that’s better solved with some form of dependency injection (and I don’t mean the XML/YAML monstrosities various frameworks force on you but rather constructor arguments or factory functions)

The site is not "promoting" the singleton pattern. In fact, there is a "Tradeoffs"[1] section that calls it an anti-pattern in JavaScript.

In spite of that, there are plenty of reasonable use cases for singletons in many languages, including JavaScript. For example, ES Modules are effectively singletons. If you import the same module in multiple places, it only gets evaluated once.

Let's not turn the singleton pattern into forbidden knowledge.

[1]: https://www.patterns.dev/vanilla/singleton-pattern/#tradeoff...

Re: Patterns.dev

#16

The ones that actually match POSD (deep modules, small interfaces, lower complexity) and work great with plain functions are: Module Pattern Factory Pattern (factory functions) Mediator / Middleware Pattern (as function pipelines) Hooks Pattern (custom hooks, generalized) Container / Presentational Pattern (implemented with function components + hooks) Everything else is either neutral, UI-only, or fights POSD (Singl…

What does POSD stand for?

Re: Patterns.dev

#17

I wish people would stop promoting the singleton pattern: in almost every case I’ve seen, singletons are unnecessary tech debt and solve a problem that’s better solved with some form of dependency injection (and I don’t mean the XML/YAML monstrosities various frameworks force on you but rather constructor arguments or factory functions)

Why pose DI as replacing singletons when they're used together all the time? Injecting dependencies to create a singleton repository or service class, which is shared across requests.

Re: Patterns.dev

#18
post #12

Does anyone remember the Yahoo design patterns library? It was mostly for UX pattern (eg: ways to "Rate an object") and it was really good. Almost 20 years ago.. damn. https://creativecommons.org/2006/02/14/yahoodesignpatternlib... https://web.archive.org/web/20060221111812/http://developer.... They had a great comparison of the different behaviors leaderboards could encourage in users.

Not quite the same thing, but there's this incredible (open source) project called The Component Gallery that is basically just a repository of UI components across 93 (currently) different design systems. It's an incredible resource if you're building a component from scratch and either want some design inspo or technical advice. Many of the design systems have thorough guidelines for a11y/ARIA best practices that I've learned a ton from

https://component.gallery/

Re: Patterns.dev

#19

Looks great, time to add it to my bookmarks. Anyone has other sites like these to share? - Domain-driven design, design patterns, and antipatterns https://deviq.com/ - Refactoring and Design Patterns https://refactoring.guru/ - Standard Patterns in Choice-Based Games https://heterogenoustasks.wordpress.com/2015/01/26/standard-...

I posted this elsewhere in this thread:

https://component.gallery/

Great meta resource for building UI components.

Re: Patterns.dev

#20

I wish people would stop promoting the singleton pattern: in almost every case I’ve seen, singletons are unnecessary tech debt and solve a problem that’s better solved with some form of dependency injection (and I don’t mean the XML/YAML monstrosities various frameworks force on you but rather constructor arguments or factory functions)

Off the top of my head, rails (currentattributes), Laravel (facades) especially, and most iOS apps use singletons quite well. It’s all in moderation and depends highly on how it’s used, much like every other design pattern.

I think people just don’t like Singletons because they’ve been especially misused in the past but I guarantee the same argument stands for any other design pattern.

Post reply on HN