← Salesforce Interview Insights

Salesforce·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Salesforce full-stack screen where they had me build a traffic light from scratch in plain HTML, CSS, and JS. No frameworks, no tricks, just the basics, but they kept piling on extensions throughout the session which is where things got interesting.

Questions Asked (6)

Q1

Build a working traffic light in vanilla HTML, CSS, and JavaScript. Three lights, automatic cycling with realistic timing, only one active at a time.

Technical Trade-offsAdaptability & Ambiguity
Author's notes

The core part was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and assumptions (e.g., timing, accessibility, extensibility) to show adaptability. Then outline a clean state-machine design with CSS for visuals and JS for timing, and discuss trade-offs like setInterval vs. requestAnimationFrame. Finally, implement a minimal working version and explain how you'd test and extend it.

Pro tip: Mention accessibility (ARIA roles, reduced motion) and how you'd make the timing configurable—this shows you think beyond the happy path and care about real-world use.

1. Clarify requirements and constraints

Ask about expected timing (e.g., green 10s, yellow 3s, red 10s), whether it should be configurable, and any accessibility or performance requirements. This demonstrates adaptability and avoids over-engineering.

2. Design the state machine and data model

Define states (red, yellow, green) and transitions with durations. Represent this as an array of objects or a config map, making it easy to modify and test.

3. Implement structure and styling

Use semantic HTML (e.g., a container with three divs) and CSS to style the lights, using classes to toggle active state. Ensure only one light is active via CSS specificity or JS class management.

4. Implement timing logic with JavaScript

Use setTimeout or setInterval to cycle through states, updating the active class. Consider using a single timer that schedules the next transition to avoid drift and simplify cleanup.

5. Discuss trade-offs and extensions

Talk about setInterval vs. requestAnimationFrame for timing accuracy, how to handle pause/resume, and how to make it accessible (ARIA live regions, reduced motion). Mention testing strategies.

Key Points to Mention

  • State machine design with clear transitions and durations
  • Separation of concerns: HTML for structure, CSS for presentation, JS for behavior
  • Timing accuracy and drift: why setTimeout/setInterval can drift and alternatives like requestAnimationFrame or Web Workers
  • Accessibility: ARIA roles (e.g., role='img' with aria-label), reduced motion support, and color contrast
  • Configurability: making timings adjustable via data attributes or a config object
  • Testing: unit tests for state transitions, visual regression tests, and manual testing across browsers

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Now add a manual override button that lets a user force a specific light on, and explain how you'd handle resuming the automatic cycle afterward.

Technical Trade-offsAdaptability & Ambiguity
Author's notes

This tripped me up more than it should have.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the current automatic cycle logic and the desired override behavior, then propose a clean state management solution that separates manual and automatic modes. Explain how you would implement the override button and the mechanism to resume the automatic cycle, emphasizing trade-offs and edge cases.

Pro tip: Demonstrate foresight by discussing how to handle multiple overrides, timeouts, and user feedback to avoid confusing states, and mention the importance of logging and testing for such state transitions.

1. Clarify Requirements and Current System

Ask questions to understand the existing automatic cycle logic, the expected behavior of the override (e.g., duration, scope), and how resumption should be triggered. Confirm whether the override is temporary or permanent until manually reset.

2. Design State Management

Propose a state machine or mode flag (e.g., AUTO, MANUAL_OVERRIDE) to track the current mode. Ensure the override sets the desired light state and pauses the automatic cycle, while resumption reverts to the automatic logic.

3. Implement Override and Resume Logic

Describe how the override button would set the mode and light state, and how resuming could be triggered (e.g., button press, timeout, or external event). Consider using events or callbacks to transition back to AUTO mode and re-evaluate the cycle.

4. Handle Edge Cases and Trade-offs

Discuss potential issues like multiple overrides, conflicting user actions, or system restarts. Explain how you would handle them (e.g., queue overrides, persist state) and the trade-offs between simplicity and flexibility.

5. Test and Validate

Outline a testing strategy to ensure the override and resume behavior works correctly, including unit tests for state transitions and integration tests for user interactions.

