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

Поделиться
HTML-код
  • Опубликовано: 1 июн 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
  • НаукаНаука

Комментарии • 30

  • @diegocevallos5504
    @diegocevallos5504 9 месяцев назад +15

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

  • @sandrinjoy
    @sandrinjoy 9 месяцев назад +20

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

    • @ELMlKO
      @ELMlKO 9 месяцев назад +2

      thanks xavier

  • @kezevraanwar2
    @kezevraanwar2 9 месяцев назад

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

  • @pcost
    @pcost 9 месяцев назад +1

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

  • @mostafakheder7721
    @mostafakheder7721 9 месяцев назад +1

    Wonderful thank you for your nice explanation ❤

  • @tdbnz123
    @tdbnz123 9 месяцев назад +1

    Great video
    Love from New Zealand
    Thomas

  • @antonpetrov145
    @antonpetrov145 9 месяцев назад

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

  • @freemancharles2491
    @freemancharles2491 9 месяцев назад +1

    Nice video as always, still eating my popcorn 😅❤

  • @adolfomartin5456
    @adolfomartin5456 9 месяцев назад +1

    Can we use private static variable for implement the singleton?

  • @alivaliev5152
    @alivaliev5152 9 месяцев назад

    What theme are you using? It looks gorgeous

  • @eleah2665
    @eleah2665 9 месяцев назад +1

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

  • @tasmto
    @tasmto 9 месяцев назад

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

  • @BeepBoop2221
    @BeepBoop2221 9 месяцев назад +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 9 месяцев назад +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 9 месяцев назад

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

    • @developedbyed
      @developedbyed  9 месяцев назад +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 9 месяцев назад

    does anyone know what theme he's using?

  • @anasouardini
    @anasouardini 9 месяцев назад

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

  • @jimhawkins2483
    @jimhawkins2483 7 месяцев назад

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

  • @cooltv9943
    @cooltv9943 9 месяцев назад +3

    Hi dev i'm the first one

  • @janjgaval
    @janjgaval 9 месяцев назад

    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

    • @developedbyed
      @developedbyed  9 месяцев назад +1

      Yes I will

    • @janjgaval
      @janjgaval 9 месяцев назад

      @@developedbyed you are great man 🫂

  • @juanmacias5922
    @juanmacias5922 9 месяцев назад

    Makes me think closures are just a mutation of singletons lol

  • @ThopX14
    @ThopX14 9 месяцев назад

    very funny dude 😀

  • @j.r.r.tolkien8724
    @j.r.r.tolkien8724 9 месяцев назад

    But doesn't this mean OOP sucks 😂

  • @coder_one
    @coder_one 9 месяцев назад

    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 9 месяцев назад +6

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