← Salesforce Interview Insights

Salesforce·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Salesforce full-stack screen where they had me build a traffic light from scratch in plain HTML, CSS, and JS. No frameworks, which was fine, but the real test was how you handled the follow-up requirements they kept stacking on.

Questions Asked (4)

Q1

Build a working traffic light in vanilla HTML, CSS, and JavaScript. It should cycle through red, yellow, and green automatically with realistic timing, and only one light should be active at a time.

Technical Trade-offsAdaptability & Ambiguity
Author's notes

I got the basic cycling working pretty fast, setTimeout in a loop, three divs, done.

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 architecture using a state machine and CSS classes for active states, and implement with vanilla JS. Finally, discuss trade-offs and potential improvements.

Pro tip: Demonstrate maturity by mentioning accessibility (ARIA roles, reduced motion) and testability (e.g., using fake timers) even if not explicitly asked.

1. Clarify Requirements

Ask about timing expectations, whether the cycle should be configurable, and any accessibility or performance constraints. This shows you consider ambiguity and user needs.

2. Design Architecture

Propose a state machine with states (red, yellow, green) and transitions. Use CSS classes to control which light is active, and a single source of truth in JS.

3. Implement Core Logic

Write HTML structure with three divs for lights. Use CSS for styling and active state. In JS, use setTimeout or setInterval to cycle states, ensuring only one active at a time.

4. Handle Edge Cases & Accessibility

Add ARIA attributes (e.g., role='img', aria-label) and respect prefers-reduced-motion. Consider pausing on hover or visibility change.

5. Discuss Trade-offs & Extensions

Talk about using setInterval vs. recursive setTimeout, configurability, and how you might test or extend it (e.g., pedestrian button).

Key Points to Mention

  • State machine pattern for clear state transitions
  • CSS classes for active light and transitions
  • Timing realism: red longer, yellow shorter, green medium
  • Accessibility: ARIA roles, labels, and reduced motion support
  • Trade-offs: setInterval vs. setTimeout, configurability vs. simplicity
  • Testability: using fake timers or dependency injection for time

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 the user force a specific light on, and make the timings configurable rather than hardcoded.

Adaptability & AmbiguityTechnical Trade-offs
Author's notes

This is where my earlier shortcuts bit me.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by restating the requirements to confirm understanding, then propose a design that separates concerns: a manual override flag that takes precedence over the schedule, and a configuration object for timings. Discuss trade-offs like state management, persistence, and testing, and outline a step-by-step implementation plan.

Pro tip: Mention that you would clarify ambiguous points (e.g., override duration, config source) before coding, and suggest writing tests for override precedence and config loading to demonstrate foresight.

1. Clarify Requirements

Ask questions to resolve ambiguities: Should the override be temporary or until manually turned off? Where should configurable timings be stored (file, database, UI)? What are the edge cases?

2. Design the Solution

Propose a design that introduces an override flag and a configuration object. Explain how the override takes precedence over the schedule and how timings are loaded dynamically.

3. Discuss Trade-offs

Compare options for state management (in-memory vs. persistent), configuration sources (hardcoded defaults vs. external files), and UI integration (button placement, feedback).

4. Outline Implementation

Describe the steps to implement: add override state, modify control logic to check override first, extract timings to config, and update UI with a button.

5. Testing and Validation

Explain how you would test the new features: unit tests for override precedence, integration tests for config loading, and manual testing of the UI.

Key Points to Mention

  • Separation of concerns: override logic vs. scheduling logic
  • State management: how to store override state and config (e.g., in-memory, database, file)
  • Precedence rules: override should take priority over scheduled timings
  • Configurability: externalizing timings to a config file or database with defaults
  • UI/UX: button design, user feedback, and error handling
  • Testing: unit tests for override and config, and edge cases like invalid config

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

Q3

Extend the traffic light to include a pedestrian crossing signal that coordinates with the vehicle lights, and add fade transitions between light states.

System DesignAdaptability & Ambiguity
Author's notes

Honestly the pedestrian signal was more of a state management problem than a UI problem and I said that out loud, which I think landed okay.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints of the traffic light system, including the pedestrian signal and fade transitions. Then, design a state machine that coordinates vehicle and pedestrian lights, and implement fade transitions using a timer or animation library. Finally, discuss trade-offs and potential edge cases.

Pro tip: Demonstrate adaptability by acknowledging ambiguity and proposing a phased approach: first build a basic state machine, then add pedestrian coordination, and finally implement fade transitions. This shows you can handle evolving requirements.

1. Clarify Requirements

Ask questions to understand the scope: Is this a simulation or real hardware? What are the timing constraints? Should pedestrian signals be automatic or request-based? What does 'fade' mean (CSS, hardware PWM)?

2. Design State Machine

Define states for vehicle lights (e.g., Green, Yellow, Red) and pedestrian lights (Walk, Don't Walk, Flashing Don't Walk). Map transitions and coordination rules, ensuring safety (e.g., pedestrian Walk only when vehicle Red).

3. Implement Fade Transitions

Choose a method for fading (e.g., CSS transitions for web, PWM for hardware). Integrate fades into state transitions without compromising timing or safety. Consider using a timer or animation loop.

4. Handle Edge Cases and Safety

Address scenarios like pedestrian button presses during vehicle green, power outages, or emergency vehicle preemption. Ensure fail-safe defaults (e.g., flashing red).

5. Discuss Trade-offs and Testing

Talk about trade-offs between simplicity and realism, and how you would test the system (unit tests for state transitions, integration tests for coordination).

Key Points to Mention

  • State machine design for coordinated lights
  • Safety and fail-safe mechanisms
  • Fade transition implementation (CSS, PWM, etc.)
  • Timing and synchronization between vehicle and pedestrian signals
  • Handling pedestrian requests and edge cases
  • Testing strategy for state transitions and coordination

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

Q4

How would you refactor this into a React component structure?

Technical Trade-offsSystem Design
Author's notes

They flagged upfront they knew I wasn't a frontend specialist so this felt more like a conversation than a gotcha.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the current implementation and requirements, then propose a component hierarchy that separates concerns and promotes reusability. Walk through the refactoring steps, explaining trade-offs such as state management, performance, and maintainability.

Pro tip: Emphasize incremental refactoring with tests to ensure behavior remains unchanged, and discuss how you would measure success (e.g., reduced re-renders, improved code clarity).

1. Clarify the Current State and Goals

Ask questions to understand the existing code, its purpose, and any constraints. Identify what needs improvement (e.g., reusability, performance, readability).

2. Identify Components and Responsibilities

Break down the UI into logical components based on the single responsibility principle. Determine which components should be presentational vs. container components.

3. Design State Management and Data Flow

Decide where state should live (local vs. lifted up) and how data will flow between components. Consider using hooks, context, or state management libraries if needed.

4. Plan the Refactoring Steps

Outline an incremental approach: extract components one by one, write tests, and ensure existing functionality remains intact. Discuss potential risks and mitigation.

5. Evaluate Trade-offs and Optimizations

Discuss trade-offs such as performance (memoization, lazy loading), code complexity, and team conventions. Mention how you would validate the refactor (e.g., testing, profiling).

Key Points to Mention

  • Component composition and reusability
  • State management (local vs. global, hooks, context)
  • Performance optimizations (React.memo, useCallback, code splitting)
  • Testing strategies (unit tests, snapshot tests, integration tests)
  • Incremental refactoring to avoid breaking changes
  • Accessibility and semantic HTML in component design

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