We use optional cookies for analytics and affiliate attribution. Essential cookies and marketing measurement are always on. Read our privacy policy

We just launched our Black Friday sale. You can use code BF2026 to get 25% off all subscriptions, valid until Nov 30th. There is a limit of 100 redemptions.

Logo

Nullify

What this preview is

Nullify is a cooked quant coding problem on design patterns in Cpp / Python.

Difficulty
Cooked
Topic
Design Patterns
Discipline
Quant development
Languages
Cpp / Python

Implementing the Null Object design pattern for graceful defaults

This medium-difficulty C++ and Python design-patterns problem tests whether you can recognize and apply the Null Object pattern—a structural approach that replaces absence with a well-defined do-nothing implementation. Rather than returning pointers or optionals and forcing callers to check for null, you provide a harmless instance that conforms to the interface but performs no action.

The question uses a logger factory as its vehicle: when configuration is missing or absent, instead of throwing or returning a null pointer, the factory should instantiate and return a logger that safely ignores all operations. This pattern is especially valuable in systems where optional configuration should degrade gracefully rather than fail hard. You'll need to ensure thread-safety through single allocation (likely via static instances or a cache) and careful conformance to the logger interface.

  • Object-oriented interface contracts and polymorphism
  • Factory patterns with optional/default cases
  • Memory management and single-responsibility allocation
  • Graceful degradation vs. failure modes

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.