Singleton Pattern EXPLAINED IN 10 MINS | Javascript Design Patterns for beginners

Sdílet
Vložit
  • čas přidán 1. 06. 2024
  • 💖 Check out my web development courses
    developedbyed.com
    -------------------------------------------------------------------------------------------------
    If you have put off learning javascript design patterns, or object oriented programming patterns in general, I am starting a series where I break down popular design patterns into short 10 min videos.
    -------------------------------------------------------------------------------------------------
    👨‍💻Connect with me
    Twitter: / developedbyed
    Instagram: / developedbyed
    Github: github.com/developedbyed/
    -------------------------------------------------------------------------------------------------
    📖Chapters
    00:00 Intro
    00:21 How Classes Work
    04:15 Singleton Pattern
    08:12 Refactoring from Classes
    -------------------------------------------------------------------------------------------------
    #programming #javascript
  • Věda a technologie

Komentáře • 30

  • @diegocevallos5504
    @diegocevallos5504 Před 9 měsíci +15

    This is a great idea, more pattern videos would be nice

  • @sandrinjoy
    @sandrinjoy Před 9 měsíci +20

    you can keep the instance variable as a static variable inside the class itself. which is much more clearer.

    • @ELMlKO
      @ELMlKO Před 9 měsíci +2

      thanks xavier

  • @kezevraanwar2
    @kezevraanwar2 Před 9 měsíci

    You’re teaching is so straight to the point 👍🏾👍🏾

  • @pcost
    @pcost Před 9 měsíci +1

    Really good video! I love those small knowledge pills a lot.

  • @mostafakheder7721
    @mostafakheder7721 Před 9 měsíci +1

    Wonderful thank you for your nice explanation ❤

  • @tdbnz123
    @tdbnz123 Před 9 měsíci +1

    Great video
    Love from New Zealand
    Thomas

  • @antonpetrov145
    @antonpetrov145 Před 9 měsíci

    cool video, one usecase for singleton is creating a database connections pool

  • @freemancharles2491
    @freemancharles2491 Před 9 měsíci +1

    Nice video as always, still eating my popcorn 😅❤

  • @adolfomartin5456
    @adolfomartin5456 Před 9 měsíci +1

    Can we use private static variable for implement the singleton?

  • @alivaliev5152
    @alivaliev5152 Před 9 měsíci

    What theme are you using? It looks gorgeous

  • @eleah2665
    @eleah2665 Před 9 měsíci +1

    frameworks are polluting our brains. Yes! Patterns is a good topic. Thanks.

  • @tasmto
    @tasmto Před 9 měsíci

    More of this please and OOOH I have the same wallpaper!!

  • @BeepBoop2221
    @BeepBoop2221 Před 9 měsíci +1

    One thing i hated about patterns at universities was they jusy say here are the patterns but dont show you how they are used.

  • @Xomps
    @Xomps Před 9 měsíci +2

    What are the advantages of this?
    If I export an instance of the class it works the same I think, so maybe the advantage is that it's only instantiated on demand?
    Am i missing something?

    • @SeraphicRav
      @SeraphicRav Před 9 měsíci

      Maybe when coding for IE (if it does not supports modules) or when not using modules at all

    • @developedbyed
      @developedbyed  Před 9 měsíci +1

      You are better off not using classes and take advantage of Javascripts prototypal inheritance. Like Seraphic said, you can just do modules

  • @icetmzz9074
    @icetmzz9074 Před 9 měsíci

    does anyone know what theme he's using?

  • @anasouardini
    @anasouardini Před 9 měsíci

    I don't get it; if you only need one instance, then why the construction?

  • @jimhawkins2483
    @jimhawkins2483 Před 7 měsíci

    can i ask for a desktop image?) thx in advance)

  • @cooltv9943
    @cooltv9943 Před 9 měsíci +3

    Hi dev i'm the first one

  • @janjgaval
    @janjgaval Před 9 měsíci

    can you update old tutorials How To Create a HTML Dropdown Menu | CSS Dropdown Tutorial like this with new css features or how create carousel with html css and js

  • @juanmacias5922
    @juanmacias5922 Před 9 měsíci

    Makes me think closures are just a mutation of singletons lol

  • @ThopX14
    @ThopX14 Před 9 měsíci

    very funny dude 😀

  • @j.r.r.tolkien8724
    @j.r.r.tolkien8724 Před 9 měsíci

    But doesn't this mean OOP sucks 😂

  • @coder_one
    @coder_one Před 9 měsíci

    Every time I see someone pushing class-based OOP into JS, it makes me want to cry....
    Everything you want to achieve in programming can be done by programming functionally, and it will be safer, easier to maintain and more fun to work with

    • @sonilpro8526
      @sonilpro8526 Před 9 měsíci +6

      Until you try programming something that is not a high school project