Interview Handbook by Sayed Elmahdy English

المحور 34 · Bonus: اختياري بس بيفرق

مواضيع متقدمة (Bonus)

Event Sourcing، و GraphQL، و Blazor، و Actor model و Orleans، و Dapr، و Feature flags، و WebAssembly، و gRPC streaming.

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

15 سؤالMid · 8Senior · 710 اختيارات

المفاهيم

هنفهم إيه؟ هنستكشف اختيارات متقدمة لما تظهر حاجة فعلية: تتبع تاريخ الطلب، تشكيل رد ، تفاعل واجهة، تنسيق شغل موزع أو توجيه traffic. كل بطاقة تبدأ بالمشكلة ثم توضح إمتى التقنية تفيد وما تكلفه تشغيلها.

قبل ما تبدأ: يفيدك فهم APIs و وdependency injection وتشغيل service. event هو واقعة حصلت، و وسيط يستقبل الطلب ويوجهه لخدمة؛ أما actor/grain فكيان يستقبل رسائل ويدير حالته. البطاقات اختيارية ومستقلة، ابدأ بالمشكلة الأقرب لشغلك.

المصطلحات اللي تحتها خط منقّط تقدر تضغط عليها لمعرفة معناها، وترجع تكمل من نفس مكانك.

#Event sourcing: الأحداث هي مصدر الحقيقةBonusEvent sourcing: events as the source of truth

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

مثال خطوة بخطوة
  1. بدل حفظ رصيد 70 فقط، تحفظ أحداثًا مثل إيداع 100 ثم سحب 30. تطبيق الأحداث بالترتيب ينتج الحالة الحالية 70.
  2. الأحداث هي سجل الحقيقة في ؛ شاشة الرصيد قد تقرأ مبنية منه. إضافة event في سجل تشخيص بجوار جدول الحالة لا تجعل التصميم event sourcing.
  3. إعادة البناء لا تعني إعادة تنفيذ خصم خارجي أو إرسال إيميل قديم. افصل بناء الحالة عن الآثار الخارجية، وخطط لتطور شكل الأحداث ووقت إعادة تشغيلها قبل اختيار التصميم.

لو لازم تعرف مش بس رصيد الطلب الحالي، لكن كمان كل انتقال حصل وإمتى وليه، event sourcing بيخزّن سلسلة events بدل استبدال الحالة الحالية. بنعيد بناء state من الأحداث، ونعمل projections للقراءة. ده مختلف عن audit log جنب جدول هو لسه مصدر الحقيقة.

ده C# sketch للـ replay فقط، مش event store جاهز؛ الـ append الحقيقي محتاج stream version وexpected-version check ذري.

public abstract record OrderEvent;
public sealed record OrderPlaced(decimal Total) : OrderEvent;
public sealed record OrderCancelled : OrderEvent;

public sealed class OrderState
{
    public decimal Total { get; private set; }
    public bool Cancelled { get; private set; }

    public void Apply(OrderEvent e) // (1)
    {
        switch (e)
        {
            case OrderPlaced placed: Total = placed.Total; break;
            case OrderCancelled: Cancelled = true; break;
        }
    }
}

var state = new OrderState();
foreach (var e in history) state.Apply(e); // (2): history is ordered OrderEvent data
🧾 شرح الكود
  1. (1) Apply يعيد state بس؛ ممنوع يبعت email أو charge أثناء replay. التحقق من command قبل إنشاء event جديد، مش إعادة رفض حدث تاريخي لأن قواعد النهارده اتغيرت.
  2. (2) الترتيب لكل stream مهم. snapshot يختصر replay لكنه مشتق من الأحداث، وله version.

هتدفع تكلفة evolution وupcasters، وprojection lag وإعادة البناء، وحذف بيانات شخصية من تاريخ طويل. ماتستخدموش لمجرد عادي أو علشان «الأحداث حديثة». event sourcing مش شرط لـ ، والعكس صحيح.

#GraphQL في .NET مقابل RESTBonusGraphQL in .NET versus REST

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لو تطبيق الموبايل والويب محتاجين أشكال مختلفة من نفس الداتا، GraphQL بيسمح للعميل يختار fields من typed. Hot Chocolate implementation للـ server في . يفضل مناسب لعقود بسيطة و caching وأوامر business واضحة؛ الاختيار مش مسابقة مين أحدث.

# GraphQL operation against an illustrative store schema
query {
  order(id: "123") {
    id
    lines { quantity product { name } }
  }
}

