Object Oriented Design for WhatsApp/WeChat (Chat app)

I was asked implement object oriented design for chat based system like whatsapp/wechat on an onsite interview. I was given freedom to choose scope of the system in terms of features. Here are some of the use cases I tried to cover.

  1. one to one messaging
  2. group based messages
  3. media sharing (photoes)
  4. notification upon message received

I tried to think of implementing following points:

  1. observer design pattern for notification,
  2. using priority queue for main chat feed to show latest one to one or group messages (based on timestamp)
  3. creating interfaces for camera access control to take picture/select media from local (just define methods in interface)
  4. interface for whatsapp settings, searching contact to send message
  5. classes for User, Group, ChatFeed (feed you see once you open the app), ChatThread (between 2 users or group messages),
  6. Singleton class of main whatsapp system where you can use composition with ChatFeed, SettingController, CameraController etc.

What are your thoughts on implementing classes and interfaces for this problem? What other design patterns can be applied?

Comments (11)