ab4n
trav
@techsavvytravvy
Nov 8
so many forget about this or call it an "antipattern" but they really just don't understand
Nov 8, 2025 · 10:59 AM UTC
106
9
10
567
SLOMP 🦄
@ssslomp
Nov 8
Replying to
@techsavvytravvy
that's called a singleton and it is mostly Bad
15
14
trav
@techsavvytravvy
Nov 8
see
2
2
38
more replies
rwillians.{ex,js} 🧠🌈8
@rwillians_
Nov 8
Replying to
@techsavvytravvy
might as well 👇
2
30
trav
@techsavvytravvy
Nov 8
trav
@techsavvytravvy
Nov 8
Replying to
@ssslomp
see
5
Joel 🇦🇺
@ptr_to_joel
Nov 8
Replying to
@techsavvytravvy
you’re gonna love this
openjdk.org/jeps/526
1
1
5
trav
@techsavvytravvy
Nov 8
seems pretty neat
2
Lewis
@ctjlewis
Nov 8
Replying to
@techsavvytravvy
are you afraid of constructors? why not just always initialize it once?
1
9
trav
@techsavvytravvy
Nov 8
there's a constructor right there! i generally dislike constructors tho bc they have weird constraints like can't be async and can't be overloaded
2
10
more replies
⚡️John Andrew Owen ⚡️
@JohnAndrewOwen
Nov 8
Replying to
@techsavvytravvy
mfw instance is public
1
43
trav
@techsavvytravvy
Nov 8
it's fiiine
10
Gregory
@_studable_
Nov 8
Replying to
@techsavvytravvy
psh, static
1
2
GIF
trav
@techsavvytravvy
Nov 8
pretty good
2
Pangz (pangz.vrsc@)
@PangzLab
Nov 9
Replying to
@techsavvytravvy
Why do you need an instance if you're defining a static Logger. Why do you even need to initialize?
1
trav
@techsavvytravvy
Nov 9
believe it or not, this code is simplified and an actual logger class would probably have methods for logging
Cal Irvine
@Cal_Irvine
Nov 8
Replying to
@techsavvytravvy
I’d probably use a private instance + use a getter. private static _instance static get instance{}
1
1
trav
@techsavvytravvy
Nov 8
could absolutely do that
1
2
more replies
Ryan Brown
@ryan_t_brown
Nov 9
Replying to
@techsavvytravvy
Singleton? Literally nobody does or says that. 😂
1
trav
@techsavvytravvy
Nov 9
demonstrably false just by lookin at the comments here
1
3
more replies
РотатоФюгег
@swooshclick
Nov 8
Replying to
@techsavvytravvy
This is ts/js you can have a single anonymous instance, no need of this pattern.
1
trav
@techsavvytravvy
Nov 8
trav
@techsavvytravvy
Nov 8
Replying to
@ssslomp
see
J0nny🥳
@Jonath4nH
Nov 8
Replying to
@techsavvytravvy
imagine only having one Logger tho , u gotta make an interface so u can provide a TestLogger ,ConsoleLogger, BackendLogger ... etc 😤
1
1
trav
@techsavvytravvy
Nov 8
class is the interface
1
2
more replies
Prisma Postgres
@prisma
Nov 7
Build faster with Prisma's managed Postgres
Get Started for Free — Prisma Postgres
prisma.io
1
33
Load more