كل resolver ممكن يعمل query، فيظهر . DataLoader يجمع قراءات بالمفاتيح داخل نطاق الطلب، و يحد الأعمدة. حط pagination وحدود للـ depth والـ cost، وطبّق authorization على الموارد والـ fields. أقل HTTP requests مش معناه أقل work. ماتشاركش DataLoader cache بين tenants. الـ schema دي مثال عقد، مش ملف C# مكتمل.

RESTGraphQL
شكل الردالسيرفر يعرّفه لكل endpointالعميل يختار من schema
CacheHTTP semantics مباشرة عادةًمحتاج سياسة operation وresponse واعية
التكلفةover-fetching محتملquery cost وresolver complexity

#Blazor render modes لمهندس backendBonusBlazor render modes for backend developers

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

Blazor Web App يقدر يختار مكان تنفيذ تفاعل components. ده قرار تشغيل وأمان و، مش مجرد اختيار شكل الصفحة.

Modeالتنفيذالـ trade-off
Static SSR من السيرفر من غير تفاعل Blazorخفيف؛ التفاعل محتاج آلية تانية
Interactive Servercomponent على السيرفر والتحديثات عبر SignalRتحميل أولي أصغر؛ اتصال وذاكرة circuit وnetwork latency
Interactive في المتصفحتحميل runtime وapp؛ الـ backend يتعامل مع client غير موثوق
Interactive AutoServer أولًا، وWebAssembly في زيارات لاحقة بعد تجهيز الـ bundleتحتاج كود وservices مناسبة للبيئتين

Auto مش نقل component شغالة من السيرفر للمتصفح في نص الجلسة. interactive modes بتدعم prerendering افتراضيًا؛ data loading ممكن يحصل في مرحلتين، فخطط للـ state ومنع side effects المكررة. الأسرار والـ authorization مكانهم السيرفر مهما كان الـ mode.

@* In a .razor component after enabling the mode in the Blazor host. *@
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@rendermode InteractiveServer
<button @onclick="Increment">Items: @count</button>
@code {
    private int count;
    private void Increment() => count++;
}

#Actor model وMicrosoft OrleansBonusThe actor model and Microsoft Orleans

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لو عندك state وسلوك لكل كيان، زي حجز أو عربة، الـ actor بيخلّي كل كيان يستقبل رسائل بدل threads تعدّل نفس الـ memory. Orleans بيقدّم virtual actors اسمها grains: هوية مستقرة وactivation يديرها runtime، وتوزيع على silos.

Client -> Grain reference (BookingId) -> active grain on a silo
                                         |
                                  explicit persistent state
Silo failure -> later activation elsewhere -> reload persisted state

الـ default scheduling بيسلسل requests للـ grain العادية؛ reentrancy وإعدادات التداخل بتغيّر الـ reasoning وبتحتاج فهم. ده مش تلقائية بين كذا grain، ومش حفظ تلقائي لكل field. صمّم persistence و وtimeouts. كيان واحد عليه load عالي ممكن يبقى hot grain؛ Orleans مش بيحل مشكلة key واحد بإضافة servers بس. بسيط غالبًا أسهل من غير cluster إضافية.

#Dapr building blocksBonus

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لما services بلغات مختلفة محتاجة invocation وpub/sub وstate، Dapr بيعرض موحّدة قدام components بتوصل لمزوّدين مختلفين. في deployment شائع التطبيق بيكلم sidecar عبر أو. الـ والـ state store لسه موجودين وبتدير إعداداتهم.

Building blockالاستخدام
Service invocationنداء service بالـ app ID مع discovery
Pub/subنشر واستهلاك events عبر component
Statekey-value state مع قدرات حسب الـ store
Secrets وbindingsقراءة أسرار وربط أنظمة خارجية
Actors وworkflowsتنظيم state وسير عمل طويل العمر

الـ abstraction مش ضمان إن كل store يدعم نفس أو consistency. اختبر component metadata والـ retries والـ والصلاحيات. تكلفة sidecar والتشغيل والتشخيص ممكن مايبقاش لها عائد في API واحدة بسيطة. Aspire للتنسيق المحلي وservice defaults؛ مش بديل تلقائي لـ Dapr runtime.

#Feature flags: فصل deploy عن releaseBonusFeature flags: separating deployment from release

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لو عايز تنشر الكود وتفتحه تدريجيًا، يحدد مين يشوف السلوك الجديد. Microsoft.FeatureManagement بيوفّر evaluation وfilters وvariants. الـ flag مش authorization؛ لسه افحص صلاحية المستخدم.

