Posts Tagged ‘dotnet’
[NDCOslo2024] No More SQLite: How to Write Tests With EF Core Using TestContainers – Daniel Ward
Amid the arduous arena of application assurance, where integration inspections intersect infrastructure intricacies, Daniel Ward, a .NET navigator and testing tactician, torpedoes the tired trope of SQLite as EF Core’s ersatz examiner. With a penchant for precision and a portfolio of pragmatic patterns, Daniel decries the discrepancies—dialect drifts, devious defaults—that delude developers into dubious dependability. His herald: TestContainers, a titan of transient testing, tethering true-to-type databases to dotnet diagnostics, ensuring examinations echo environments exactly.
Daniel dives direct: SQLite’s siren song—simplicity’s shadow—seduces with speed yet sabotages similitude, spawning spurious successes in schema shadows. Real realms revel in PostgreSQL or SQL Server; sans such sentinels, tests tantalize with triumphs that tumble in truth. His thesis: TestContainers triumphs, turbocharging temporaries—containers conjured cleanly, configured crisply—for credible, containerized corroboration.
Ditching the Decoy: Drawbacks of Database Doppelgangers
SQLite’s shortcomings spotlight starkly: syntax schisms—TOP versus LIMIT—thwart translations; transaction treatments transmute, transactions toggling differently. Daniel details dev database dilemmas: devious dependencies, drift-prone data, deployment drudgery. False flags flourish: tests triumph trivially, only to falter in flight, fostering fragile faith.
His horror stories: SQLite’s solitary schema swallows specifics, sans stored procedures or sequences; in-memory imposters ignore indexes, inflating illusions. Daniel’s decree: discard decoys for doppelgangers divine—TestContainers delivers, Docker-driven duplicates that duplicate dynamics deftly.
Containers as Champions: TestContainers’ Triumphs
TestContainers, Daniel declaims, democratizes diligence: NuGet-nimble, it nurtures nodes—Postgres pods, SQL Server ships—spinning sans setup strife. Benefits burgeon: bit-for-bit fidelity, flakeless flurries, fleet-footed forays. Reusability reigns: withReuse() recycles realms, reining runtime rigorously.
Daniel demos deftly: dotnet add package Testcontainers.PostgreSql; a builder begets a beast, beckoning a bespoke bastion. Connection strings cascade, EF contexts calibrate, tests transact transparently—Respawn resets, restoring rectitude routinely.
Precision in Practice: Pitfalls and Panaceas
Pitfalls persist: parallelism’s pandemonium, port pandemonium—Daniel dispels with Docker Desktop’s discipline, orchestration’s oversight. His heuristic: harness health checks, heed horizons—hundreds hum harmoniously, hovering at half-minutes for hordes.
Respawn’s renaissance: rollback routines, resetting relations rigorously, rectifying residue. Daniel’s distillation: TestContainers transmutes testing from torment to triumph, true tests tempering temper tantrums.
Links:
[NDCOslo2024] Kafka for .NET Developers – Ian Cooper
In the torrent of event-driven ecosystems, where streams supplant silos and resilience reigns, Ian Cooper, a polyglot architect and Brighter’s steward, demystifies Kafka for .NET artisans. As London’s #ldnug founder and a messaging maven, Ian unravels Kafka’s enigma—records, offsets, SerDes, schemas—from novice nods to nuanced integrations. His hour, a whirlwind of wisdom and wireframes, equips ensembles to embed Kafka as backbone, blending brokers with .NET’s breadth for robust, reactive realms.
Ian immerses immediately: Kafka, a distributed commit log, chronicles changes for consumption, contrasting queues’ ephemera. Born from LinkedIn’s logging ledger in 2011, it scaled to streams, spawning Connect for conduits and Flink for flows. Ian’s inflection: Kafka as nervous system, not notification nook—durable, disorderly, decentralized.
Unpacking the Pipeline: Kafka’s Primal Primitives
Kafka’s corpus: topics as ledgers, partitioned for parallelism, replicated for redundancy. Producers pen records—key-value payloads with headers—SerDes serializing strings or structs. Consumers cull via offsets, groups coordinating coordination, enabling elastic elasticity.
Ian illuminates inroads: Confluent’s Cloud for coddling, self-hosted for sovereignty. .NET’s ingress: Confluent.Kafka NuGet, crafting IProducer for publishes, IConsumer for pulls. His handler: await producer.ProduceAsync(topic, new Message {Key = key, Value = serialized}).
Schemas safeguard: registries register Avro or Protobuf, embedding IDs for evolution. Ian’s caveat: magic bytes mandate manual marshaling in .NET, yet compatibility curtails chaos.
Forging Flows: From Fundamentals to Flink Frontiers
Fundamentals flourish: idempotent producers preclude duplicates, transactions tether topics. Ian’s .NET nuance: transactions via BeginTransaction, committing confluences. Exactly-once semantics, once Java’s jewel, beckon .NET via Kafka Streams’ kin.
Connect catalyzes: sink sources to SQL, sources streams from files—redpanda’s kin for Kafka-less kinship. Flink forges further: stream processors paralleling data dances, yet .NET’s niche narrows to basics.
Ian’s interlude: brighter bridges, abstracting brokers for seamless swaps—Rabbit to Kafka—sans syntactic shifts.
Safeguarding Streams: Resilience and Realms
Resilience roots in replicas: in-sync sets (ISR) insure idempotence, unclean leader elections avert anarchy. Ian’s imperative: tune retention—time or tally—for traceability, not torrent.
His horizon: Kafka as canvas for CQRS, where commands commit, queries query—event sourcing’s engine.
Links:
[NDCOslo2024] Develop AI Agents with Semantic Kernel – Jakob Ehn
In the vanguard of generative paradigms, where language models orchestrate outcomes autonomously, Jakob Ehn, a seasoned solutions architect at Atea, illuminates Semantic Kernel’s symphony. A Microsoft MVP with a penchant for Azure and AI, Jakob unveils this open-source orchestrator—born in Microsoft’s copilot crucible—as a conduit for infusing intelligence into imperatives. His tutorial, threaded with live enactments, empowers .NET denizens to conjure agents that deliberate, delegate, and deliver, transcending prompts to proactive pursuits.
Jakob ignites with LLMs’ leap: from GPT’s generative gloss to agentic autonomy, where kernels coordinate calls, chaining capabilities contextually. Semantic Kernel, polyglot and potent, abstracts APIs into plugins, planners plot paths, memories mint moments—crafting copilots that converse, compute, and conclude sans ceaseless coding.
Foundations of Fusion: Kernel Configurations and Plugins
Semantic Kernel’s scaffold: a kernel encapsulating services—embeddings, chat completions—interfacing IConnectors for OpenAI or Azure. Jakob blueprints: var builder = Kernel.CreateBuilder(); builder.AddAzureOpenAIChatCompletion(…), yielding a kernel primed for prompts.
Plugins propel: native .NET assemblies or OpenAPI schemas, exposing functions as facets. Jakob instantiates: a weather plugin with GetForecastAsync, invoked via kernel.InvokeAsync. Semantic functions, YAML-yielded, infuse prompts with placeholders: “Current weather in {location}?”—blending blueprints with brains.
Memories memorialize: volatile or vectorized, persisting precedents for pertinence. Jakob’s vector store—Chroma—embeds episodes, retrieving resonances via similarity searches, enriching responses with recency.
Planners and Agents: Autonomous Assemblies
Planners pioneer paths: Sequential, Stepwise, or Action—dissecting directives into doables. Jakob’s Action planner: given “Book a flight,” it inventories functions—search, reserve—sequencing sans stalemates. Handles, he highlights, hallucination hurdles, grounding goals in grapples.
Agents amplify: collaborative cohorts, each expert in ethos—developer drafts, organizer oversees. Jakob’s ensemble: a proposal pipeline, where agents iterate abstracts, incorporating critiques conversationally. Semantic functions script sagas: “Revise to {limit} words, include {term}”—looping lucidly.
His demo: a conference copilot, soliciting sessions, surfacing summaries—agents alchemizing APIs into anecdotes.
Horizons and Hurdles: Refinements and Realities
Jakob tempers triumph: kernels kindle complexity—prompt precision, plugin parity. Yet, prospects gleam: multi-modal melds, enterprise embeddings. His behest: experiment, embracing Semantic Kernel’s scaffold to sculpt sentient solutions.
Links:
[NDCOslo2024] Designing for Change with Vertical Slice Architecture – Chris Sainty
In the ever-shifting sands of software demands, where agility trumps rigidity and evolution outpaces stasis, Chris Sainty, a distinguished software architect and Microsoft MVP, advocates for a paradigm that embraces flux: Vertical Slice Architecture (VSA). With a wealth of experience in .NET ecosystems, Chris dissects the frailties of conventional layered paradigms, illuminating how VSA fosters adaptability, accelerates onboarding, and scales with success. His exposition, laced with pragmatic examples, challenges developers to reimagine structures that prioritize features over foundations, ensuring applications remain responsive to the inexorable tide of transformation.
Chris commences by lauding the endurance of layered architectures—presentation atop business logic atop data—yet probes their perils in contemporary contexts. As customer whims whirl and scaling surges demand swift pivots, layers ossify into obstacles, encumbering change with cross-tier tangles. VSA, conversely, carves applications into self-contained verticals—end-to-end features encapsulating all concerns—streamlining modifications and magnifying modularity. This feature-centric ethos, Chris argues, aligns with modern mandates: rapid iterations, effortless extensions, and intuitive ingress for new contributors.
Deconstructing Layers: Pitfalls of Traditional Tiering
Layered designs, Chris elucidates, excel in abstraction but falter in flux. Modifications ripple across strata—tweaking data access mandates presentation perturbations—breeding brittle bonds. Scaling amplifies agony: monolithic services swell, onboarding overwhelms with navigational nightmares. Chris recounts teams ensnared in “god classes,” where logic leeches into controllers, defying single-responsibility tenets.
VSA liberates by slicing vertically: each feature owns its orchestration, from input validation to persistence, minimizing interdependencies. In ASP.NET Core, MediatR handlers embody this, encapsulating requests with validators, mappers, and repositories. Chris demonstrates: a “Create Order” vertical integrates all facets sans layer leaks, easing evolution as requirements refine.
Trade-offs temper triumph: VSA risks redundancy in shared utilities, yet Chris counters with judicious extraction—domain entities for rules, infrastructure abstractions for emails—preserving purity without proliferation. His verdict: layers for legacy, VSA for vitality.
Embracing Verticals: Accelerating Agility and Onboarding
VSA’s virtues shine in speed: altering a feature confines chaos to its silo, slashing cycle times. Chris illustrates with e-commerce: updating checkout logic spans one slice, not sprawling services. Onboarding accelerates—newcomers grasp endpoints holistically, sans layer labyrinths—fostering faster fluency.
Scaling surges seamlessly: verticals deploy independently, microservices materialize modularly. Chris cautions misconceptions: VSA isn’t anarchy—tests tether slices, conventions coerce cohesion. In .NET, minimal APIs map verticals directly, ditching controllers for clarity.
His horizon: VSA as mindset, marrying DDD’s domains with feature focus, empowering teams to thrive amid tumult.
Navigating Nuances: Sharing Savvy and Strategic Choices
Code sharing, a VSA specter, resolves via domains: encapsulate business invariants—aggregates, entities—reusable across verticals, insulating infrastructure. Chris debunks duplication dogmas: external concerns like databases or notifications warrant abstraction, not replication, ensuring efficiency without entanglement.
Strategic selection: VSA suits volatile domains; layers linger in stable spheres. Chris’s compass: assess change cadence—frequent flux favors verticals.
Forging Forward: Building for the Inevitable
Chris’s capstone: architectures architect for alteration. VSA, with its slice-centric simplicity, equips ensembles to navigate novelty, nurturing nimble, navigable codebases that celebrate change.
Links:
[NDCOslo2024] Running .NET on the NES – Jonathan Peppers
In a whimsical fusion of nostalgia and innovation, Jonathan Peppers, a principal software engineer at Microsoft, embarks on an audacious quest: running .NET on the Nintendo Entertainment System (NES), a 1985 gaming relic powered by a 6502 microprocessor. With a career steeped in .NET for Android and .NET MAUI, Jonathan’s side project is a playful yet profound exploration of cross-platform ingenuity, blending reverse engineering, opcode alchemy, and MSIL wizardry. His journey, shared with infectious enthusiasm, unveils the intricacies of adapting modern frameworks to vintage hardware, offering lessons in creativity and constraint.
Jonathan opens with a nod to the NES’s cultural cachet—a living room arcade for a generation. Its modest specs—less than 2 MHz, 52 colors, and minuscule cartridges—contrast starkly with today’s computational behemoths. Yet, this disparity fuels his ambition: to compile C# into 6502 assembly, enabling .NET to animate pixels on a 256×240 canvas. Through meticulous reverse engineering and bespoke compilers, Jonathan bridges eras, inviting developers to ponder the portability of modern tools.
Decoding the NES: Reverse Engineering and Opcode Orchestration
The NES’s heart, the 6502 microprocessor, speaks a language of opcodes—terse instructions dictating arithmetic and flow. Jonathan recounts his reverse-engineering odyssey, dissecting ROMs to map their logic. His approach: transform C#’s intermediate language (MSIL) into 6502 opcodes, navigating the absence of high-level constructs like methods or garbage collection. By crafting a custom compiler, he translates simple C# programs—think console outputs—into assembly, leveraging the NES’s 2KB RAM and 8-bit constraints.
Challenges abound: switch statements falter, branching logic stumbles, and closures remain elusive. Yet, Jonathan’s demos—a flickering sprite, a basic loop—prove viability. His toolkit, open-sourced on GitHub, invites contributions, with a human-crafted logo replacing an AI-generated predecessor. This endeavor, while not production-ready, showcases the power of constraints to spark innovation, echoing the NES’s own era of elegant simplicity.
Bridging Eras: Lessons in Cross-Platform Creativity
Jonathan’s experiment transcends mere novelty, illuminating cross-platform principles. The NES, with its rigid architecture, mirrors edge devices where resources are scarce. His compiler, mapping .NET’s abstractions to 6502’s austerity, mirrors modern efforts in WebAssembly or IoT. Structs, feasible sans garbage collection, hint at future expansions, while his call for pull requests fosters a collaborative ethos.
His reflection: constraints breed clarity. By stripping .NET to its essence, Jonathan uncovers universal truths about code portability, urging developers to question assumptions and embrace unconventional platforms. His vision—a C# Mario clone—remains aspirational, yet the journey underscores that even vintage hardware can host modern marvels with enough ingenuity.