← Zip Interview Insights

Zip·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Apr 2026Remote

Summary

Ziphq software engineer interview that was basically one long design problem: build a composable condition evaluator from scratch. The kind of question that sounds manageable until you're 20 minutes in and realize they want the whole thing, AST nodes, evaluation logic, error handling, tests, extensibility discussion, all of it.

Questions Asked (1)

Q1

Design and implement a composable condition evaluation system where conditions are represented as an AST with atomic predicates (equals, greater-than, contains) and composite nodes (And, Or, Not), supporting programmatic construction, an evaluate(record) method, error handling, and test coverage.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This was a meaty one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the AST node types (atomic predicates and composite nodes) with a common interface. Then describe the evaluation logic, error handling, and testing strategy, emphasizing composability and extensibility. Finally, discuss trade-offs and potential optimizations.

Pro tip: Mention that you would use the Composite pattern and consider short-circuit evaluation for And/Or nodes to improve performance. Also, highlight the importance of separating construction from evaluation to enable serialization and reuse.

1. Clarify Requirements and Scope

Ask clarifying questions about the types of records, expected predicates, error handling expectations, and performance requirements. Confirm whether the system needs to support serialization or a DSL.

2. Design the AST and Interfaces

Define a common Condition interface with an evaluate(record) method. Create atomic predicate classes (Equals, GreaterThan, Contains) and composite classes (And, Or, Not) that hold child conditions.

3. Implement Evaluation and Error Handling

Implement evaluate for each node: atomic nodes compare record fields; composite nodes recursively evaluate children. Use short-circuiting for And/Or. Handle errors like missing fields or type mismatches by throwing exceptions or returning error results.

4. Ensure Testability and Coverage

Write unit tests for each node type, including edge cases (null values, missing fields, type mismatches) and complex nested conditions. Use parameterized tests to cover combinations.

5. Discuss Trade-offs and Extensibility

Talk about design choices: immutable vs mutable nodes, error handling strategies (exceptions vs result objects), performance optimizations (caching, indexing), and how to add new predicates or composites without modifying existing code.

Key Points to Mention

  • Composite pattern for uniform treatment of atomic and composite conditions
  • Short-circuit evaluation for And/Or nodes to optimize performance
  • Error handling strategies: exceptions vs. result objects, and how to handle missing fields
  • Immutability of condition nodes to ensure thread safety and reusability
  • Test coverage: unit tests for each node, integration tests for nested conditions, and edge cases
  • Extensibility: adding new predicates or composites via the open/closed principle

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.