المثال service fragment بعد تسجيل services.AddFeatureManagement()، و features نوعه IVariantFeatureManager، ودوال rendering هي دوال التطبيق.

using Microsoft.FeatureManagement;

bool useNewCheckout = await features.IsEnabledAsync("NewCheckout"); // (1)
return useNewCheckout
    ? RenderNewCheckout()
    : RenderCurrentCheckout();                                     // (2)
🧾 شرح الكود
  1. (1) بنقيّم flag مرة للقرار؛ لو محتاج ثبات خلال request راجع snapshot evaluation. targeting لازم identity مستقرة من مصدر موثوق.
  2. (2) المسارين لازم يتاختبروا. kill switch يوقف سلوك مستقبلي؛ مش بيرجع migration أو refund اتنفذ.

لكل flag owner وسبب وموعد إزالة. راقب cohort وتأثيره، وخطط لسلوك آمن لو config مش متاحة. كثرة flags تزود عدد التركيبات اللي محتاجة اختبار.

#WebAssembly وWASI باختصارBonusWebAssembly and WASI briefly

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

صيغة تنفيذ portable بيشغّلها runtime، في المتصفح أو خارجه. مفيد لبعض plugins أو كود مشترك أو workloads محتاجة sandbox. مجموعة interfaces للوصول لقدرات النظام من WebAssembly حسب host وإصدار الـ interface، مش نظام تشغيل كامل.

Compiled module -> Wasm runtime -> explicitly granted host capabilities
Browser host: browser APIs and interop rules
WASI host: supported WASI interfaces and configured capabilities
Check .NET toolchain, runtime, interface version and package compatibility.

Sandbox مش تصريح بإهمال التحديثات وحدود والـ memory. ماتحطش secret في client bundle، وماتفترضش إن أي NuGet package أو أي app هتشتغل WASI من غير تعديل. تفاصيل دعم وWASI بتتغير؛ افحص tooling المستهدف بدل وعد «شغّال في كل مكان».

#gRPC streaming وعمر الاتصالBonusgRPC streaming and connection lifetime

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لو العميل محتاج progress متتابع أو stream من الأحداث، يدعم unary، وserver streaming، وclient streaming، وbidirectional streaming. العقد في proto والـ C# بيتولد منه. المثال server streaming محدود، مش durable event subscription.

syntax = "proto3";
option csharp_namespace = "Store.Contracts";
service Progress { rpc Watch (WatchRequest) returns (stream ProgressReply); }
message WatchRequest { string order_id = 1; }
message ProgressReply { int32 percent = 1; }
// In a Grpc.AspNetCore project with C# generated from the proto above.
using Grpc.Core;
using Store.Contracts;

public sealed class ProgressService : Progress.ProgressBase
{
    public override async Task Watch(WatchRequest request,
        IServerStreamWriter<ProgressReply> stream, ServerCallContext context)
    {
        for (int n = 0; n <= 100; n += 25)
        {
            context.CancellationToken.ThrowIfCancellationRequested(); // (1)
            await stream.WriteAsync(new ProgressReply { Percent = n }); // (2)
            await Task.Delay(100, context.CancellationToken);
        }
    }
}
🧾 شرح الكود
  1. (1) الإلغاء والـ deadline يحدّوا عمر الشغل. قبل stream حقيقي افحص ملكية order؛ المثال بيانات ثابتة بس.
  2. (2) await لكل write، وكاتب واحد للـ stream. ماتراكمش رسائل في memory بلا حد لو العميل بطيء.

راجع proxy timeouts و/2 support. المتصفح محتاج gRPC-Web أو بديل؛ gRPC-Web مش بيوفر client streaming وbidirectional streaming زي native gRPC. reconnect محتاج resume cursor وdedup لو فقد الأحداث غير مقبول؛ فتح اتصال تاني لوحده مش replay.

#YARP كـ reverse proxyBonusYARP as a reverse proxy

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

لو محتاج route جزء من الطلبات لخدمة جديدة والباقي لنظام قديم، مكتبة داخل . route بتطابق الطلب، وcluster بتحدد destinations وسياسة توزيع. مفيد في migration تدريجي أو gateway مخصص، لكن تشغيله مسؤوليتك.

المثال لـ package Yarp.ReverseProxy مع section اسمها ReverseProxy فيها routes وclusters متحقّق منها؛ المقطع لوحده مش بيعرّف destination.

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
    .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); // (1)
