Null Object Pattern - Design Patterns (ep 18)

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2024

ความคิดเห็น • 179

  • @sayantansengupta9939
    @sayantansengupta9939 3 ปีที่แล้ว +12

    It is sad that you stopped this series. Watched all your videos last year and really loved all of them. Coming back in 2021 with the hope that you may have uploaded new videos.

  • @piyushajmani5
    @piyushajmani5 5 ปีที่แล้ว +40

    Where'd you go? I miss you so.
    Please continue the series.

  • @renatoinnocenti
    @renatoinnocenti 6 ปีที่แล้ว +132

    Continue this series please!

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +30

      If all goes well I’ll start dropping episodes again within a month :) Thank you for the patience :) :) And your enthusiasm :)

    • @takssir
      @takssir 5 ปีที่แล้ว +3

      @@ChristopherOkhravi hi, do you have any new?

    • @samueljames7071
      @samueljames7071 5 ปีที่แล้ว +10

      @@ChristopherOkhravi yes please can you cover the MVC pattern!

    • @fadybichara
      @fadybichara 5 ปีที่แล้ว +1

      Hey Chris .. this is very helpful .. I Wish you can continue this amazing series

    • @victorbrylew1775
      @victorbrylew1775 5 ปีที่แล้ว +17

      Next episode of this series is NoEpisode. Just handle it correctly!

  • @professorfontanez
    @professorfontanez 4 ปีที่แล้ว +16

    The first time I heard of this pattern, I dismissed it immediately as dumb. Then I took the time to examine it and it literally changed my life. It is now my favorite pattern. The simplicity is genius and it makes your code some much better and cleaner.
    I recently implemented (within the last year or so) a small framework where I received models from an XML file as (JAXB) objects. I replaced nulls with Null Objects to avoid situations such as the wrong name or ID is pass and a valid model could not be found. So instead, my framework simply returns a null object and the system would not break because my null object obviously respects the interface.
    Fast forward to about a month ago. I needed to integrate this framework to interact with a legacy system that doesn't generate these models. I was able to seamlessly do it because, now my null object is used to represent the "model" of the legacy system. In order words, the legacy system has NO MODEL; which is precisely what the null object represents. This is why this changed my life. That decision around 12 months ago to put this concept in practice, even though I "didn't needed it" saved me weeks or perhaps months of additional implementation. I was able to integrate this legacy system in a couple of days.

    • @ChristopherOkhravi
      @ChristopherOkhravi  4 ปีที่แล้ว +3

      The excellent and vivid examples that you’re scattering over the comment sections truly improve the value of this TH-cam channel so let me just pause and say: thank you! Great examples 😊😊

    • @professorfontanez
      @professorfontanez 4 ปีที่แล้ว +3

      @@ChristopherOkhravi Thank you Chris. I am actually about to sit down and write about this pattern in my blog and am going to refer to this video. And trust me, it is no exaggeration when I said that it changed my life (professionally speaking of course). And one thing I didn't mention is that I wasn't the one who did the integration. Someone else on the team did. All I had to do was explain the concept in one single sentence. Two days later, integration was done.

    • @ChristopherOkhravi
      @ChristopherOkhravi  4 ปีที่แล้ว +1

      @@professorfontanez If you wish, please feel free to post the blog link as a comment here when it's done. In case it gets caught in the spam filter, let me know.

  • @claudios
    @claudios 6 ปีที่แล้ว +27

    This is awkward, I didn't get you anything for Christmas... and here you got me just what I asked for.
    Thank you!

  • @Brudof
    @Brudof 2 ปีที่แล้ว +4

    Loved these videos. I learn much better in this format vs reading on my own. Hope to see you continue this series one day.

  • @omarabdo6403
    @omarabdo6403 4 ปีที่แล้ว +1

    What a great journey! I am ETERNALLY grateful! a few weeks ago, when I started this serious I didn't know anything about design patterns but now I've already implemented many of them to my projects and I can feel the huge enhancement of technical excellency that was introduced to me and to my projects in such a short period of time. it was a shock to see this amazing serious ends although there are other patterns to be covered. I really hope you would resume this playlist even though it has been 2 years since this video. much much love and many thanks to you Christopher!

  • @dennimer
    @dennimer ปีที่แล้ว +1

    Thank you so much Christopher! I hope you will have time and energy to continue this series. It's hard to find even a payed content with such amazing quality!

  • @ZaneSelvans
    @ZaneSelvans 4 ปีที่แล้ว +2

    This was a really valuable and thoughtful series! I tried to read the Gang of Four book initially and was overwhelmed, but with this as background it's much more accessible. You're a good teacher, I hope you can find the time to return to making videos in the future!

  • @valkon_
    @valkon_ 3 ปีที่แล้ว

    You captivated me from the beginning, I could listen you for hours.

  • @shraddheshbhandari8740
    @shraddheshbhandari8740 6 ปีที่แล้ว +2

    The composite pattern NullIterator example was really good and a perfect use case. On another side note, the youtube "Skip Ad" button before a video starts playing can be another good example (that was motivated by your NullCommand discussion). This button can be disabled for like 5 seconds during which the ad cannot be skipped and thus can be represented by the NullCommand concretion during that time interval and then change its state use the SkipCommand concretion.

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว

      Wow! Excellent example! I hadn’t thought of that :) :) Thanks for sharing :)

  • @alexhelkar
    @alexhelkar 5 ปีที่แล้ว +1

    Very talented author and a great playlist! Came across these videos and can’t stop watching. Thank you so much for what you’ve already done. Please continue!

  • @TheToeFungi
    @TheToeFungi 5 ปีที่แล้ว +12

    What might be quite cool is a git repository with an example of an implementation of the design pattern being explained.

    • @cliid4355
      @cliid4355 3 ปีที่แล้ว +6

      Actually, I made one. github.com/cliid/design_pattern has all of the design patterns mentioned by Chris, and also some cool ones like Memento Pattern, and so forth.

  • @vperaltac
    @vperaltac 6 ปีที่แล้ว +8

    Excellent series, I had to learn a lot of patterns in a month and you helped me a freaking lot, this is hands down the best resource on the internet for design patterns.
    PD : You mentioned the two books so much over the series that now when i see the titles I subconsciously read it with your voice lol.
    Thank you very much Christopher.

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +2

      Hahahha that is awesome. Serious brain washing :) :) Thank you for watching and I’m glad it was useful :)

  • @akshayvenkatesh5372
    @akshayvenkatesh5372 6 ปีที่แล้ว +18

    Great stuff! Please please make a video on Visitor pattern.

  • @grayboywilliams
    @grayboywilliams 3 ปีที่แล้ว

    Thank you so much for this series! It was so helpful. You are still maybe the only person who put in this much work into explaining these patterns and I appreciate that so much.

  • @BlockDemos
    @BlockDemos ปีที่แล้ว

    I just finished this series, thank you very much, Christopher.

  • @SbeveAmogus
    @SbeveAmogus 6 ปีที่แล้ว +1

    Happy to see how your channel gets more and more subscribers. When I checked the last time it was 10k, now it’s 13k. We need videos like this

  • @bragoen
    @bragoen 6 ปีที่แล้ว

    This pattern is so difficult to make people accept, but it's helped me my whole life. Stumbled upon your playlist this weekend and I think you're doing a great job, I can now point the juniors where I work to your content. After looking it it I also want to give it a try myself for french speakers.

  • @meduto9584
    @meduto9584 3 ปีที่แล้ว +1

    Please continue Christopher ! This series was amazing !

  • @txxie
    @txxie 5 ปีที่แล้ว +1

    I really like your videos about design patterns. Continue this series, please!!!

  • @guyr989
    @guyr989 5 ปีที่แล้ว +5

    Will you continue with your videos?
    If it's about the views I can watch them a million times.

  • @kalahari8295
    @kalahari8295 2 ปีที่แล้ว

    Still the best series ever. Continue 😭

  • @krozaine
    @krozaine 5 ปีที่แล้ว +1

    This is a great series and I have thoroughly learnt a lot! Your presentation is very natural and instinctive to understand. If your ever get time, we would be glad to have more videos on design patterns. There are a few patterns left on sourcemaking.com that weren't covered here. Appreciate your efforts. Thanks a lot!!

  • @SrishtiShukla9911
    @SrishtiShukla9911 5 ปีที่แล้ว

    Hi @Christopher Okhravi your videos are great.. Kindly continue this series...

  • @plamengeorgiev1388
    @plamengeorgiev1388 3 ปีที่แล้ว

    Excellent DP for cases where you can replace IFs or other conditions,
    with SOMETHING that does NOTHING.

  • @suhastm6696
    @suhastm6696 3 ปีที่แล้ว

    Thanks for the wonderful series. I have learnt a lot from this design pattern series. Thank you Christopher.

  • @MrAceman82
    @MrAceman82 3 ปีที่แล้ว

    Both are books are great. However, I have enjoyed the video. It is very refreshing to reminder of useful patterns

  • @amitrk23
    @amitrk23 4 ปีที่แล้ว

    Thanks a ton for all the videos in this series.
    Understood different design patterns.
    Great teaching :)

  • @AndrewReeman_RemD
    @AndrewReeman_RemD 6 ปีที่แล้ว +1

    Your videos are great! Excellent examples :) Thanks for these. A video on the visitor or flux pattern would be awesome!

  • @seanbuckmaster
    @seanbuckmaster 2 ปีที่แล้ว

    Thanks for the series. It was great. Please do more.

  • @kclee8998
    @kclee8998 5 ปีที่แล้ว +1

    Thank you very much for this series.

  • @jeronimocarrizo5855
    @jeronimocarrizo5855 5 ปีที่แล้ว +1

    Thank you so much Chris for this amazing video. I love you work! please keep doing that kind of video! I really love it! Thank you so much again!!!!

  • @martinleeuwangh
    @martinleeuwangh 6 ปีที่แล้ว

    Thanks, Chris, for another great video. Happy birthday for last week, merry Christmas and a happy new year, too!

  • @ColorBaII
    @ColorBaII 5 ปีที่แล้ว

    I like this video much. Good job. I completely dived into the topic.

  • @oscardiaz9170
    @oscardiaz9170 4 ปีที่แล้ว

    I understand polimorfism now thanks to your animal example... thank you!

  • @Hassanlou
    @Hassanlou 2 ปีที่แล้ว

    @chris, do you have any plans to continue this series? BTW thanks for all your sharing knowledge not only DP but also others like SOLID.

  • @reyazahmed9320
    @reyazahmed9320 6 ปีที่แล้ว +1

    Hey Christopher, thanks for your awesome work. Please make a video on the visitor pattern.

  • @gustavomesel1637
    @gustavomesel1637 5 ปีที่แล้ว

    First of all, I gotta say your videos are amazing. I think these are the best explanations about design patterns that I have ever encountered! Awesome work.
    Now, about the Null Object Pattern, I have a question. You mention that one use of this pattern is to avoid having to check for null at every method (using polymorphism to replace conditionals), but I don't think that this will actually prevent the null checking. If you have a method that takes an Animal a (like in your example) and then you do "return a.speak()", even if there is such a thing as a "NoAnimal" subclass, it would still be possible to send null to that method, and you'd still have to do the checking (since, in some languages like c++, using null can actually crash the program). So the NoAnimal doesn't actually prevent you from doing all the null returns.

  • @diegocuencaramos8038
    @diegocuencaramos8038 2 ปีที่แล้ว

    Please more of this, is awesome!!

  • @VisualBRON
    @VisualBRON 6 ปีที่แล้ว +5

    Are you going to finish the Design Pattern videos?

  • @alexdavies4121
    @alexdavies4121 3 ปีที่แล้ว +1

    How about when integrating with other services and you have to check for a null response is a patter suitable for this, or when you check a database for a value and it is not there. I think these scenarios, conditionals are unavoidable.

  • @panosgr7228
    @panosgr7228 2 ปีที่แล้ว

    Please continue this amazing series! Maybe explain the patterns from "Design Patterns: Elements of reusable Object-oriented software"?

  • @sneha7130
    @sneha7130 6 ปีที่แล้ว +7

    Hey! Can you make a video on builder pattern?

  • @konzinovmaverick4539
    @konzinovmaverick4539 6 ปีที่แล้ว +1

    Great one dude. This made my christmas

  • @matiascasag
    @matiascasag 6 ปีที่แล้ว +1

    Thanks for all the videos! Can you make a video on builder pattern?

  • @TheMinino123
    @TheMinino123 6 ปีที่แล้ว +1

    Thank you so much for all this work. Really appreciated.

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +1

      And thank you for watching :) And for commenting. I’m glad to hear that the content is useful :) Best of luck with your endeavors!

  • @Cempa666
    @Cempa666 4 ปีที่แล้ว

    Loved all videos so far, any ETA on the next couple of videos, can't get enough :)

  • @StevenMartinGuitar
    @StevenMartinGuitar 3 ปีที่แล้ว

    Plenty more design patterns to cover 😂 loved these videos and want to see more!

  • @igormiholic2817
    @igormiholic2817 6 ปีที่แล้ว

    i really like your code walks. they're great, short and on point. these are just too long, at least for me.

  • @stanislavspatari2960
    @stanislavspatari2960 6 ปีที่แล้ว

    Great stuff, hope you'll make more series on this topic.

  • @gleisonsubzeroKZ
    @gleisonsubzeroKZ 3 ปีที่แล้ว

    this series has to continue.

  • @sketchupgoo3683
    @sketchupgoo3683 6 ปีที่แล้ว

    Hola Christopher! Te saludo desde Perú, la verdad no se si sepas español xD asi que traduciré lo que quería decirte... congratulations! I always view your videos before my classes of Computer Science in my university, and believe me. I understand every word you say Keep in that way! you are doing great! My english is not very good, so don't be rude with me with my comment! Happy New Year! and thanks a lot!

  • @manishjangra4332
    @manishjangra4332 6 ปีที่แล้ว

    hey chris...thanks for these videos on design patterns..you are really a good explainer. you make everything simple...Can you please make videos on patterns where you practically implement these patterns.?? It will be very good if you make coding examples of these patterns..thanks in advance.. Rock on

  • @armenchik_dzhan
    @armenchik_dzhan 3 ปีที่แล้ว

    this is amazing thank you for this playlist!

  • @asheshsen1
    @asheshsen1 6 ปีที่แล้ว

    Great content and if not the best, one of the best youtube videos on explaining design patterns and explaining the rationale behind it. I was wondering if you could also do videos on Refactoring. Martin Fowler's "Refactoring" book could be one option, when you have free time. Just a suggestion. Feel free to ignore. I don't mean to put any pressure or demand. Great work. Glad I found your channel and appreciate it :)

  • @hdanijel
    @hdanijel 6 ปีที่แล้ว

    again . . .beautiful!
    love your work!
    Would you consider making videos about stacks that you mention, with pop push and pointers (code included :P like always)
    also queues, linked lists and others . . .also algorithms like sorting and . . .you know.
    I love this playlist. LOVE it!

  • @jesuscruzhernandez8439
    @jesuscruzhernandez8439 2 ปีที่แล้ว +1

    #Continue this series please!

  • @nisevi
    @nisevi 6 ปีที่แล้ว

    Hi there!! Thank you for this awesome collection of videos about design patterns :) !! One thing, it would be to much to ask if you could sort the collection for starting with the latest updated first?, please. That way I don't have to scroll all the way down when I want to keep watching your videos :).

  • @vaishalijare8488
    @vaishalijare8488 6 ปีที่แล้ว

    Hi Chrish, Merry Christmas and in advance Happy New Year!
    Thanks. I learnt a lot from your videos. Could you please add video on ‘Design Pattern Cluster’?

  • @Lahiru_Udana
    @Lahiru_Udana 5 ปีที่แล้ว

    Thank you for this great series

  • @belugaaa6649
    @belugaaa6649 4 ปีที่แล้ว

    Hey Christopher okhravi, please finish these series :)

  • @Денис-ж3ф5р
    @Денис-ж3ф5р 2 ปีที่แล้ว

    Damn it's soooo easy and extremely genius!!!!!

  • @sticksen
    @sticksen 5 ปีที่แล้ว +1

    Isn´t this pattern kind of breaking Interface Segregation? Because you´re using an interface without really wanting to implement things...

  • @bsuperbrain
    @bsuperbrain 6 ปีที่แล้ว

    Please make video about the visitor pattern, make comparison builder vs. factory! So many interesting things have remained. :)

  • @angelrodriguez2259
    @angelrodriguez2259 5 ปีที่แล้ว

    Replacing conditionals with polymorphism? Sounds so cool that I must try!

  • @wittyhumour29
    @wittyhumour29 6 ปีที่แล้ว

    Hey Chris, as a self taught programmer what should I learn next (Data Structures & Algorithms) or (Design Patterns) ?
    I know/understand Object Oriented Programming :)

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +2

      I would humbly vote data structures and algorithms. More fundamental in my mind. But this playlist should give you an idea of design patterns as well without having to invest too much time :) :) Best if luck!

    • @wittyhumour29
      @wittyhumour29 6 ปีที่แล้ว

      Thank you so much 😃 , I will now go for a book on Algorithms and Data Structures & will watch your videos from the Design Pattern Series. Thanks Again !

  • @harvanharvan
    @harvanharvan 6 ปีที่แล้ว

    Thank you super much. Great video.

  • @kesavanarayana6257
    @kesavanarayana6257 6 ปีที่แล้ว

    Hi Chrish, Can you make one video on, How to handle all exception at one place in custom library where we have hundreds of classes and all are independent to each other or may be we have different groups of classes (group is nothing but may be inherited from one abstract class or interface) instead of maintaing inside each method of a concrete type.
    What are the best practices to handle this kind of scenario.

    • @FR12321
      @FR12321 6 ปีที่แล้ว

      You can have a look at AppDomain.UnhandledException for logging purposes, ie. a log file, a messagebox to the user, ...
      But otherwise, exceptions are used to indicate a failure state and you have to handle them in the calling code if you can do something about it, ie. A ConnectionRetryDecorator could handle the exception of an IConnection and retry a number of times. I don't see how you would have all your exceptions handled in the same place without creating a huge smoke factory that will be painful to debug, ie. how would you handle both a connection exception and an argument exception in the same location?

  • @cypherk
    @cypherk 6 ปีที่แล้ว

    Absolutely loved your videos, thanks a lot for these.
    What happened to the next, though?
    And for that matter, what happened to the book you mentioned you were writing a while ago?

  • @armandormikopo
    @armandormikopo 5 ปีที่แล้ว

    Hi Christopher! Excellent job with this playlist. Do you have the intention of continuing it?

  • @snigdhav7068
    @snigdhav7068 5 ปีที่แล้ว

    Thank you so much Christopher for these videos!

  • @daniellive590
    @daniellive590 4 ปีที่แล้ว

    7:30: Supplyimplementation within no animal for all methods requried by the interface of animal

  • @markomilojevic8792
    @markomilojevic8792 6 ปีที่แล้ว +11

    Hi Chris. I watched all of your videos and I have anything to say except - marvellous! I've already shared your videos to many guys, and all of them have same opinion.
    I have question. You are (maybe) the best presenter of design patterns, that I've ever seen, and I would like to see more it from you, and my suggestion would be to check patterns from second chapter in this book: martinfowler.com/books/eaa.html
    I guess this could be beyond scope for this topic, but maybe some separate playlist/topic/videos... just, do it! :D

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +1

      Thank you very much for the very kind words! And excellent suggestion! Much appreciated. I haven't read the book but I'll definitely look in to it. As you say, it probably deserves it's own playlist but either way I'll give the book a look! Thank you very much again :)

  • @ShobiPPpro
    @ShobiPPpro 6 ปีที่แล้ว

    Superb Videos.... Keep Inspiring

  • @yassineelattar5056
    @yassineelattar5056 6 ปีที่แล้ว

    Hello MasterAre there any other courses about Design Patterns coming up soon?You are doing a great Work by the way

  • @leonardoalfonso657
    @leonardoalfonso657 6 ปีที่แล้ว

    Hi man. It's possible if you can make two videos about Builder and Visitor Pattern? Thanks.

  • @wobius
    @wobius 6 ปีที่แล้ว +6

    visitor pattern would be great :)

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +1

      It will definitely come but I can unfortunately not make promises in regards to when :) Terribly sorry about the delay but thanks a ton for sticking with the channel! :) I'm glad that you appreciate the videos :) Happy hacking and thanks for commenting :)

    • @sv3167
      @sv3167 3 ปีที่แล้ว

      exactly what I was about to write! Need another great explanation of design pattern

  • @sashatyurkina
    @sashatyurkina 6 ปีที่แล้ว

    Could you please also make video explaining Visitor Pattern?

  • @piotrjaga6929
    @piotrjaga6929 ปีที่แล้ว

    Thank you!

  • @AnotherFancyUser
    @AnotherFancyUser 6 ปีที่แล้ว

    Any chance you discuss Repository Pattern with/without Unit Of Work?

  • @ahmedmahboub2199
    @ahmedmahboub2199 4 ปีที่แล้ว

    is there any hope that ..this will be completed ?

  • @bobbyr8071
    @bobbyr8071 6 ปีที่แล้ว

    Great videos Chris, please make a vid on Visitor pattern. Thx

  • @elhamnarangifard7569
    @elhamnarangifard7569 6 ปีที่แล้ว +1

    great job! I am just wondering why you havent made video on visitor DP yet!!

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +1

      Thanks :) Sorry about the long patterns break. I’ll continue the pattern series as soon as I can :)

  • @magicvortex
    @magicvortex 6 ปีที่แล้ว +1

    Will there be next one?

  • @FR12321
    @FR12321 6 ปีที่แล้ว +1

    Hey, it's a very interesting solution when the value null actually means "do nothing" but sadly it doesn't remove the need to check that a parameter is not null before using it...

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว

      Thanks a lot for the comment and for watching 🙂 🙂 If you never introduce nulls but rather instantiate a NullObject of the same type as the thing that you want to be null you can get pretty close to never having to check whether parameters are null. Or am I misunderstanding your point?

    • @FR12321
      @FR12321 6 ปีที่แล้ว +1

      What I mean is that when a method accepts a nullable it is still possible to pass it a null. So in practice, the code has to check for that in some way. To me, the null value is problematic because it breaks the inheritance tree : null can be a value of any nullable, whereas an Animal cannot be a value of type Cat (if Cat inherits from Animal)

  • @hagopvittali3465
    @hagopvittali3465 6 ปีที่แล้ว

    Chris Thank you!, Please make a video about MVC pattern! we need to discuss about it a lot!!

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว +1

      So MVC will most probably be a part of this series but unfortunately it might take a while before the video is dropped. Should drop some time during the summer though. Thanks for understanding and thanks a ton for watching the series :) :)

    • @hagopvittali3465
      @hagopvittali3465 6 ปีที่แล้ว

      Thank you my friend! we are waiting for your video about MVC, may the force be with u!

  • @neweins8864
    @neweins8864 4 ปีที่แล้ว

    Why this series is stopped? Now how would I learn? :(

  • @hugforfree
    @hugforfree 6 ปีที่แล้ว +1

    How about Chain of Responsability pattern? =)

  • @arunprasad9716
    @arunprasad9716 6 ปีที่แล้ว

    Hi can you discuss about patterns for winforms in a desktop application.

  • @auditore63
    @auditore63 ปีที่แล้ว

    Please make a video about the builder pattern

  • @B47UH4N99
    @B47UH4N99 5 หลายเดือนก่อน

    It is like "continue" structure in for,while loop. It exists but is passing loop like nothing happened.

  • @kamilwitkowski2521
    @kamilwitkowski2521 ปีที่แล้ว

    the best !!!

  • @ofpcwcef
    @ofpcwcef 5 ปีที่แล้ว +3

    OMG! Why did you stop :( ?

  • @deathkillertech
    @deathkillertech ปีที่แล้ว

    Thanks

  • @strandedinthe0737
    @strandedinthe0737 4 ปีที่แล้ว +1

    You awesome please move on, there is many another patterns, for example builder, saga, etc

  • @RS-so7ke
    @RS-so7ke 6 ปีที่แล้ว

    Hello Christopher, merry christmas. My question is if an interface method is declared to return some object, what will the Nullobject implementing that interface return on that particular method invocation

    • @khennouchefaycal2123
      @khennouchefaycal2123 6 ปีที่แล้ว

      I think the default things like if it of type a string then it will return "" (empty string) if int it will return 0 you can call them ground rules ... what do you think Christopher ?

    • @RS-so7ke
      @RS-so7ke 6 ปีที่แล้ว

      khennouche faycal makes sense and if it returns some custom object do we again return a NullObject? so what can be a base condition in this case

    • @ChristopherOkhravi
      @ChristopherOkhravi  6 ปีที่แล้ว

      I agree. If there is a sensible default value, we should probably return the sensible default. In many cases there are no sensible defaults however and in that case we should, as you say, return another null object with the same parent type as the thing that we would have returned if we had a value. Thanks to both of you for watching and commenting! :) :)

  • @이깨란
    @이깨란 4 ปีที่แล้ว

    Great!

  • @josecarlosramirez486
    @josecarlosramirez486 6 ปีที่แล้ว +2

    New video! Yay!

  • @younessfathi1739
    @younessfathi1739 5 ปีที่แล้ว

    thank you