The 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 is useful 𝗳𝗼𝗿 𝗺𝘂𝗹𝘁𝗶𝘁𝗵𝗿𝗲𝗮𝗱 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗶𝗼𝗻. The pattern has many variants, including templates, unions, polymorphism or std::variant, type erasure etc... Every problem requires a different specific solution, thus a different implementation. This version of the 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 uses a function pointer, simplest form to implement in C. This pattern is perfect to pair with a 𝗹𝗼𝗰𝗸-𝗳𝗿𝗲𝗲 𝗿𝗶𝗻𝗴 𝗯𝘂𝗳𝗳𝗲𝗿 or 𝗾𝘂𝗲𝘂𝗲, one way communication between threads, The command pattern AFAIK is also heavily used in Job/Task systems. If you think about it, if we could move the ownership of everything from a thread to another one, would this make multithreading easier to write? Save this post and give it a try! #programming #code #C++
Stanislav Kirichenko’s Post
More Relevant Posts
-
🔍 Reflection in C# – Explained Simply Reflection in C# allows a program to inspect metadata and behavior at runtime. Using reflection, you can explore assemblies, classes, methods, properties, and fields dynamically. 🔹 What Reflection Can Do Access metadata from assemblies Discover class information at runtime Invoke methods dynamically using GetType() Create objects without knowing their type at compile time 🔹 Why Use Reflection? ✔ Dynamic object creation ✔ Plugin-based systems ✔ Dependency Injection (DI) ✔ Testing & debugging tools ✔ Framework-level features#SoftwareDevelopment #DotNe #AspNet #WebDevelopment #BackendDevelopment #FullStackDeveloper #CleanArchitecture #SystemDesign #CodingConcepts #Programming #DeveloperLife #TechLearning #InterviewPreparation #MVC #WebAPI
To view or add a comment, sign in
-
-
The 𝗰𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 is useful 𝗳𝗼𝗿 𝗺𝘂𝗹𝘁𝗶𝘁𝗵𝗿𝗲𝗮𝗱 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗶𝗼𝗻 and more. This version of the 𝗖𝗼𝗺𝗺𝗮𝗻𝗱 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 uses 𝘀𝘁𝗱::𝘃𝗮𝗿𝗶𝗮𝗻𝘁 for a more elegant and modern approach, decoupling the command data from it's execution logic. The pattern has many variants, including templates, unions, polymorphism or std::variant, type erasure etc... Every problem requires a different specific solution, thus a different implementation. This pattern is perfect to pair with a 𝗹𝗼𝗰𝗸-𝗳𝗿𝗲𝗲 𝗿𝗶𝗻𝗴 𝗯𝘂𝗳𝗳𝗲𝗿 or 𝗾𝘂𝗲𝘂𝗲, one way communication between threads, The command pattern AFAIK is also heavily used in Job/Task systems. If you think about it, if we could move the ownership of everything from a thread to another one, would this make multithreading easier to write? Save this post and give it a try! #programming #coding #C++
To view or add a comment, sign in
-
Day 14 of #100DaysOfCode with C# Today I worked with the System.IO.Path class to manipulate file paths safely instead of treating them as plain strings Key lessons: How to store a full file path in a variable and then extract details like the extension, file name, file name without extension, and directory using Path.GetExtension, Path.GetFileName, Path.GetFileNameWithoutExtension, and Path.GetDirectoryName. Why using these built-in helpers is more reliable and readable than manually using IndexOf and Substring, especially when working across different folders and file types. This is an important step towards building real tools that read, write, and organise files on disk in C#. #CSharp #DotNet #100DaysOfCode #Programming #SystemIO #FileHandling
To view or add a comment, sign in
-
-
🚀 Abstraction in C++ vs C# 1️⃣ Implementation ● C++ : Uses abstract classes with pure virtual functions. ● C# : Uses interfaces and abstract classes. 2️⃣ Complexity & Ease of use ● C++ : More control but comparatively complex. ● C# : Cleaner syntax and easier to use. 3️⃣ Focus Area ● C++ : Performance and low level control. ● C# : Productivity and maintainability. #OOPS #Cplusplus #CSharp #Abstraction #Programming #Tech
To view or add a comment, sign in
-
-
Day 17 of #100DaysOfCode — C# ▸ Today I refined a helper method that returns the smallest N numbers from a list by combining methods, loops, and list operations. ▸ I implemented GetSmallests(List<int> list, int count), which repeatedly calls GetSmallest(List<int> list), adds the minimum value to a new list, and removes it from the original list until the required number of elements is collected. ✓ Key takeaways from this exercise: Breaking logic into smaller, focused methods Using while loops effectively Manipulating List<int> with Add and Remove All of these contribute to clearer, more reusable code when working with collections. #CSharp #DotNet #100DaysOfCode #Programming #Methods #Lists
To view or add a comment, sign in
-
-
Rust 1.93 is out. Highlights: - The deref_nullptr lint is now deny-by-default, and asm_cfg has been stabilized. - Stabilized String::into_raw_parts and Vec::into_raw_parts, alongside expanded MaybeUninit methods. - Removed internal Copy trait specialization to resolve unsafe lifetime dependencies. - cargo clean now fully supports the --workspace flag. #rustlang #software #programming
To view or add a comment, sign in
-
Before the compiler ever sees your C++ code, it goes through an important step called preprocessing. The preprocessor runs first and performs text-based transformations such as: • Expanding #include directives • Handling macros defined using #define • Enabling or disabling code using conditional compilation (#ifdef, #ifndef, #if 0) • Removing comments and preparing the code for compilation The result of this step is a translation unit, which is what the compiler actually compiles. Understanding the preprocessor helps demystify: • How header files really work • Why macros behave differently from variables and functions • How compile-time configuration is achieved in C++ 📘 I’ve written a beginner-friendly article over Substack explaining the C/C++ preprocessor in detail, with examples and practical insights. I have attatched link for article in comment. #CPP #Preprocessor #Macros #Programming
To view or add a comment, sign in
-
Day 15 of #100DaysOfCode with C# Today I practised working with generic lists and custom methods to process collections of numbers. Key lessons: - How to use `List<int>` from `System.Collections.Generic` to store a dynamic list of integers. - How to write methods like `GetSmallests(List<int> list, int count)` and `GetSmallest(List<int> list)` that take a list as input and return either a new list or a single value. - How `foreach` loops make it easy to iterate through the results and print each item cleanly. This exercise showed me how powerful it is to combine generics, methods, and loops to build reusable logic for working with collections in C#. #CSharp #DotNet #100DaysOfCode #Programming #Generics #Lists
To view or add a comment, sign in
-
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