var app = builder.Build();
app.MapReverseProxy();                                               // (2)
app.Run();
🧾 شرح الكود
  1. (1) تحميل إعدادات routing؛ ما تسمحش للعميل يختار destination عشوائي علشان مايبقاش open proxy أو .
  2. (2) تسجيل proxy endpoints. ضيف authentication وauthorization حسب التصميم، والـ destination لسه لازم تتحقق من الصلاحيات.

راجع forwarded headers من proxies موثوقة فقط، والـ والـ والـ timeouts والـ request size، و propagation. Reverse proxy مش service mesh أو WAF كامل تلقائيًا. لو managed gateway بيغطي المطلوب، custom proxy ممكن يزوّد عبء من غير فائدة.

#Hangfire وQuartz وTemporalBonusHangfire, Quartz and Temporal

اختياري بس بيفرق: مش هيتسأل فيه في كل انترفيو، بس معرفته بتعمّق فهمك وبتميّزك عن غيرك.

Task.Run داخل request مش job system: process ممكن يقف والـ scope يتقفل. اختار الأداة حسب هل محتاج job محفوظ، ولا scheduling غني، ولا workflow طويل بيستعيد تقدمه.

الأداةمناسبة لـاللي لازم تديره
Hangfirepersisted background jobs وretries وdashboardstorage وworkers و وتأمين dashboard؛ بعض المزايا التجارية منفصلة
Quartz.NETjobs وtriggers وcalendars وmisfire policiespersistent store وclustering حسب الحاجة؛ workflow business منطقك أنت
Temporaldurable workflows فيها انتظار وتنسيق وتعافيservice وworkers وhistory وversioning؛ deterministic workflow code

في Temporal حط والـ side effects في activities. workflow بيرجع يتنفذ من history، فمتستخدمش clock أو randomness أو عشوائي فيه؛ استخدم primitives. activities ممكن تعاد، فلازم idempotency. في كل الأدوات: راقب عمر أقدم job، والفشل والـ retries، واستخدم لو لازم ربط enqueue بـ business .

أسئلة الانترفيو

راجع فهمك

ليه الاختيار ده مناسب؟ إمتى ممكن ماينفعش؟ وإيه اللي هيتغير لو الحمل زاد أو ظهر فشل؟

34.1When would you choose event sourcing?Senior

لما التاريخ وإعادة بناء الحالة في وقت سابق جزء أساسي من المجال، والفريق قادر يدير evolution وprojections. مش مجرد علشان عايز audit log أو .

الإجابة النموذجية (English)

I consider when the history of business transitions is central, and rebuilding or deriving state from that history provides concrete value. I store events as the authoritative record and build read projections, with expected-version checks for concurrent writes. I also budget for event evolution, replay testing, lag and personal-data handling. For ordinary with modest audit requirements, a current-state model and an audit trail may be simpler. alone does not require event sourcing.

34.2How do you replay events safely?Senior

Replay يطبق facts على state بس، من غير email أو charge. snapshots مشتقة ومُنسخة. events القديمة محتاجة compatibility أو upcasters، والـ command validation منفصلة عن Apply.

الإجابة النموذجية (English)

I keep event application deterministic and free of external side effects, so replay cannot resend emails or charge customers. Commands are validated before new events are appended; historical facts are not revalidated against today's business rules. I version event contracts and use tested compatibility transformations where needed. Snapshots accelerate reconstruction but remain disposable derived state. I test rebuilding projections from history and define how live traffic is handled while a new catches up before switching reads.

34.3When would GraphQL be useful compared with REST?Mid

لما clients مختلفة محتاجة response shapes مختلفة من graph مترابطة. أبسط لعقود محددة و semantics. GraphQL محتاج authorization وquery cost controls، مش أداء أسرع تلقائيًا.

الإجابة النموذجية (English)

I consider GraphQL when several clients need different shapes of related data and a typed can reduce endpoint proliferation. can be simpler for stable resource contracts and conventional caching. With GraphQL I still need pagination, resource authorization, query-cost limits and efficient resolvers. One request can create substantial backend work, so I do not equate fewer round trips with better database performance. I choose based on client needs and operational complexity rather than treating either style as universally better.

34.4How do you avoid N+1 in Hot Chocolate?Mid

Resolvers للـ nested fields ممكن كل واحد يروح . استخدم DataLoader للـ batching حسب key و للحقول، ونطاق الطلب للـ cache. افحص query count فعلًا.

الإجابة النموذجية (English)

