๐ How to Draw on a Whiteboard / Virtual Board ยท ๐ THE STANDARD DIAGRAM TO DRAW โ MEMORIZE THIS LAYOUT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SALESFORCE CHANNEL โ
โ Employee Desktop โโโโโโโโ Mobile App โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ OAuth / ClientID โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ XAPI (Experience Layer) โ per channel โ
โ orders-portal-xapi | orders-inquiry-mobile-xapi โ
โ [Auth + Validation + Channel-specific response formatting] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Internal Client ID
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PAPI (Process Layer) โ business orchestration โ
โ order-fulfillment-papi โ
โ [Scatter-Gather: calls SAP-SAPI + DynamoDB-SAPI in PARALLEL] โ
โโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SAP Billing SAPI โ โ DynamoDB Prefs SAPI โ
โ [OData call] โ โ [HTTP + SigV4] โ
โโโโโโโโโโโโโฌโโโโโโโโโโโ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SAP S/4HANA โ โ AWS DynamoDB โ
โ (Backend ERP) โ โ (UCDP Preferences) โ
โโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Interviewers don't want you to memorize flows โ they want to see HOW you think. Use this structure for EVERY design question:
1. Start with the business requirement: "The business needs X โ customer needs to see their bill in real time..."
2. Identify the channels (who calls you): "There are 2 callers: Employee Desktop and the Mobile app..."
3. Identify the backends (what you call): "Data lives in SAP for billing and DynamoDB for preferences..."
4. Draw the 3-layer API-led structure: "So I'd design this as XAPI โ PAPI โ SAPI..."
5. Explain the key design decision: "I use Scatter-Gather here because SAP and DynamoDB are independent โ parallel saves 1.4 seconds..."
6. Address non-functional requirements: "For error handling, I propagate SAP failures as 503... For security, Client ID enforcement on XAPI..."
"Absolutely. Let me walk you through it from top to bottom.
The top layer is the channel โ Salesforce Employee Desktop and Conversational AI. These are the systems that call our APIs. Both go through an Experience API โ or XAPI. The XAPI's job is to validate the incoming request, enforce authentication, and format the response for that specific channel. Think of it as the API that speaks the channel's language.
The XAPI then calls a Process API โ PAPI. The PAPI's job is business orchestration โ it knows WHAT data to get but doesn't know HOW to get it. In the billing inquiry case, the PAPI uses Scatter-Gather to call two backend SAPIs simultaneously โ the SAP Billing SAPI and the DynamoDB Preferences SAPI โ in parallel. This reduces response time from 2.5s to 1.1s.
At the bottom, each System API โ SAPI knows exactly how to talk to one backend system. The SAP SAPI knows the OData XML format. The DynamoDB SAPI knows SigV4 signing. This way, if SAP changes its API format, only the SAP SAPI needs updating โ the PAPI and XAPI are untouched.
[Pause, then ask] Would you like me to go deeper on any specific layer or the error handling between layers?"
- You explained the BUSINESS reason for each layer ("speaks the channel's language")
- You gave a CONCRETE performance metric (2.5s โ 1.1s)
- You showed reusability ("if SAP changes, only SAPI updates")
- You ended with a question โ puts YOU in control of where the interview goes next
"Great question. I asked the same thing before implementing it.
SAP takes about 800ms and DynamoDB takes about 200ms. If I call them sequentially, the total is 1000ms minimum. With Scatter-Gather โ parallel โ the total is 800ms (limited by SAP, the slower one). That's a 20% reduction on the happy path.
More importantly, the data from SAP and DynamoDB are completely independent โ the billing amount from SAP doesn't affect what preferences to fetch from DynamoDB. They don't depend on each other. When you have independent parallel sources, Scatter-Gather is the right tool.
Sequential calls make sense when one call's output IS the input to the next โ like fetching an accountId from Salesforce and then using that ID to query SAP. In that case there IS a dependency, so Scatter-Gather doesn't help.
Does that address the design choice?"
"Error handling is one of the most important parts of the design โ it's easy to get happy path right, hard to get errors right.
I use a layered error propagation strategy. At the SAPI level, if SAP returns a 500, the SAPI catches it, builds a standardized error payload โ correlationId, errorCode like 'SAP_ERROR', description, layer โ and re-throws it using on-error-propagate.
The PAPI receives this error. It doesn't try to handle it โ it enriches it with PAPI context and propagates it upward.
The XAPI is the boundary with the consumer, so it's responsible for the final customer-facing response. It maps the error to the correct HTTP status: SAP unavailable โ 503, bad request โ 400, not found โ 404. It formats the response in a way Salesforce can display to the user.
The key principle: every API in every layer has the same error response shape โ same JSON keys, same structure. This means the XAPI always knows what to expect regardless of where the error originated."
| SITUATION | JUNIOR SAYS | SENIOR SAYS |
|---|---|---|
| Why API-led? | "It's best practice" | "Before API-led we had 8 point-to-point connections per domain. A SAP change required updating 8 apps. Now we update one SAPI and all 4 PAPIs benefit automatically." |
| Why async MQ? | "It's faster" | "The preference update API returned 2.5s when calling SAP synchronously. With MQ async, we return 202 Accepted in 50ms and process in the background. The customer sees instant confirmation." |
| Why idempotency? | "To avoid duplicates" | "MQ delivers at-least-once. In our first month without idempotency, we had 47 duplicate DynamoDB writes. After implementing ObjectStore-based idempotency with 24h TTL, zero duplicates in 12 months." |
| Why DataWeave not Java? | "It's easier" | "DataWeave is declarative and null-safe with the default keyword. Our SAP XML has optional nodes โ a Java null check would be 30 lines. The DataWeave equivalent is sapData?.node default 'UNKNOWN' โ one line, zero NPEs." |
| Why separate SAPI per backend? | "Separation of concerns" | "SAP needs SigV4 auth, OData XML parsing, and namespace handling. DynamoDB needs different auth, different format. If I mix that logic into the PAPI, I can't reuse it. The SAP SAPI is called by 4 PAPIs โ that's 75% code reduction." |