Design Patterns remain the key skill for software engineers across the board. We all have the GoF (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides) original book on our desks, irrespective of which programming languages (#python, #cplusplus, #java, #rust, etc.) we use. We may think that we know everything about this subject but Dmitri Nesteruk's 2nd edition of Design Patterns in Modern C++ is definitely worth reading: https://amzn.to/4mshTWV if we want to produce correct, efficient, readable, and idiomatic/effective code.
Design Patterns in Modern C++ by Dmitri Nesteruk
More Relevant Posts
-
I solved a major problem every hardware reverse engineer comes across at least once. It's not uncommon for hardware reverse engineers to come across an unfamiliar/niche architecture with limited tooling. You either have to compromise with an anarchic compiler from 2002 or write your own backend for the newest compilers around, both of which take an extraordinary amount of time to get working. While backends like LLVM exist, they still fail to simplify the process. I designed CHance–a modular, modern, and expressive programming language. CHance aims to sit between C and C#, matching C's low-level support with C#'s modern syntax. CHance uses its own IR, named ChanceCode. ChanceCode is designed to be sweet and simple, only using what you need. ChanceCode's compiler uses a modular backend system, allowing anyone to create a simple backend in minutes. The compiler leaves all control up to the backends, trusting their authority. The CHance toolchain doesn't end there! The CHance Assembler is the third step in the chain. It's incredibly easy to add your own architecture to it, emitting to whatever you desire. The final step is the CHance Linker, which can easily be modified to add a new architecture or new output format. If you believe this project has potential–or appreciate the work behind it–feel free to star the project on GitHub! Check it out in my projects: https://lnkd.in/gaj-xDTH
To view or add a comment, sign in
-
-
In embedded C++, DI looks simple right up to the moment the object graph starts growing. Then it stops being a pattern discussion and becomes a lifetime problem. People often say, “Just use constructor injection.” And yes, that works. But as the system grows, dependency injection stops being only about how dependencies are passed in. It becomes about who creates them, who owns them, how long they live, and how much wiring the design can absorb. I am talking mainly about embedded-style C++ codebases. Not template-heavy compile-time DI, but systems that value explicit object graphs, dynamic polymorphism, predictable behavior, and code that is easy to debug, review, and maintain. In that world, injecting a dependency is rarely just “pass it into the constructor.” You are also deciding whether the dependency is owned or borrowed, whether unique_ptr stays at the composition root or spreads through the graph, whether you need factories to keep construction testable, and whether shared_ptr appears simply because composition got painful. That is why DI often feels harder in C++ than in languages with framework-managed lifecycles. In Java with Spring, the container creates objects, resolves dependencies, and manages lifecycle. In C++, those decisions stay in your code. They are explicit, local, and impossible to ignore. That is both the strength and the cost. C++ gives us precise control over lifetime. What gets harder is scaling that control as the object graph grows. In small systems, explicit wiring feels clean. In larger ones, it can turn into plumbing. In practice, many embedded C++ codebases end up mixing approaches. Constructor injection for clear dependencies. References for borrowed collaborators. unique_ptr where ownership is real. Factory seams where tests need substitution. And only occasionally a container or custom injector when wiring becomes too large to manage by hand. So for me, DI in embedded C++ is not mainly about patterns. It is about how much lifetime and wiring complexity a design can carry before the composition model starts fighting the codebase. How do you handle this in real projects? Do you keep unique_ptr at the composition root? Inject factories for tests? Build your own injector? Or just accept some plumbing as the price of clarity? #EmbeddedSystems #Cpp #SoftwareEngineering #SoftwareArchitecture #EmbeddedSoftware
To view or add a comment, sign in
-
-
🚀 Level Up Your Modern C++ Game: 4 Essential Reads! C++ has evolved dramatically in recent years. If you’re still writing code like it’s 2003, you’re missing out on the safety, efficiency, and power of the modern standards. To master the language today, you need resources that leverage C++20 and C++23. Here are four books I highly recommend for any developer's shelf: 1️⃣ Programming: Principles and Practice Using C++ (3rd Edition) By Bjarne Stroustrup Who better to learn from than the creator of the language himself? This isn't just about syntax, it’s about fundamental programming principles. The 3rd edition is fully updated for C++20 and C++23, focusing on real-world techniques rather than obscure technicalities. 2️⃣ C++ Software Design By Klaus Iglberger Writing code is easy, designing maintainable software is hard. This book is a masterclass in managing dependencies and abstractions. It bridges the gap between classic design patterns and modern C++ capabilities to help you build scalable systems. 3️⃣ C++ Memory Management By Patrice Roy Manual memory management is a double-edged sword. It offers unparalleled flexibility but can lead to critical errors if mishandled. Patrice Roy provides a deep dive into C++ memory mechanisms, teaching you how to automate and optimize for safer, leaner program design. 4️⃣ C++ in Embedded Systems By Amar Mahmutbegović The embedded world is still heavily dominated by C, but modern C++ is a game-changer for firmware. This guide is perfect for developers looking to transition to C++ in resource-constrained environments, ensuring your solutions are robust and safe without sacrificing performance. Modern C++ is more than just a language, it's a powerful toolset for building the future. 💬 Do you have a favorite C++ book that changed the way you code? Let me know in the comments! #embeddedfirmware #cpp #cppprogramming #softwareengineering #embedded #coding #moderncpp #developercommunity
To view or add a comment, sign in
-
-
Built a simple C++ Compiler from Scratch! Sharing my latest project - a simple yet functional C++ compiler built from the ground up using Flex, Bison, and ANTLR4. This project dives into the core phases of compilation and helped me strengthen my understanding of how programming languages actually work behind the scenes. Key Features: • Lexical Analysis using Flex • Syntax Parsing using Bison & ANTLR4 • Three Address Code (TAC) Generation • Basic Assembly Code Generation • Detailed logging of each compilation phase How it works: 1. Source code is tokenized into meaningful units 2. Tokens are parsed based on grammar rules 3. Intermediate code (TAC) is generated 4. Final pseudo-assembly code is produced What I learned: Building a compiler from scratch gave me hands-on experience with: • Language design fundamentals • Parsing techniques and grammar rules (Bison & ANTLR4) • Intermediate representations • Low-level code generation concepts 🛠️ Tech Stack: C++ | Flex | Bison | ANTLR4 | Makefile 📌 Example outputs include: ✔ Token logs from lexical analysis ✔ Three Address Code ✔ Assembly-like instructions This project is a small but meaningful step into the world of compilers and systems programming. 🔗 GitHub Repo: https://lnkd.in/ggkcdTyV I’d love to hear your thoughts or suggestions for improvement! #CPlusPlus #CompilerDesign #Flex #Bison #ANTLR4 #SystemsProgramming #SoftwareEngineering #LearningByBuilding #BIE #bioinformatics #BAU
To view or add a comment, sign in
-
-
🔹 Type Deduction in C++ (auto, decltype) This short video is part of my "C++ Programming Topics" series 👇 And also included in my broader learning playlist. 💡 The problem: Many developers either over-specify types or rely on guesswork when writing modern C++ code. This can lead to: -Verbose and harder-to-read code -Subtle bugs when types are not what you expect -Reduced flexibility when refactoring ❌ 📌 This is where type deduction becomes powerful: 👉 Let the compiler infer the correct type safely and efficiently. 💡 The solution: Using modern C++ features like auto, decltype, and template deduction: ✔️ Write cleaner and more concise code ✔️ Reduce redundancy ✔️ Let the compiler handle complexity ⚙️ Bonus insight from the video: You’ll see how type deduction works in different scenarios: 1️⃣ auto Great for simplifying variable declarations Improves readability when types are obvious 2️⃣ decltype Useful when you need the exact type of an expression Helps in advanced template and generic programming 3️⃣ Template Type Deduction The core concept behind generic programming Enables flexible and reusable code 🎯 Key takeaway: Don’t fight the compiler—use it. Modern C++ gives you tools to write cleaner, safer, and more maintainable code. 🎥 Watch the video: https://lnkd.in/dZSDe2Pi 📚 Full playlist: https://lnkd.in/dDNVWvVC 📚 Source code, examples, and notes: https://lnkd.in/dy2Kp-4f #cpp #moderncpp #programming #softwareengineering #templates #cleancode
To view or add a comment, sign in
-
💻 Great .NET insights from Steven Giesel. This post dives into practical development concepts with clear explanations and real code examples—always a great resource for developers looking to sharpen their skills. 👉 https://lnkd.in/gp8vTSkr #dotnet #SoftwareDevelopment #Programming #DevCommunity
To view or add a comment, sign in
-
Why don’t more C++ developers talk about Return Value Optimization (RVO)? This optimization has existed in C++ since 1997, yet many developers still assume returning objects is expensive. Let’s take a simple case. A function creates an object and returns it: MyClass Myfun() { return MyClass obj; } Without optimization, you might imagine this happening: • create obj inside Myfun() • copy it when returning to main() • destroy the local object That sounds like extra work, right? Here’s the interesting part. Modern C++ compilers apply Return Value Optimization (RVO). Instead of: create → copy → destroy The compiler simply constructs the object directly in the caller’s memory. So the object is effectively created inside main() from the start. No extra copy. No unnecessary destruction. A subtle optimization — but one that makes returning objects cheap and idiomatic in C++. Small compiler optimizations like this are why understanding how C++ actually works under the hood matters. Did you learn about RVO early, or much later in your C++ journey? #CPP #SoftwareEngineering #Programming #SystemsProgramming #Developers
To view or add a comment, sign in
-
-
.𝗡𝗲𝘁 𝟭𝟬 - 𝗖# 𝟭𝟰 𝗝𝘂𝘀𝘁 𝗠𝗮𝗱𝗲 𝗣𝗿𝗼𝗽𝗲𝗿𝘁𝗶𝗲𝘀 𝗖𝗹𝗲𝗮𝗻𝗲𝗿 - 𝗳𝗶𝗲𝗹𝗱 𝗸𝗲𝘆𝘄𝗼𝗿𝗱 In older C# code, if we wanted to add logic inside a property, we usually had to create a separate private variable. With C# 14, we can now use the 𝗳𝗶𝗲𝗹𝗱 keyword inside a property accessor. It gives direct access to the compiler generated backing field, so we can keep the code shorter and cleaner. 𝗕𝗲𝗳𝗼𝗿𝗲 public class Student { 𝗽𝗿𝗶𝘃𝗮𝘁𝗲 𝗶𝗻𝘁 _𝗺𝗮𝗿𝗸𝘀; public int Marks { get => _marks; set => _marks = value < 0 ? 0 : value; } } 𝗪𝗶𝘁𝗵 𝗳𝗶𝗲𝗹𝗱 𝗶𝗻 𝗖# 𝟭𝟰 public class Student { public int Marks { get; set => 𝗳𝗶𝗲𝗹𝗱 = value < 0 ? 0 : value; } } 𝗪𝗵𝗮𝘁 𝗰𝗵𝗮𝗻𝗴𝗲𝗱? We no longer need this line: private int _marks; The compiler creates the backing field for us, and field lets us use it directly inside the property accessor. 𝗪𝗵𝘆 𝘁𝗵𝗶𝘀 𝗶𝘀 𝘂𝘀𝗲𝗳𝘂𝗹 • Cleaner code. • Less boilerplate. • Same control over validation or simple logic. #dotnet #csharp #softwaredevelopment #dotnetdev #programming
To view or add a comment, sign in
-
-
When modeling scenarios with a fixed set of outcomes — such as parsing user input or handling HTTP requests — developers often rely on enums or inheritance, which can compromise clarity and type safety. C# 15 introduces union types as a more robust alternative. These allow you to define a closed set of types with implicit conversions and pattern matching, ensuring compile-time exhaustiveness. This means the compiler will catch missing cases, reducing runtime errors. For example, a Result<int, Error> type cleanly represents success or failure, aligning with functional programming patterns and improving code safety. I believe union types offer a design shift that makes C# more expressive and safer — especially for handling domain events or API responses. What do you think — how have you handled similar scenarios before union types? #CSharp #DotNet #Programming #SoftwareDevelopment
To view or add a comment, sign in
-
Day 55/100 – LeetCode Challenge Problem: Triangle Today I solved the “Triangle” problem, which is a classic dynamic programming question focused on finding the minimum path sum from top to bottom. Instead of starting from the top and exploring all possible paths, I approached this problem from the bottom. I initialized a DP array with the values of the last row of the triangle. Then, I moved upward row by row, updating each element by adding the minimum of the two adjacent values from the row below. This bottom-up approach reduces the problem size at each step and avoids unnecessary recomputation. By the time I reached the top, the first element of the DP array represented the minimum path sum. This method is efficient because it reuses space and avoids building a full 2D DP table. The solution runs in O(n²) time with O(n) space complexity. This problem reinforced how changing the direction of thinking — bottom-up instead of top-down — can simplify dynamic programming problems significantly. Fifty-five days in. The focus is now on writing optimal solutions with better space efficiency. #100DaysOfLeetCode #Java #DSA #DynamicProgramming #ProblemSolving #Consistency
To view or add a comment, sign in
-
More from this author
-
Professional Development from QDC
Quantitative Developer Certificate (QDC) 1mo -
The Quantitative Developer Certificate (QDC) - Last Chance: QDC Early Bird Discount Ends Tomorrow
Quantitative Developer Certificate (QDC) 7mo -
📣 QDC Newsletter | July 2025 Edition | The Future of Python, C++, and kdb+/q in the Era of ChatGPT
Quantitative Developer Certificate (QDC) 9mo
Explore related topics
- Code Design Strategies for Software Engineers
- How to Design Software for Testability
- How Software Engineers Identify Coding Patterns
- Top Skills Needed for Software Engineers
- Form Design Best Practices
- How Pattern Programming Builds Foundational Coding Skills
- The Language of Design Patterns
- User Interface Layout Techniques
- Applying Code Patterns in Real-World Projects
- Interface Prototyping Techniques
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
I am delighted to say I never learnt them and never did OOP outside of college although I have done some in a multi-paradigm language.