TinderLite - Dating App is a low-level design (LLD) for a simplified dating application, inspired by platforms like Tinder. It manages user profiles, matching, swiping, chatting, and notifications using design patterns such as Singleton, Observer, Strategy, Factory, and Facade to ensure modularity and scalability.
- User Management: Create and manage user profiles with personal details, preferences, and interests.
- Matching System: Calculate match scores based on gender preferences, age range, distance, and shared interests.
- Swipe Functionality: Implement like/dislike swipes with mutual swipe detection for matches.
- Chat System: Enable messaging between matched users.
- Notification Service: Notify users of matches and new messages using the Observer pattern.
- Location Services: Find nearby users based on geographic proximity using the Haversine formula.
- Singleton Managers: Uses centralized control with
DatingAppandNotificationService.
The system is divided into several key components, as illustrated in the class diagram:
- UserProfile: Represents a user profile with name, age, gender, bio, photos, interests, and location.
- User: A user with an ID, profile, preferences, swipe history, and notification observer.
- Preference: Manages user preferences for gender, age range, distance, and interests.
- Location: Stores latitude and longitude, with a method to calculate distance.
- Interest: Represents a user interest with a name and category.
- Message: Represents a chat message with sender ID, content, and timestamp.
- ChatRoom: Manages a chat between two users with a list of messages.
- Gender: Enum for user gender options.
- SwipeAction: Enum for swipe actions (LEFT, RIGHT).
- NotificationObserver: Interface for notification observers.
- UserNotificationObserver: Concrete observer for user notifications.
- NotificationService (Singleton): Manages observer registration and notifications.
- LocationStrategy: Interface for location-based strategies.
- BasicLocationStrategy: Concrete strategy to find nearby users.
- LocationService (Singleton): Manages location-based user searches.
- Matcher: Interface for calculating match scores.
- BasicMatcher: Base matcher checking gender, age, and distance.
- InterestsBasedMatcher: Enhances matching with shared interests.
- LocationBasedMatcher: Adds proximity-based scoring.
- MatcherFactory: Creates matcher instances.
- MatcherType: Enum for matcher types.
- DatingApp (Singleton): Facade for the entire system, handling user creation, swiping, and chatting.
The Main class sets up users with profiles, preferences, and locations.
- A
Useris created with a profile and preferences. - Users can swipe on others, triggering match notifications if mutual.
- Matched users can send messages via a
ChatRoom.
DatingApp.findNearbyUserslocates potential matches within a distance.DatingApp.swipeprocesses swipe actions and handles matches.DatingApp.sendMessagefacilitates chat between users.
- Factory Pattern:
MatcherFactorycreates matcher instances. - Strategy Pattern:
LocationStrategyallows flexible location logic. - Singleton Pattern:
DatingApp,NotificationService, andLocationServiceensure single instances. - Observer Pattern:
NotificationServicenotifies users of events. - Facade Pattern:
DatingAppsimplifies system interactions.
The entry point is Main.java. Compile and run it to see a demo:
- Initializes users with sample profiles.
- Displays profiles, finds nearby users, simulates swipes, and creates a chat.
- Outputs the chat summary with timestamps.
Refer to the provided class diagram for a visual representation of the system architecture, showing relationships between classes, methods, and attributes.