I look at resolver access patterns and actual database command counts. For related objects requested by key, a DataLoader can batch reads and cache them within the request. I also use suitable projections and pagination rather than loading an entire graph. The loader must respect tenant and authorization context, and its cache should not leak across requests. I test with multiple parent records, because a single-record test can hide behavior even when every individual query is fast.

34.5How do Blazor Server, WebAssembly and Auto differ?Mid

Server يشغّل التفاعل على السيرفر عبر SignalR، و في المتصفح. Auto يبدأ Server وقد يستخدم WebAssembly في زيارات لاحقة، مش migration فوري لنفس component.

الإجابة النموذجية (English)

I distinguish where interactive component code executes. Interactive Server keeps it on the server and sends updates over SignalR, trading a smaller initial download for connection and circuit costs. Interactive runs in the browser after downloading the runtime and application. Auto can start with Server and use WebAssembly on subsequent visits once the bundle is available; it does not migrate an active component mid-session. In all modes, sensitive operations and authorization remain enforced by server-side services.

34.6What can go wrong with Blazor prerendering?Mid

Loading أو initialization ممكن تحصل في prerender وبعد التفاعل، فـ side effects تتكرر. services المتاحة ممكن تختلف بين server وclient. خطط state ونقلها، أو عطّل prerender عند الحاجة.

الإجابة النموذجية (English)

I check whether initialization and data loading occur during prerendering and again when interactivity starts. If that path performs a side effect, it can happen twice. I keep initialization safe, preserve state where appropriate and avoid assuming browser or client-only services exist during server rendering. Disabling prerendering can be an intentional choice, but it changes the loading experience. I test both the initial render and interactive phase rather than validating only an already-running component.

34.7What does Orleans simplify, and what does it not solve?Senior

Grain identity وactivation وتوزيع وشكل interaction لكل entity. لسه محتاج persistence و وfailure handling وmulti-grain consistency. hot grain ممكن يحدد .

الإجابة النموذجية (English)

I use Orleans to simplify entity-oriented distributed behavior through virtual grains with stable identity and runtime-managed activation. It reduces manual placement and coordination code, and ordinary grain scheduling helps reason about local state. It does not automatically persist every field, guarantee exactly-once effects or make several grains one . I still design persistence, timeouts, retries and cross-grain consistency. A hot grain can remain a bottleneck, so I examine key distribution and workload shape before choosing the model.

34.8What value does Dapr add to a .NET service?Mid

موحدة لـ invocation وpub/sub وstate وغيرهم، مع components لمزودين مختلفين. فيه runtime وsidecar وتكلفة تشغيل؛ قدرات الـ store لسه مهمة ومش كلها متطابقة.

الإجابة النموذجية (English)

I see Dapr as a set of building-block backed by configurable infrastructure components. A service can use invocation, pub/sub, state and other capabilities through a common interface, which can help a polyglot system. I still need to understand the selected and state store because capabilities and guarantees differ. The runtime also adds configuration, security and operational work. For a simple service with established libraries, that extra layer may not provide enough benefit.

34.9How do you use feature flags safely?Mid

Flag مش permission. اختبر on وoff، وtargeting مستقر، وfallback، وowner وexpiry. rollback بالـ flag مش هيرجع change أو side effect حصل.

الإجابة النموذجية (English)

I use to separate deployment from exposure, with a defined owner, rollout plan and removal date. I test both enabled and disabled paths, use stable targeting and monitor cohort outcomes. Authorization remains independent of the flag. I also define behavior when configuration is unavailable and keep evaluation consistent within an operation. A kill switch can stop future behavior, but it does not reverse data migrations or completed side effects, so rollout and rollback plans must account for those separately.

34.10What is the relationship between WebAssembly and WASI?Mid

صيغة تنفيذ، و interfaces لقدرات النظام حسب host. مش كل package متوافق. المتصفح environment مختلفة عن WASI runtime، والـ sandbox محتاج permissions وحدود موارد.

الإجابة النموذجية (English)

I describe as a portable execution format and as standardized system interfaces that a host may provide to modules. WebAssembly can run in browsers or other runtimes, but those environments expose different capabilities. I verify the exact runtime, interface version and toolchain rather than assuming arbitrary packages work unchanged. Sandboxing helps constrain access, but resource limits, host permissions and runtime updates are still necessary. Client-side execution also cannot protect embedded secrets.

34.11What changes when a unary gRPC API becomes a stream?Senior

الاتصال أطول، فمحتاج deadlines وcancellation و وproxy config. لا تكتب من threads متعددة على نفس stream. reconnect محتاج resume protocol لو عدم فقد الأحداث مهم.

