A practical transition from C to modern C++
Amar Mahmutbegovic

#C++
#SOLID
#SML
#RAII
#ETL
#C
فراتر از C بروید و با بهکارگیری C++ مدرن در سیستمهای نهفته، خوانایی، نگهداشتپذیری و مقیاسپذیری کد را ارتقا دهید.
ویژگیهای کلیدی:
معرفی کتاب:
گذار از C به C++ ممکن است چالشبرانگیز باشد؛ نگرانیهایی مانند افت کارایی، افزایش پیچیدگی و ابزارهای ناشناخته وجود دارد. عمار مهموتبگوویچ، طرفدار استفاده از C++ مدرن در توسعه سیستمهای نهفته، در این کتاب نشان میدهد که چگونه با بهرهگیری از انتزاعهای بدون هزینه (zero-cost abstractions)، بررسیهای زمان کامپایل و قابلیتهای قدرتمند C++ مدرن میتوان ضمن حفظ کارایی، کدی ایمنتر، خواناتر و تمیزتر نوشت. این کتاب پلی است بین C سنتی و C++ پیشرفته؛ به گونهای که کارایی مورد نیاز توسعهدهندگان C حفظ شده و همزمان ایمنی و بیانپذیری C++ مدرن نیز به دست میآید.
با شروع از راهاندازی یک محیط توسعه مدرن، از جمله استفاده از کانتینر Docker برای اجرای بیدردسر مثالها، خواهید آموخت چگونه محدودیتهای استفاده از کتابخانه استاندارد C++ در محیطهای کمحافظه را پشت سر بگذارید و با Embedded Template Library (ETL) بهعنوان جایگزین آشنا شوید. سپس کتاب شما را از مفاهیم پایه C++ تا موضوعات پیشرفته مانند templateها، strong typing، مدیریت خطا، محاسبه در زمان کامپایل و RAII پیش میبرد. در مثالهای عملی، یک sequencer پیادهسازی میکنید، یک HAL نوع-ایمن مینویسید و الگوهایی مانند Command، State و Observer را برای حل مشکلات رایج توسعه نهفته به کار میبرید.
در پایان، یاد خواهید گرفت چگونه با C++ مدرن، firmwareهایی ماژولار و پایدار توسعه دهید که کارایی آنها با کدهای C دستنویس برابری کرده یا حتی فراتر رود.
آنچه خواهید آموخت:
مخاطبان کتاب:
این کتاب برای توسعهدهندگانی است که عمدتاً از C استفاده میکنند و میخواهند رویکرد C++ مدرن را در سیستمهای نهفته به کار گیرند. این کتاب مفاهیم پایه C++ را آموزش میدهد و برای مبتدیان نیز مناسب است، اما فرض میکند خواننده با مبانی زبان آشناست تا بتواند از ویژگیهای پیشرفته مانند محاسبه زمان کامپایل بهره کامل ببرد. حتی توسعهدهندگانی که تجربه C++ دارند، روشهای نوینی برای بهکارگیری بهترین شیوههای مدرن و نوشتن برنامههای نهفته کاراتر و نگهداشتپذیرتر خواهند یافت.
Go beyond C by applying modern C++ in embedded systems to enhance code readability, maintainability, and scalability
Transitioning from C can be daunting, with concerns about performance overhead, added complexity, and unfamiliar tooling. Addressing these challenges, Amar Mahmutbegovic, an advocate for modern C++ in embedded development, shows you how to harness zero-cost abstractions, compile-time checks, and powerful modern C++ capabilities to preserve performance while achieving safer, cleaner code. This book bridges the gap between traditional C and advanced C++, helping you retain the efficiency C developers demand while unlocking the safety and expressiveness of modern C++.
Starting with a modern development environment setup, including a Docker container for seamless example replication, you’ll overcome the hurdles of using the C++ standard library in memory-constrained settings and get acquainted with the Embedded Template Library (ETL) as an alternative. The book walks you through essential C++ concepts before exploring advanced topics such as templates, strong typing, error handling, compile-time computation, and RAII. Through practical examples, you'll implement a sequencer, write a type-safe HAL, and apply patterns like Command, State, and Observer to solve common embedded development problems.
By the end of this book, you’ll have learned how to apply modern C++ to develop robust, modular firmware with performance matching or exceeding hand-coded C solutions.
This book is for embedded developers who primarily use C and want to adopt a modern C++ approach. It introduces fundamental C++ concepts, making it suitable for beginners, while also assuming basic familiarity to fully leverage advanced features like compile-time computation. Even those with prior C++ experience will discover new ways to apply modern best practices to write more efficient and maintainable embedded applications.
Part I: Introduction to C++ in Embedded Development
Chapter 1: Debunking Common Myths about C + +
Chapter 2: Challenges in Embedded Systems with Limited Resources
Chapter 3: Embedded C++ Ecosystem
Chapter 4: Setting Up the Development Environment for a C++ Embedded Project
Part II: C++ Fundamentals
Chapter 5: Classes - Building Blocks of C++ Applications
Chapter 6: Beyond Classes - Fundamental C++ Concepts
Chapter 7: Strengthening Firmware - Practical C++ Error Handling Methods
Part Ill: C++ Advanced Concepts
Chapter 8: Building Generic and Reusable Code with Templates
Chapter 9: Improving Type-Safety with Strong Types
Chapter 10: Writing Expressive Code with Lambdas
Chapter 11: Compile-Time Computation
Part IV: Applying C++ to Solving Embedded Domain Problems
Chapter 12: Writing C++ HAL
Chapter 13: Working with C Libraries
Chapter 14: Enhancing Super-Loop with Sequencer
Chapter 15: Practical Patterns - Building a Temperature Publisher
Chapter 16: Designing Scalable Finite State Machines
Chapter 17: Libraries and Frameworks
Chapter 18: Cross-Platform Development
Amar Mahmutbegović is the co-founder and head of engineering at Semblie, where he leads the utilization of modern C++ for firmware development. His expertise extends to working on BLE consumer devices and medical devices, delivering sophisticated solutions for a wide range of clients, including start-ups. Amar's dedication to innovation helps bring electronic product ideas to the world. Amar actively shares C++ benefits in the embedded community via blogs and LinkedIn. He also mentors young engineers, enhancing their skills in modern development practices. His work aims to make embedded systems more accessible, maintainable, and scalable, bridging the gap between traditional methods and modern efficiencies for developers worldwide.









