all Codit insights

Key Takeaways from VisugXL 2024

Last week, a group of Coditers attended VisugXL, an incredible event for .NET and Azure enthusiasts. The sessions covered a broad spectrum of topics, from sharpening performance skills to tackling real-world challenges in microservices architecture. Here are their key takeaways from this experience.

Help! As a .NET Developer, I'm Afraid of Drowning in That Big Lake of Data Stuff

Ruben Delange guided us through the often-intimidating world of data engineering for .NET developers, emphasizing collaboration with data professionals.

Key Takeaways:

  1. Start Small: Focus on one aspect of the data landscape, such as understanding data lakes, and expand your knowledge from there.
  2. Learn the Language: Understanding the terminology used by data engineers is crucial for effective collaboration.
  3. Leverage Azure Tools: Azure Synapse, Data Factory, and Data Lake Storage were highlighted as excellent starting points for managing and analyzing data.

This session served as a great refresher for concepts learned during DP-900 certification preparation.

A Season for Speed: Turning Puzzles into C# Performance Wins

Inspired by Advent of Code, Michaël Hompus demonstrated how solving puzzles can help optimize C# performance.

Key Takeaways:

  1. Optimize Wisely: Chasing ultimate efficiency can be fun, but avoid overly specific optimizations that make code brittle.
  2. Benchmarking Matters: Use tools like BenchmarkDotNet to analyze and improve code performance systematically.
  3. Loop Optimization:
    For loops are generally faster than foreach
  4. LINQ Trade-offs: LINQ offers cleaner code but can be slower than manual alternatives.
  5. Array Access: Store array elements in local variables if values don’t change to reduce access costs.
  6. Pointers and HashSets: While pointers aren’t inherently faster, they can improve performance with techniques like the two-pointer method. Similarly, HashSets enhance computation speed but increase memory usage.
  7. Input Parsing and 2D Arrays: Using Span  for input parsing delivers substantial performance gains. When iterating through a 2D array, a foreach loop can be faster due to compiler optimizations.

Overall, while making code efficient can be fun, there is a point where the code becomes so specific that one small change can break everything.

10 Things You Didn’t Know EF Core Can Do

Hannes Lowette delivered an engaging, interactive session showcasing lesser-known features of EF Core in the .NET 8 era.

Key Takeaways:

1. HierarchyId: A handy feature for storing and querying tree structures in SQL Server.
Source: https://www.sqlservercentral.com/articles/the-hierarchyid-datatype-in-sql-server-2008

2. Many-to-Many Relationships in EF Core:

  • EF Core can handle many-to-many relationships without explicitly defining a join entity in your models.
  • If you have an existing database with a join entity, EF Core provides flexibility:
    • You can declare properties of the join entity in the ModelBuilder, enabling smooth migrations from older database structures without creating a new table.
    • This approach also allows you to fully control the join entity in SQL while keeping it out of your EF Core models, avoiding unnecessary complexity.

For the people who are interested in this topic i found the exact recording of session: https://youtu.be/Qn9oCsMJN-c?si=FDLdlDR_h9tBZBZp&t=2614

Orchestration vs. Choreography: The Good, the Bad, and the Trade-offs

Laila Bougria broke down the complexities of managing service interactions in microservice architectures using orchestration and choreography.

Key Takeaways:

  1. Use Cases: Payment processing and fraud detection were real-world examples that highlighted the trade-offs between the two patterns.
  2. Decision Making: Choose orchestration for centralized control and choreography for loose coupling.
  3. Detailed Insights:
    • Orchestration involves centralized control, where a single orchestrator directs the flow of interactions and ensures strict sequencing.
    • Choreography relies on decentralized coordination, with services reacting to events independently, enabling looser coupling.
  4. Decision Framework:
    • Communication Type:
      Orchestration: Best suited for synchronous communication requiring strict sequencing.
      Choreography: Preferred for asynchronous communication and eventual consistency.
    • Complex Prerequisites:
      Orchestration: Ideal for workflows with multiple steps requiring centralized control.
      Choreography: Better suited for distributed workflows where steps are triggered by independent events.
    • Compensating Flows:
      Orchestration: Handles complex compensations across services more effectively.
      Choreography: Simpler compensations integrate naturally through event chaining.
    • Probability of Change:
      Orchestration: Suitable for stable domains with fewer changes.
      Choreography: Adapts better to dynamic domains with frequent updates.

This talk clarified abstract concepts with tangible examples, making them easier to grasp.

Safety First! Low-Level C# Without the Unsafe Keyword

In this interesting session, Wesley Cabus showcased how to harness C#’s modern capabilities to rewrite low-level code while maintaining safety.

Key Takeaways:

1. Safe Alternatives: Use Span<T>> and Memory<T> for type-safe memory and pointer handling.

2. Performance Parity: “Safe” code often uses pointers under the hood, meaning the performance gap between safe and unsafe code is narrower than expected.

3. Understanding Unsafe Code:

  • “Unsafe” doesn’t mean unsafe to use—it means the compiler can’t guarantee memory safety.
  • Even safe C# code frequently compiles to pointer-based operations in the CLR, which explains why unsafe code can sometimes be faster.

Wesley’s example of porting the game Doom from C to C# showcased C#’s potential for translating low-level C code while staying in the safe space. While not directly applicable to what we do at Codit, it was an inspiring demonstration of C#’s capabilities.

To Moq or Not to Stub, That Is the Question

Ben Luts delivered a thought-provoking session on modern testing practices, challenging traditional unit testing norms.

Key Takeaways:

1. Rethinking Unit Tests:

  • Traditional unit tests often focus on individual methods. Ben argued that unit tests should focus on testing in isolation, not on method granularity.
  • He advocated for testing full business flows via the public API to validate end-to-end logic, ensuring the entire process works as expected. This is because sometimes all the methods are correct, but some error inbetween them exist making the flow fail, from:To:

While this approach catches flow-level issues, it may struggle to pinpoint regressions caused by smaller changes.

2. Testing Tools and Techniques:

  • Consider alternatives to Moq, such as NSubstitute, for mocking dependencies.
  • Use WebApplicationFactory to spin up APIs for integration testing of endpoints.

3. Beyond Unit-Testing Methods:

  • Instead of testing isolated methods, focus on testing full business flows to validate end-to-end logic.

While testing full business flows ensures business logic integrity, method-level tests are useful for quickly spotting regressions—especially when large commits introduce multiple changes. Both approaches have their merits, and combining them may provide a more robust testing strategy.

Final Thoughts

Visug XL 2024 was a mix of learning, networking, and inspiration. The diverse topics ensured there was something for everyone, whether you’re diving into EF Core or optimizing performance in C#.

For any .NET or Azure professional, Visug XL is a must-attend event to stay ahead in your field. We’ll be there for more next year!

Subscribe to our RSS feed

Hi there,
how can we help?

Got a project in mind?

Connect with us

Let's talk

Let's talk

Thanks, we'll be in touch soon!

Call us

Thanks, we've sent the link to your inbox

Invalid email address

Submit

Your download should start shortly!

Stay in Touch - Subscribe to Our Newsletter

Keep up to date with industry trends, events and the latest customer stories

Invalid email address

Submit

Great you’re on the list!