null-object-pattern
Trying to refactor to Null object pattern but the end result seems worse
I\'m refactoring a big class that has a lot of checks for null all over the place into using the null object pattern. So far it\'s been an almost smooth change but I am having a couple of issues with[详细]
2023-03-31 16:53 分类:问答null pattern and composite pattern don't play nice together
In this composite tree I am keeping a reference to the parent node for flexible tree traversal.I don\'t want to have to check the parent for a null reference all the time but if I make a NullNode clas[详细]
2023-03-14 16:40 分类:问答Just for fun - can I write a custom NilClass for a specific use?
EDIT | Or another question, on the same object subject.Can I write my own class definition that would cause the following all to work?[详细]
2023-03-04 06:01 分类:问答Get a dummy slf4j logger?
Can I get a dummy logger from slf4j? (Think the null object design pattern.) If so, can someone provide an example? Or will I have to implement a custom logger if I want to do that?[详细]
2023-02-19 09:24 分类:问答Null pattern with QObject
(C++/Qt) I have a smart pointer to a QObject. Let\'s say a QWeakPointer. For some external reason (something that might happen in another object or due to an event), it is possible that the pointed ob[详细]
2023-01-14 08:59 分类:问答Is it feasible to create a NullObject for every class? ( with a tool of course )
The NullObjectPattern is intended to be a \"safe\" ( neutral ) behavior. The idea is create an object that don\'t do anything ( but doesn\'t throw NullPointerException either )[详细]
2023-01-07 06:14 分类:问答Good case for a Null Object Pattern? (Provide some service with a mailservice)
For a website I\'m working on, I made an Media Service object that I use in the front end, as well as in the backend (CMS). This Media Service object manipulates media in a local repository (DB); it p[详细]
2022-12-25 23:11 分类:问答How can i implement the NULL Object Design Pattern in a generic form?
Is there a way to implement the null object design pattern in a generic form so that i don\'t need to implement it for every buisness object.[详细]
2022-12-25 04:54 分类:问答Behavior of a controller action on reception of a null dto
When a controller detects that a DTO passed t开发者_如何转开发o it is null should it instantiate an instance of the DTO (cf the Null Object Pattern), or should it simply throw an exception there and t[详细]
2022-12-14 03:31 分类:问答Fowler Null Object Pattern: Why use inheritance?
Why does Fowler PoEAA p. 498 define the null-object pattern in the following way (sample shortened, language is c# but doesn\'t matter):[详细]
2022-12-10 21:08 分类:问答