PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/System Design/TikTok

Implement and compare key design patterns

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in classical design patterns (Singleton, Factory Method, Strategy), concurrent programming and thread safety in Java, dependency injection and refactoring to reduce coupling within the System Design domain, emphasizing practical implementation alongside conceptual architectural reasoning.

  • medium
  • TikTok
  • System Design
  • Software Engineer

Implement and compare key design patterns

Company: TikTok

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Implement simple examples of Singleton (thread-safe and lazy), Factory Method, and Strategy in Java. Compare their trade-offs, extensibility, and testability. Show how you would refactor one example to reduce coupling and enable dependency injection.

Quick Answer: This question evaluates proficiency in classical design patterns (Singleton, Factory Method, Strategy), concurrent programming and thread safety in Java, dependency injection and refactoring to reduce coupling within the System Design domain, emphasizing practical implementation alongside conceptual architectural reasoning.

Related Interview Questions

  • Choose tools for scalable distributed systems - TikTok (medium)
  • Design a distributed key-value store - TikTok (medium)
  • Design a content moderation system - TikTok (medium)
  • Design low-latency large-scale hotel booking system - TikTok (medium)
  • Explain SRE architecture and troubleshooting scenarios - TikTok (hard)
TikTok logo
TikTok
Jul 17, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
4
0

Implement Core GoF Patterns in Java and Discuss Trade-offs

Context

You are designing a small Java library and want to demonstrate three classic GoF design patterns with concise examples. You should:

  1. Implement a thread-safe, lazy Singleton.
  2. Implement the Factory Method pattern.
  3. Implement the Strategy pattern and a simple client that uses it.
  4. Compare these patterns in terms of trade-offs, extensibility, and testability.
  5. Refactor one example to reduce coupling and enable dependency injection (constructor injection is fine).

Keep code snippets small and focused on illustrating the pattern rather than full application logic.

Solution

Show

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More TikTok•More Software Engineer•TikTok Software Engineer•TikTok System Design•Software Engineer System Design
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.