Key Points to Mention

  • State machine or mode flag to distinguish between automatic and manual modes
  • Clear separation of concerns: override logic vs. automatic cycle logic
  • Resumption triggers: manual button, timeout, or external event
  • User feedback: visual indication of override mode and how to resume
  • Persistence of override state across sessions or restarts
  • Testing strategy for state transitions and edge cases

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Make the timing configurable, so different durations can be passed in without changing the core logic.

Technical Trade-offs
Author's notes

Straightforward refactor.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the current hardcoded timing and the desired flexibility, then propose extracting the duration into a configuration parameter (e.g., constructor argument, method parameter, or config file) with a sensible default. Emphasize that the core logic remains unchanged, and discuss trade-offs like validation, testability, and backward compatibility.

Pro tip: Mention that you would add validation and a default value to avoid breaking existing callers, and write tests for different durations to prove the core logic is untouched. This shows you think about production readiness, not just the happy path.

1. Clarify requirements and current state

Ask where the timing is currently hardcoded and what durations need to be supported. Confirm whether the change should be backward compatible.

2. Choose a configuration mechanism

Decide between constructor injection, method parameter, environment variable, or config file based on the use case. Prefer the simplest option that meets the need.

3. Implement with defaults and validation

Add the parameter with a default value equal to the current hardcoded duration, and validate that the duration is positive and within reasonable bounds.

4. Ensure core logic remains unchanged

Refactor only the timing source, keeping the algorithm and control flow identical. Use dependency injection or a simple parameter to avoid touching the core.

5. Test and document

Write unit tests for different durations, including edge cases, and update documentation or API contracts to reflect the new configurability.

Key Points to Mention

  • Dependency injection or parameterization to decouple timing from logic
  • Default value to maintain backward compatibility
  • Validation of input duration (e.g., non-negative, within limits)
  • Testability: easy to write tests with different durations
  • Trade-offs: complexity vs. flexibility, configuration source (code vs. external)
  • Impact on existing callers and migration strategy

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Add a pedestrian crossing signal that responds to the traffic light state, and describe how you'd keep the two in sync.

System DesignTechnical Trade-offs
Author's notes

This is where it got genuinely fun.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system boundaries and requirements, then propose a design where the pedestrian signal is a state observer of the traffic light controller, using an event-driven or polling mechanism to stay in sync. Emphasize safety, fail-safe behavior, and idempotent state transitions, and discuss trade-offs between tight coupling and eventual consistency.

Pro tip: Highlight that the pedestrian signal should never contradict the traffic light for conflicting directions, and that a watchdog or heartbeat mechanism can detect and recover from desynchronization—showing you prioritize safety and reliability over mere functionality.

1. Clarify requirements and constraints

Ask about the traffic light's states (e.g., red, yellow, green, walk, don't walk), timing, safety requirements, and whether the pedestrian signal is for a crosswalk parallel or perpendicular to the traffic light. Confirm if the system is real-time and what failure modes are critical.

2. Define the synchronization model

Choose between a push model (traffic light controller publishes state changes to pedestrian signal) or a pull model (pedestrian signal polls the controller). Discuss trade-offs: push is lower latency but requires reliable messaging; pull is simpler but may introduce lag.

3. Design the state machine and transitions

Map traffic light states to pedestrian signal states (e.g., green -> don't walk, red -> walk with countdown). Ensure transitions are atomic and idempotent, and include a fail-safe default (e.g., flashing red or solid don't walk) if communication is lost.

4. Address reliability and fault tolerance

Implement heartbeat checks, timeouts, and a watchdog to detect desynchronization. Consider a fallback mode where the pedestrian signal operates on a fixed cycle if the traffic light controller is unreachable, and log discrepancies for diagnostics.

5. Discuss scalability and extensibility

Explain how the design can handle multiple intersections or additional signals (e.g., audible cues) without major refactoring. Mention using a message broker or event bus for decoupling, and how to version the state protocol for future changes.