الإجابة النموذجية (English)

I now need to manage a longer-lived operation: cancellation, deadlines, slow readers, bounded buffering and proxy timeouts all matter. I keep stream writes serialized and await them instead of queuing unlimited work. I define what happens after disconnection, including whether clients can resume from a cursor and how duplicates are handled. A stream itself is not durable delivery. I also check browser compatibility because -Web does not offer every native gRPC streaming pattern.

34.12What security issues matter in a YARP reverse proxy?Senior

Destination ثابتة من config موثوقة، وauthorization، وtrusted forwarded headers و وlimits. Proxy مش سبب إن الـ destination تتجاهل صلاحيات المستخدم أو تقبل headers مزيفة.

الإجابة النموذجية (English)

I restrict destinations to trusted configuration so the proxy cannot become an arbitrary forwarding or service. I define authentication and authorization policies, preserve only intended identity information and configure forwarded headers from known proxies. I also review validation, request limits, timeouts and access logging. Backend services still enforce resource permissions. Operationally, I test , routing changes and propagation, because a proxy is a critical shared component rather than merely a convenient routing function.

34.13How would you choose between Hangfire, Quartz and Temporal?Senior

Hangfire لـ persisted jobs وdashboard؛ Quartz للـ scheduling والـ triggers؛ Temporal للـ durable workflow والتعافي عبر خطوات طويلة. في تداخل، والقرار حسب requirement وتكلفة التشغيل.

الإجابة النموذجية (English)

I start with the execution model. Hangfire is a practical fit for persisted application jobs with retries and operational visibility. Quartz is attractive when scheduling, calendars and trigger behavior are central. Temporal suits durable workflows with waiting, coordination and recovery across steps, but adds a service and replay constraints. These tools overlap, so I compare the actual requirements and operational cost. In every case, I design effects and address atomicity between business writes and job publication.

34.14Why must Temporal workflow code be deterministic?Senior

علشان replay من history ينتج نفس قرارات الـ orchestration. في activities، والوقت والـ timers والـ randomness من المناسب. تعديل الكود محتاج versioning متوافق مع workflows الشغالة.

الإجابة النموذجية (English)

Temporal reconstructs workflow progress by replaying recorded history, so workflow code must make compatible orchestration decisions during replay. I keep external and side effects in activities and use workflow-provided primitives for time and waiting. Activities can execute again, so they need where duplication matters. I also plan code evolution for workflows already running, using the platform's versioning guidance. Ordinary clock access or arbitrary network calls inside workflow code can make recovery diverge from the recorded execution.

34.15Why is Task.Run not a reliable background job queue?Mid

الشغل في نفس process ومش محفوظ، والـ request scope ممكن ينتهي. استخدم BackgroundService مع scope لشغل مناسب داخل process، أو persisted job system لو لازم التعافي بعد restart.

الإجابة النموذجية (English)

Task.Run schedules work in the current process; it does not persist intent or guarantee execution after a restart. Work launched from a request can also outlive its scoped dependencies, and its failures may be unobserved. For suitable in-process work I can use a bounded queue and BackgroundService with explicit scopes, accepting its durability limits. If the work must survive process failure, I choose persistent job infrastructure and coordinate publication with business writes, often through an .

اختبر نفسك

إجابات الاختبار وعلامات إكمال المحاور بتتحفظ على المتصفح ده، ومش بتتنقل لأجهزة تانية.

النتيجة: 0 / 0

What is authoritative in event sourcing?

الـ projections والـ snapshots مشتقة من الأحداث.

What must replay avoid?

Replay مايبعتش email أو charge تاني.

Which technique batches GraphQL key-based reads?

DataLoader يعالج نمط مع نطاق وصلاحيات صحيحة.

How does Blazor Auto normally use WebAssembly?

Auto مش نقل حي لنفس component الشغالة.

What does an Orleans grain not automatically provide?

persistence وcross-grain consistency محتاجين تصميم.

What must remain independent of a feature flag?

Flag بيحدد release، مش صلاحيات المستخدم.

What is WASI?

الدعم بيعتمد على runtime والـ interface والـ toolchain.

A slow gRPC client cannot consume messages quickly. What should the server do?

ده جزء من وعمر العملية.

Which is a safe YARP destination policy?

اختيار destination عشوائي ممكن يعمل أو open proxy.

Where should external I/O normally live in a Temporal application?

الـ workflow orchestration deterministic والـ activities بتنفيذ الآثار الخارجية.