Design Chat Based application like whatsapp/wechat.
MediumLet's design a chat application, think WhatsApp or WeChat, but simplified and focused on the core chatting functionality. We'll concentrate on the low-level design aspects: how to structure the classes, handle different message types, manage users, and ensure thread safety. We'll leave aside features like voice calls, video calls, stickers, and complex group management. The system should support one-on-one chats, group chats, and different message formats. The goal is to create a robust, extensible, and maintainable codebase that can form the foundation for a more feature-rich application. Think about how to add new message types (e.g., location sharing) without modifying existing core classes. How would you handle concurrent access to the chat history? This exercise isn't about building a distributed, scalable system for millions of users; it's about crafting a clean, well-designed, in-memory application.
Requirements
Think like an Architect
Before revealing the requirements, imagine you're in the interview right now."How would you clarify the scope with your interviewer?"