Key Points to Mention

  • Event-driven architecture with publish-subscribe for state updates
  • Idempotent state transitions to handle duplicate messages
  • Fail-safe default state (e.g., pedestrian 'don't walk') on communication failure
  • Heartbeat or watchdog mechanism to detect and recover from desync
  • Trade-offs between tight coupling (direct API calls) and loose coupling (message queue)
  • Safety and regulatory compliance (e.g., MUTCD standards for pedestrian signals)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

Add CSS fade transitions between light states instead of instant switching, and walk through any timing gotchas.

Technical Trade-offsAdaptability & Ambiguity
Author's notes

I knew about CSS transitions but hadn't thought through the overlap problem where two lights are briefly visible during a fade.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the UI context and the desired fade effect, then propose a CSS transition-based solution using opacity and visibility. Walk through the implementation, highlighting timing gotchas like transition delays, pointer-events, and stacking contexts, and explain how to avoid them.

Pro tip: Use `transition: opacity 0.3s ease, visibility 0.3s` and set `visibility: hidden` with a delay equal to the opacity transition duration to ensure the element is not interactive when invisible. This prevents accidental clicks and improves accessibility.

1. Clarify the requirement

Ask whether the fade should apply to a single element toggling visibility or between multiple light states, and confirm if the transition should be interruptible.

2. Choose the CSS approach

Use opacity transitions combined with visibility toggling, or CSS animations if the fade is part of a larger sequence. Avoid display:none because it cannot be transitioned.

3. Implement the transition

Set `transition: opacity 0.3s ease, visibility 0.3s` on the element. When hiding, set `opacity: 0` and `visibility: hidden` with a delay; when showing, set `opacity: 1` and `visibility: visible` immediately.

4. Address timing gotchas

Mention that visibility must be delayed on hide to allow the fade, and that pointer-events should be disabled when hidden to prevent interaction. Also consider stacking context and z-index changes.

5. Test and refine

Test across browsers, check for jank on low-end devices, and ensure the transition duration feels natural. Consider using `will-change: opacity` for performance if needed.

Key Points to Mention

  • Use opacity and visibility instead of display for transitionable properties.
  • Delay visibility on hide to match opacity transition duration.
  • Set pointer-events: none when hidden to avoid accidental clicks.
  • Be aware of stacking context changes when opacity is less than 1.
  • Consider using CSS custom properties for easy timing adjustments.
  • Test for performance and accessibility, including reduced motion preferences.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

How would you refactor this into a React component or component-based architecture?

System DesignTechnical Trade-offs
Author's notes

Talked through lifting state up, using useEffect for the timer, and passing config as props.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the existing code's purpose, data flow, and pain points, then propose a component decomposition based on single responsibility and reusability. Walk through the refactor step-by-step, highlighting state management, props contracts, and performance considerations, and finish by discussing trade-offs and testing strategy.

Pro tip: Emphasize incremental refactoring with tests to ensure behavior preservation, and mention how you'd leverage React DevTools and profiling to validate performance improvements.

1. Understand and Analyze

Identify the current implementation's responsibilities, data dependencies, and UI structure. Note any global state, side effects, or repeated patterns that could be extracted.

2. Define Component Boundaries

Break the UI into a component hierarchy based on single responsibility and reusability. Decide which components should be presentational vs. container components.

3. Design State and Data Flow

Determine where state should live (local vs. lifted vs. global) and how data and callbacks will flow between components. Consider using hooks or context for cross-cutting concerns.

4. Implement Incrementally

Refactor piece by piece, starting with leaf components, and ensure each step is covered by tests. Use feature flags or conditional rendering to avoid breaking existing functionality.

5. Validate and Optimize

Run tests, profile performance, and check for unnecessary re-renders. Discuss trade-offs such as over-abstraction, prop drilling, and bundle size.

Key Points to Mention

  • Single Responsibility Principle and separation of concerns
  • State management strategies (local state, lifting state up, Context, Redux, etc.)
  • Props design and component API contracts
  • Performance optimization (React.memo, useMemo, useCallback, code splitting)
  • Testing strategy (unit tests, integration tests, snapshot tests)
  • Trade-offs between granular components and maintainability

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.