If you're working at a coffee shop - or somewhere else not your home - you'll likely be connecting to public wifi.
But this can be dangerous if you don't take steps to protect yourself.
In this guide, Manish explains why using public wifi is risky - and what to do to stay safe.
https://t.co/41cL9v4Tep
Our daily thoughts and actions shape us, so the key to a healthy and happy life is positive habits that we follow systematically. ~ Jim Loehr, Tony Schwartz✅
S.O.L.I.D principles explained with examples:
𝐒: 𝐒𝐢𝐧𝐠𝐥𝐞 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐢𝐛𝐢𝐥𝐢𝐭𝐲 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞 (𝐒𝐑𝐏)
- A class should have one and only one reason to change.
❌ Bad: A UserManager class that handles authentication, user profiles, and email notifications.
✅ Better: Break it into separate classes:
- UserAuthenticator (handles authentication)
- UserProfileManager (manages user profiles)
- EmailNotifier (sends emails)
This keeps each class focused, improving maintainability.
𝐎: 𝐎𝐩𝐞𝐧/𝐂𝐥𝐨𝐬𝐞𝐝 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞 (𝐎𝐂𝐏)
- Software entities should be open for extension, but closed for modification.
❌ Bad: A ShapeCalculator class that requires modification every time a new shape is added.
✅ Better: Use a Shape base class and extend it with subclasses (Rectangle, Triangle, etc.). Now, new shapes can be added without modifying existing code.
𝐋: 𝐋𝐢𝐬𝐤𝐨𝐯 𝐒𝐮𝐛𝐬𝐭𝐢𝐭𝐮𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞 (𝐋𝐒𝐏)
- Objects of a superclass should be replaceable with objects of its subclasses.
❌ Bad: A Bicycle class inheriting from Vehicle, but overriding a startEngine() method that makes no sense for bicycles.
✅ Better: Use a more general start() method in Vehicle. This way, Car and Bicycle can be used interchangeably without unexpected behavior.
𝐈: 𝐈𝐧𝐭𝐞𝐫𝐟𝐚𝐜𝐞 𝐒𝐞𝐠𝐫𝐞𝐠𝐚𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞 (���𝐒𝐏)
- No client should be forced to depend on interfaces they don't use.
❌ Bad: A MediaPlayer interface that requires all implementations to support both audio and video, even when unnecessary.
✅ Better: Split into AudioPlayer and VideoPlayer interfaces. Now, classes implement only what they need, making the code more flexible.
𝐃: 𝐃𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲 𝐈𝐧𝐯𝐞𝐫𝐬𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞 (𝐃𝐈𝐏)
- High-level modules should not depend on low-level modules; both should depend on abstractions.
❌ Bad: An EmailService class that directly depends on a GmailClient.
✅ Better: Introduce an EmailClient interface. Now, EmailService depends on the abstraction, allowing support for multiple providers (GmailClient, OutlookClient, etc.) without code changes.
♻️ Repost to help others in your network.