DevSight Technical Blog

website·Indexed 30 days ago

https://devsight.kr/

A technical knowledge base featuring programming guides and examples across C#, .NET, Rust, C++, and Go. Topics include concurrency in C# and Rust, .NET 8.0 LibraryImport, WPF dependency injection, Rust error handling and generics, Qt/C++ signals and slots, and database management with SQL Server, PostgreSQL, and MongoDB.

Tokens
76.5K
Snippets
301
Records
347
Agent score
54%

What's inside DevSight

  1. Overview of SQL Server In-Memory OLTP

    In-Memory OLTP is a technology in SQL Server and SQL Database designed to optimize performance for transaction processing, data ingestion, data load, and transient data scenarios. It can provide 5-30x performance improvements over traditional disk-based tables. It is particularly useful for high-throughput/low-latency transactions, IoT data ingestion, caching, session state management, Tempdb object replacement, and ETL processes. Its speed is derived from a lock-free and latch-free architecture, native compilation, and memory tables where rows are linked via indexes (such as Hash indexes).
  2. Overview of Rust language characteristics

    Rust is a modern systems programming language designed to provide performance comparable to C/C++ while eliminating memory errors. Key architectural features include:

    • Polymorphism: Achieved via Traits instead of classes.
    • Type System: Influenced by functional programming languages.
    • Extensibility: Supports language expansion through macros.
    • Modularity: Uses a module system where units are bundled into 'Crates' (executables or libraries).
    • Package Management: Uses Cargo for automated building, package distribution, and dependency management.
  3. Overview of popular Rust Web Frameworks

    Commonly used web frameworks in the Rust ecosystem include:

    • Actix Web
    • Axum
    • Rocket
    • Warp
    • Poem

    According to TechEmpower Benchmark (Round 21), Actix-web and Axum are among the top performers, frequently recording higher requests per second and lower latency than ASP.NET Core, Spring Boot, and Express.js.

    FrameworkLanguageReq/secLatency (ms)CPU Usage
    Actix-webRust748,0511.798%
    AxumRust723,8921.897%
    ASP.NET CoreC#692,3452.195%
  4. Understand C# Native AOT for code protection

    Standard C# compilation produces Intermediate Language (IL), which is translated to machine code at runtime by the JIT (Just-In-Time) compiler. This makes the binaries susceptible to decompilation using tools like ILSpy. Native AOT (Ahead-of-Time) compilation translates the code into native machine code at build time, effectively preventing IL-based decompilation. Note that while AOT hides the source structure, static strings may still be visible via hex editors and may require additional obfuscation (e.g., using C++, Zig, or Rust libraries).
  5. C# Concurrency Concepts Overview

    Key concurrency definitions in the .NET ecosystem:

    • Concurrency: Doing more than one thing at a time.
    • Multithreading: A form of concurrency using multiple threads of execution.
    • Parallel Processing: Dividing a large amount of work among multiple concurrent threads.
    • Asynchronous Programming: Using futures (Tasks) or callbacks to avoid blocking threads.
    • Reactive Programming: A declarative style where the application reacts to events.
  6. Implement object communication using Qt Signals and Slots

    Signals and Slots are a core feature of Qt used for communication between objects. This mechanism is conceptually similar to 'message-message handler' or 'event-event handler' patterns found in other development languages. To establish a connection between a signal and a slot, the connect() function is used, which supports both function pointers and lambda expressions.
  7. Compare Rust Web Frameworks for Backend Development

    When choosing a Rust web framework, consider the trade-offs between performance, ease of use, and ecosystem maturity:

    • Actix Web: Highest performance (top-tier throughput, low latency) using an Actor-based architecture. It has the most mature ecosystem but a steeper learning curve due to its complexity.
    • Axum: Built on Tokio, Hyper, and Tower. It is highly recommended for most users because it balances high performance with a macro-free, intuitive API that is friendly to Rust beginners.
    • Rocket: Focuses on type-safe routing and developer experience with a very friendly API, though slightly slower than Actix.
    • Warp: Uses a filter-based compositional design; very lightweight and flexible, but has a unique learning curve regarding filter chaining.
    • Poem: A minimalist framework focusing on simplicity and ease of use.
  8. Architecture for calling Native Libraries (C++, Rust, Zig) from C#

    For high-performance or AOT-focused scenarios, a layered architecture is recommended to bridge managed and unmanaged code:

    1. Native Library: The core logic implemented in C++, Rust, or Zig (e.g., CppNative.dll, rust_native.dll, zig_native.dll).
    2. Unmanaged C# (AOT): A wrapper layer (e.g., ConsoleAppNative.dll) that handles the low-level interop.
    3. Managed C#: The main application (e.g., ConsoleApp.exe) that consumes the wrapper.
  9. Implement the Result Pattern in C# to handle errors without exceptions

    The Result Pattern is a design pattern used in C# to explicitly handle success or failure states by returning a structured object instead of throwing exceptions. This approach improves code readability, maintainability, and predictability by encapsulating 'success data' and 'failure error information' into a single return object, drawing from functional programming principles.
  10. Understand CQRS pattern principles in C#

    CQRS (Command and Query Responsibility Segregation) is a pattern that separates read and update operations for a data store to maximize performance, scalability, and security. The core principle is using different models for updating information versus querying it. To avoid unnecessary complexity, CQRS should be applied only within specific Bounded Contexts rather than across the entire system, as each Bounded Context requires individual modeling.
  11. Understand C# Delegates for callbacks and event listeners

    A Delegate in C# is a type-safe function pointer used within the Common Language Infrastructure (CLI). It allows methods to be referenced and called dynamically, enabling the implementation of callbacks and event listeners. Essentially, delegates allow functions to be treated as variables or passed as parameters to other functions, similar to function pointers in C++.
  12. Understand Template Metaprogramming (TMP) concepts

    Template Metaprogramming (TMP) is a technique in C++ where templates are used to make the compiler generate code during the compilation process. By determining values and logic at compile-time, TMP reduces the amount of calculation required at runtime, which can significantly improve program execution speed. While TMP can be difficult to implement and debug, it is widely used in C++ libraries to catch errors at compile-time and optimize performance. Similar concepts in C# include Generic Specialization and Source Generators.