The Factory Method Pattern in Ruby

The Factory Method Pattern might be somewhat hard to understand at first, mainly because you probably don't need it as often. Nevertheless, it's good to know about it and use it whenever you feel it's appropriate.
👉 Buy my Bulletproof Ruby on Rails Applications eBook: j.mp/2OtFCdR
🍿 The Abstract Factory Pattern: • The Abstract Factory P...
🍿 Ruby design patterns playlist: • Design Patterns in Ruby
You can subscribe to the channel using this link: kzread.info?sub_...
Read it instead: mixandgo.com/learn/ruby/facto...
My website: mixandgo.com
en.wikipedia.org/wiki/Factory...
If you want to learn more about design patterns, check out these two books.
📖 Design Patterns: Elements of Reusable Object-Oriented Software: amzn.to/3vZ7sjp
📖 Head First Design Patterns: Building Extensible and Maintainable Object-Oriented Software 2nd Edition: amzn.to/3bvBiCF
#webdev #ruby #designpatterns #factorymethod

Пікірлер: 26

  • @mxc_clips
    @mxc_clips2 жыл бұрын

    Thank you for posting these videos. Seems there arent many Ruby/Rails channels but this was just what I was looking for! Keep up the great work 👍

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    You bet.

  • @jaydippansuriya5003
    @jaydippansuriya50032 жыл бұрын

    Thanks for your Amazing content. Looking forward for so many Rails video.

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    You're welcome. Keep an eye on the channel. I'll post a lot more content on both Ruby and Rails.

  • @harryuan65
    @harryuan652 жыл бұрын

    This video is very helpful. Thank you for the great content!

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    Happy to hear Harry

  • @CharlesDv
    @CharlesDv Жыл бұрын

    This is exactly what new developers need. There are already too many videos about CRUDs.

  • @mixandgo

    @mixandgo

    Жыл бұрын

    Thank you Charles. I apreciate the feedback.

  • @rjurado5867
    @rjurado58672 жыл бұрын

    Thanks for your work !!

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    My pleasure.

  • @shriharikulkarni07
    @shriharikulkarni07 Жыл бұрын

    This is very good. We need more vidoes on building patterns. Thanks for the videos

  • @mixandgo

    @mixandgo

    Жыл бұрын

    Thank you

  • @CHACHANUS
    @CHACHANUS2 жыл бұрын

    thanks a lot !!!

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    Happy to help.

  • @santaclause1988ify
    @santaclause1988ify2 жыл бұрын

    You're calling an instance method(UserFactory#call) on the class which will raise an exception #=>#NoMethodError

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    You are correct. Thanks pointing it out.

  • @hrishabhpatidar9868
    @hrishabhpatidar9868 Жыл бұрын

    Nicely Explained! Line#20 should be contact method not home.

  • @mixandgo

    @mixandgo

    Жыл бұрын

    Thanks

  • @maheshgvp7735
    @maheshgvp77352 жыл бұрын

    Why call method is not declared as self? Why not just create a module called UserFactory and include it in required places?

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    Hi Mahesh, good catch. It would be better if it were a class method because there is no reason for it to be an instance method. As for class vs. module, I personally prefer it to be a class because: 1) I can use the class name to indicate what it is 2) I don't want to make that responsibility part of the client class' behavior (it's a different responsibility) 3) Helps me see dependencies better when I look at the client code I hope that helps.

  • @darkpill
    @darkpill Жыл бұрын

    3:15 you should consider making your videos mobile friendly. You are using 10% of the available screen making it impossible to read on a phone.

  • @mixandgo

    @mixandgo

    Жыл бұрын

    Thanks for the suggestion.

  • @nathangwyn6098
    @nathangwyn60982 жыл бұрын

    are you hiding my comments? I would love to help add content to your site.

  • @mixandgo

    @mixandgo

    2 жыл бұрын

    no one is hiding your comments :)

  • @nathangwyn6098

    @nathangwyn6098

    2 жыл бұрын

    I'm a self teaching junior wannabe' (ror) software developer. I noticed a few of your links were broken on your web app. Is there any chance I could help out with content?

  • @chalmagean

    @chalmagean

    2 жыл бұрын

    @@nathangwyn6098 thank you, but I don't currently accept guest posts on my blog.