Virtually none of the expensive-to-fix software defects I've seen in my career were caused by lack of coding skills; they were caused by improper understanding and/or abstraction of the problem in hand. Improper abstraction usually leads to components with low cohesion and high level of coupling, which make changes harder to implement and riskier to deploy. That is why I advised people to: 1 - Understand the problem you're trying to solve, end to end. Use questions like "what about...?" and "what if...?" to stress scenarios. 2 - Work out the solution on paper, white board or whatever, before jumping into code. 3 - WRITE DOWN what the solution is supposed to do. #3 is unfortunately a lost art. People are usually very averse to writing and even more to reading. Besides being excellent to our brains (https://lnkd.in/gXR_PkyP), there are some concepts and interactions that are impossible to convey via diagrams. When a solution contains only diagrams, it will most likely leave important details out. I lost count of the times I was writing down a solution and I realized that some aspect of it made no sense and needed further clarifications.
Why most software defects are caused by improper abstraction
More Relevant Posts
-
What is the Rubber Duck Rule? The concept originated in the world of software engineering, a place where brilliant minds often get tangled in knots of complex code. The story goes, as told in the 1999 book The Pragmatic Programmer, that a programmer would carry around a rubber duck. When faced with a stubborn bug, they would explain their code to the duck, line by line. The simple act of verbalizing the problem forces the programmer to slow down and articulate each step of their logic. In doing so, they often spot the flaw in their own reasoning. The duck, with its serene, non-judgmental gaze, doesn’t offer any advice. It just listens. And that’s the whole point. This technique is so effective because it leverages a psychological principle called the “self-explanation effect.” When you explain something to someone else (even an inanimate object), you organize your thoughts, identify gaps in your understanding, and view the problem from a fresh perspective. You’re not just talking; you’re actively engaging with the information in a different part of your brain.
To view or add a comment, sign in
-
🤔 It worked perfectly on my machine but suddenly broke in production 🤦♂️ That used to drive me crazy until I realized the root cause wasn’t the code itself, but the hidden assumptions it carried. One day, I was reviewing an issue where a background job kept failing randomly. The code looked fine, tests were green, logs were clean... until we realized something shocking: the job depended on the system’s time zone. On one server, UTC, on another, local time. Boom 💥 That’s when I learned one of the most underrated lessons in software engineering: Code doesn’t live in isolation, it lives in an environment. Here are a few silent killers I started paying close attention to: 🐍 Environment variables – never assume they exist everywhere. ⏰ DateTime handling – always clarify whether you’re using UTC or local time. 💾 File paths – don’t hardcode them; different OS means different structure. 🔐 Secrets – avoid embedding them in configs; use secure vaults instead. 💡 Dependencies – lock versions; "latest" can ruin your weekend. Since then, I’ve learned to ask: "What’s the environment like?" before I ask "What’s wrong with the code?" It’s amazing how many bugs vanish when you stop debugging your code and start debugging your assumptions. Don't let it stop here, repost and share ♻️ with your network to spread the knowledge ✅ #softwareengineering #programming #developers #csharp #dotnet #coding
To view or add a comment, sign in
-
-
**Clean Code** * Your Code must be readable by other programmers. * This is not simply a matter of writing nice comments. * It requires that you craft the code in such a way that it reveals your intent. * This is hard to do. * Indeed, this may be this most difficult thing a programmer can master.
To view or add a comment, sign in
-
Good to keep in mind. Vibed-code is legacy code. Legacy code refers to software that still works but relies on outdated technologies or techniques. Frequently, such code lacks proper documentation, uses obsolete tools, has unnecessary bloat, and has not been sufficiently tested, making it unreliable. That's the paradox of vibe-coding: the more you vibe, the less you are actually coding. And while that's okay for some things – there's no need to reinvent the wheel – it can be very serious for others – it's quite essential to ensure that the wheels do their job properly and safely when screwed into a car. This illustration is very telling. The full article by Steve Krouse is here: https://lnkd.in/eRCtPENm
To view or add a comment, sign in
-
-
A document shouldn’t try to do what the code already does well. The code already supplies the detail. It is an exact specification of program behavior. Other documents need to illuminate meaning, to give insight into large-scale structures, and to focus attention on core elements. Documents can clarify design intent when the programming language does not support a straightforward implementation of a concept. Written documents should complement the code and the talking. —Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software #SOFTWARE_ENGINEERING
To view or add a comment, sign in
-
🚀 Understanding SOLID Principles in Coding Writing code is easy. Writing clean, scalable, and maintainable code is the real challenge. That’s where the SOLID principles (coined by Robert C. Martin) help us — five guidelines for better software design 👇 🔹 S – Single Responsibility Principle (SRP) A class should have only one reason to change. ➡ Example: Don’t mix database logic and email logic in the same class. 🔹 O – Open/Closed Principle (OCP) Open for extension, closed for modification. ➡ Example: Add new functionality by extending classes, not rewriting them. 🔹 L – Liskov Substitution Principle (LSP) Subclasses should be replaceable by their base class without breaking functionality. ➡ Example: If a base class promises a behavior, subclasses must respect it. 🔹 I – Interface Segregation Principle (ISP) Don’t force classes to depend on methods they don’t use. ➡ Example: Break large interfaces into smaller, role-specific ones. 🔹 D – Dependency Inversion Principle (DIP) Depend on abstractions, not concrete implementations. ➡ Example: High-level modules shouldn’t depend on low-level details — both should depend on interfaces. 💡 Following SOLID helps developers build: ✅ Clean and testable code ✅ Flexible and scalable applications ✅ Reduced bugs when making changes 💬 Do you use SOLID principles in your projects? #SOLID #CleanCode #SoftwareEngineering #Programming
To view or add a comment, sign in
-
-
Recently I came across a concept known as "DRY" principle. During a PR review, I came across a helper function that checked an API response code and, based on that, dispatched a action. To make this work, the helper had to accept the Redux dispatch callback as a parameter. A senior engineer pointed out that the helper was tightly coupled with dispatch and suggested separating the core logic. We eventually decided to move the core logic into its own function while keeping an additional helper that handled dispatch, since the same logic was reused in multiple places. This experience was my first real introduction to the DRY (Don’t Repeat Yourself) principle. What a DRY principle is? "Don't Repeat Yourself" (DRY) is a software development principle that encourages developers to avoid duplicating code in a system. Benefits and Related Concepts of DRY are: Improved Maintainability and Fewer Errors: DRY simplifies maintenance, as updates or changes only need to be implemented in a single, central location. This significantly reduces the likelihood of introducing inconsistencies or errors. Modular Programming: DRY is closely linked to modular programming—the practice of encapsulating specific functionality within defined units like functions, classes, or modules. This principle also allows to abstract multiple business logic within the code, and in future if any change to the flow is required, or a similar flow is to be reused at a different place, it is much easier to scale.
To view or add a comment, sign in
-
-
Assertions in C are one of the most powerful yet underused tools for debugging embedded systems. The assert() macro helps developers detect logic errors early by validating assumptions about system state, inputs, and outputs. When used effectively, it acts as a safety net—catching bugs the moment they occur rather than allowing them to silently corrupt the system later. Use assert() to check function preconditions (like valid input ranges) and postconditions (to confirm outputs remain consistent). Avoid using it for runtime error handling; it’s meant for uncovering bugs, not handling expected faults. Keep assertions side-effect-free, and remember they can be disabled in production using NDEBUG. Think of them as executable code comments that not only explain your logic but actively enforce it. Smart use of assertions can make your codebase more reliable, maintainable, and self-documenting—helping you squash bugs faster and build confidence in every release. 🧠🐞 #EmbeddedSystems #CProgramming #Debugging #FirmwareDevelopment #Assert
To view or add a comment, sign in
-
-
Don’t Repeat Yourself (DRY) A Little Reminder for Developers Been a while since I posted here, but I just want to drop something short and real. If you ever find yourself writing the same logic inside two or three different methods in a class, just stop. You don’t need to copy and paste that block of code everywhere. Just extract it into a private method, and call it wherever it’s needed. Simple. This one habit alone makes your code: ✅ Cleaner ✅ Easier to maintain ✅ Less prone to bugs For example, instead of writing the same validation or formatting logic across multiple functions, move it into one method and reuse it. That’s what the DRY principle means: Don’t Repeat Yourself. Because when you repeat code, you’re not only repeating logic, you’re also repeating future errors. Keep your code dry, your brain fresh, and your debugging time short.
To view or add a comment, sign in
NAPO•507 followers
11moWell said, Claudio....and "Oh, man..!