SOLID Principles – Explained Simply S – Single Responsibility One class = one responsibility = one reason to change. O – Open/Closed Extend behavior, don’t modify existing code. L – Liskov Substitution A subclass should seamlessly replace its parent class. I – Interface Segregation Many small, specific interfaces are better than one large interface. D – Dependency Inversion Depend on abstractions, not concrete implementations. #SOLID #CleanCode #Java #SpringBoot #SoftwareEngineering #BackendDevelopment #BestPractices
More Relevant Posts
-
💡 𝗦𝗲𝗽𝗮𝗿𝗮𝘁𝗶𝗼𝗻 𝗼𝗳 𝗖𝗼𝗻𝗰𝗲𝗿𝗻𝘀 𝗶𝗻 𝗥𝗲𝗮𝗹 𝗦𝘆𝘀𝘁𝗲𝗺𝘀 Many systems technically separate layers but still couple behavior, creating hidden architectural problems. #CleanArchitectureSeries #SpringBoot #SoftwareArchitecture #Java #CodeAIForge
To view or add a comment, sign in
-
Day 31/100 – LeetCode Challenge 🚀 Problem: Roman to Integer Approach: Mapped Roman symbols to their integer values Traversed the string once If the current value was less than the next value, subtracted it Otherwise, added it to the total Time Complexity: O(n) Space Complexity: O(1) Key takeaway: When dealing with special formatting rules (like subtraction cases), comparing the current and next element often simplifies the logic. #LeetCode #100DaysOfCode #DSA #Java #Strings #ProblemSolving
To view or add a comment, sign in
-
-
Dependency Injection — Don’t Create Dependencies Dependency Injection helps decouple your code by injecting dependencies from the outside instead of creating them internally. Instead of hard-coding implementations: - Depend on interfaces - Let a container resolve dependencies - Swap implementations without changing business logic This results in: ✔ Loosely coupled code ✔ Easier testing ✔ Cleaner architecture Don’t create dependencies. Inject them. #DependencyInjection #CleanCode #SoftwareArchitecture #SOLID #DotNet #Java #BackendDevelopment
To view or add a comment, sign in
-
-
𝑷𝒐𝒕𝒆𝒏𝒕𝒊𝒂𝒍 𝑩𝒖𝒈 𝑰𝒅𝒆𝒏𝒕𝒊𝒇𝒊𝒆𝒅 𝒊𝒏 𝑳𝒆𝒆𝒕𝑪𝒐𝒅𝒆 𝑬𝒙𝒆𝒄𝒖𝒕𝒊𝒐𝒏 𝑻𝒊𝒎𝒆 𝑪𝒂𝒍𝒄𝒖𝒍𝒂𝒕𝒊𝒐𝒏 I recently noticed an issue with how LeetCode calculates and displays code execution time. By adding a simple static block with a shutdown hook, it is possible to alter the displayed runtime of a submitted solution. This indicates that the execution time can be influenced outside the actual algorithm logic, which should ideally not be possible. Below is the code snippet that demonstrates this behavior: static { Runtime.getRuntime().addShutdownHook(new Thread(() -> { try (FileWriter writer = new FileWriter("display_runtime.txt")) { writer.write("0"); } catch (IOException e) { e.printStackTrace(); } })); } This suggests a bug on LeetCode’s end, where execution time tracking may be relying on artifacts that can be manipulated during JVM shutdown. Sharing this for awareness and hoping the LeetCode team can look into it to ensure fair and accurate performance measurement for all submissions. #LeetCode #Java #JVM #CompetitiveProgramming #SoftwareEngineering #Performance #Debugging LeetCode
To view or add a comment, sign in
-
🚀 Day 2 | Problem 2 of my 15-Day 50+ String DSA Challenge Problem: Count Vowels in a String (Java) Today I worked on a basic but important string problem and focused on getting the logic and flow right instead of just writing code. Key learnings: • Iterating through each character of a string • Correct use of loop boundaries to avoid runtime errors • Understanding array indexing (0 to length-1) • Applying conditional checks cleanly for vowel detection Strengthening fundamentals step by step 💪 #DSA #Java #StringProblems #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
💡 𝗝𝗮𝘃𝗮/𝐒𝐩𝐫𝐢𝐧𝐠 𝐁𝐨𝐨𝐭 - 𝐂𝐥𝐞𝐚𝐧 𝐂𝐨𝐝𝐞 𝐓𝐢𝐩 🔥 💎 𝗣𝗮𝘁𝘁𝗲𝗿𝗻 𝗠𝗮𝘁𝗰𝗵𝗶𝗻𝗴 𝐰𝐢𝐭𝐡 𝗜𝗻𝘀𝘁𝗮𝗻𝗰𝗲𝗼𝗳 𝐊𝐞𝐲𝐰𝐨𝐫𝐝 Pattern matching with instanceof (Java 16+) lets you test an object's type AND declare a new variable in one step. When the pattern matches, the variable is automatically cast and assigned. This eliminates redundant casting and makes your code more concise. ✅ 𝗞𝗲𝘆 𝗕𝗲𝗻𝗲𝗳𝗶𝘁𝘀 ◾ Combines type checking and variable declaration in a single expression. ◾ Eliminates explicit casting and reduces boilerplate code. ◾ Prevents ClassCastException with compile-time safety. ⚡ 𝗖𝗼𝗺𝗺𝗼𝗻 𝗨𝘀𝗲 𝗖𝗮𝘀𝗲𝘀 ◾ Type checking in if statements: if (obj instanceof String str). ◾ Switch expressions with pattern matching (Java 21+). ◾ Processing collections with different element types. 🤔 Do you use pattern matching in your code? #java #springboot #programming #softwareengineering #softwaredevelopment
To view or add a comment, sign in
-
-
Day 109 🚀 | Restore String (LeetCode) Rebuild the string using index mapping 🔁 👉 Place each character at its correct position ⏱ O(n) | 📦 O(n) Consistency > everything 💪 #Day109 #LeetCode #DSA #Java #GeekStreak #CodingJourney
To view or add a comment, sign in
-
Day 17/100 – LeetCode Challenge 🚀 Problem: Fibonacci Number Approach: Used iterative dynamic programming Maintained only the last two values instead of storing the whole sequence Time Complexity: O(n) Space Complexity: O(1) Key takeaway: Dynamic programming is often about reducing repeated work, and many DP problems can be optimized to constant space. #LeetCode #100DaysOfCode #DSA #Java #ProblemSolving #InterviewPrep #100DaysOfLeetCode
To view or add a comment, sign in
-
-
📘 LeetCode Daily — Balanced Binary Tree Checked tree balance by recursively comparing left and right subtree heights at every node. The solution worked, but it clearly showed how repeated height calculations increase time complexity—an important reminder that correct logic isn’t always optimal logic. Solid recursion practice and a good lead-in to optimization. #LeetCode #BinaryTree #Recursion #DSA #Java
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development