The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Design a Smart Public Wi-Fi Availability Tracker with OOD Concepts

Smart Public Wi-Fi Availability Tracker Design Using OOD Principles

Designing a Smart Public Wi-Fi Availability Tracker involves understanding the problem of real-time Wi-Fi tracking and how we can use object-oriented design (OOD) principles to build a scalable and maintainable system. The goal of this system is to provide users with information about available public Wi-Fi hotspots, including location, connectivity status, and usage quality.

Here’s how the design could be structured based on OOD principles:


1. Class Definitions

To implement this system, we’ll define several key classes that handle different responsibilities, each of which follows the principles of encapsulation, inheritance, and polymorphism.


a. Wi-FiHotspot

Responsibility: This class represents a public Wi-Fi hotspot and contains the essential information regarding its status.

  • Attributes:

    • id (String): Unique identifier for the Wi-Fi hotspot.

    • location (String): Location of the hotspot (e.g., “Central Park”).

    • lat (float): Latitude of the hotspot.

    • long (float): Longitude of the hotspot.

    • status (Enum): The status of the Wi-Fi hotspot (e.g., Available, Unavailable, Maintenance).

    • connectionSpeed (float): The current internet speed available at the hotspot in Mbps.

    • userCount (int): The number of users currently connected.

  • Methods:

    • updateStatus(newStatus: Enum): Updates the status of the hotspot.

    • updateConnectionSpeed(newSpeed: float): Updates the connection speed.

    • getStatus(): Returns the current status of the hotspot.

b. Wi-FiManager

Responsibility: This class manages all the Wi-Fi hotspots and provides functionality to search for available hotspots.

  • Attributes:

    • hotspots (List[Wi-FiHotspot]): A list of all known Wi-Fi hotspots.

  • Methods:

    • addHotspot(hotspot: Wi-FiHotspot): Adds a new Wi-Fi hotspot to the list.

    • removeHotspot(hotspotId: String): Removes a Wi-Fi hotspot by its ID.

    • findAvailableHotspots(): Returns a list of hotspots with “Available” status.

    • findNearbyHotspots(latitude: float, longitude: float, radius: float): Returns a list of hotspots within a given radius of a user’s location.

c. User

Responsibility: Represents the user of the app who wants to find available Wi-Fi hotspots.

  • Attributes:

    • userId (String): Unique identifier for the user.

    • location (Tuple[float, float]): The user’s current GPS coordinates.

    • connectedHotspot (Wi-FiHotspot): The Wi-Fi hotspot the user is currently connected to.

  • Methods:

    • connectToHotspot(hotspot: Wi-FiHotspot): Connects the user to a specific Wi-Fi hotspot.

    • disconnect(): Disconnects the user from the current hotspot.

    • updateLocation(newLocation: Tuple[float, float]): Updates the user’s location.

d. AlertManager

Responsibility: Sends alerts to users based on Wi-Fi availability or changes in hotspot status.

  • Attributes:

    • subscribers (List[User]): A list of users who have subscribed for alerts on hotspot changes.

  • Methods:

    • subscribe(user: User): Adds a user to the alert list.

    • unsubscribe(user: User): Removes a user from the alert list.

    • sendAlert(hotspot: Wi-FiHotspot): Sends an alert to all subscribers when the status of a hotspot changes (e.g., from Available to Unavailable).


2. System Flow

  1. Initialization:

    • The system is initialized with a collection of Wi-Fi hotspots, either manually or through real-time data from IoT devices installed at hotspots.

  2. User Interaction:

    • A user opens the app and allows location access to identify their proximity to Wi-Fi hotspots.

    • The app retrieves a list of available hotspots based on the user’s location.

  3. Wi-Fi Availability Tracking:

    • The Wi-FiManager keeps track of all available and unavailable hotspots, updating their status regularly.

    • If a hotspot’s status changes (e.g., becomes unavailable), the AlertManager notifies all users who are subscribed.

  4. User Connection:

    • The user can connect to a hotspot by selecting one from the list of available ones.

    • Once connected, the user can see the connection speed, and if the hotspot becomes overloaded, the user is notified.

  5. Notifications:

    • Users are notified in real-time when a hotspot’s status changes, such as when it becomes available or goes offline.


3. Design Principles Applied

  • Encapsulation: Each class encapsulates its responsibilities. For example, the Wi-FiHotspot class handles everything related to the status and connectivity of a hotspot.

  • Abstraction: The user and manager classes provide high-level abstractions without exposing unnecessary implementation details, like the internal structure of a hotspot.

  • Inheritance: If necessary, additional hotspot classes could inherit from the Wi-FiHotspot class (e.g., paid vs. free Wi-Fi hotspots).

  • Polymorphism: The updateStatus method can be overridden to provide more detailed behavior in different hotspot types, such as a government-owned vs. private hotspot.


4. Interaction Diagram

Here’s a high-level interaction diagram for how the system would work:

  1. User opens the app.

    • The app gets the user’s current location and passes it to the Wi-FiManager.

  2. Wi-FiManager finds available hotspots based on proximity to the user.

    • It returns a list of available hotspots to the user.

  3. User selects a hotspot to connect.

    • The app sends a request to the Wi-FiHotspot to connect.

    • The Wi-FiHotspot confirms the connection or informs the user if it’s not available.

  4. Wi-FiManager receives updates (e.g., Wi-Fi speed or status changes) and updates the user interface.

    • If the status changes (e.g., hotspot goes offline), an alert is sent to the user.


5. Extensions and Scalability

  • Geolocation Accuracy: The system could use more precise geolocation technologies such as Bluetooth or Ultra-Wideband (UWB) for more accurate proximity detection.

  • User Ratings: Allow users to rate hotspots on their reliability, speed, and ease of connection. This information can be stored and used for future hotspot management.

  • Machine Learning: AI could be employed to predict hotspot status based on historical data, like peak usage times, helping users find Wi-Fi with higher reliability.

  • Integration with Internet Service Providers (ISPs): The system could integrate with ISPs to gather data on hotspot availability and provide more accurate real-time information.


By implementing the Smart Public Wi-Fi Availability Tracker using object-oriented design principles, we can ensure that the system is modular, easy to maintain, and scalable as more users and hotspots are added to the network.

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About