
Real Interview Questions for the Software Engineer at Dassault Systèmes
NewInterview Q&A
Q&A-1Debug this piece of code I provided and explain what the bug is?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
I would not start by editing. I would ask for the input that triggers it, the expected output, and the build flags, then reproduce it locally with the smallest case I can construct. After that I read the code top to bottom, form one hypothesis at a time, and test it with a print, a watchpoint, or a sanitizer run. That order matters in a phone screen because it shows I can narrow a failure instead of guessing at fixes.
A bug I have debugged in this shape, in C++17 code that filtered suppressed parts out of a large assembly before a mass roll-up, looked like this:
// C++17, simplified
std::vector<Part*> parts = loadAssembly();
for (auto it = parts.begin(); it != parts.end(); ++it) {
Part* p = *it;
if (p->isSuppressed()) {
parts.erase(it); // bug is here
}
}
return computeTotalMass(parts);The intent was to drop suppressed parts. The bug is iterator invalidation combined with incrementing an invalidated iterator. erase returns an iterator to the element that followed the erased one, and every iterator from the erased position onward is invalidated. The loop ignores the return value and then does ++it on an invalidated iterator. That is undefined behaviour, not just a skipped element.
Worked trace on [A, B, C, D] where B and C are suppressed:
| Iteration | it before body | Action | it after ++it | Result |
|---|---|---|---|---|
| 1 | A | keep A | B | correct |
| 2 | B | erase B, vector becomes [A, C, D] | undefined, often C or past C | C may be skipped |
| 3 | C or D | depends on stale iterator | unpredictable | wrong mass, or crash under ASan |
In practice this passed small tests with no suppressed parts, then failed on a real assembly with consecutive suppressed parts. The total mass was too high because C survived, and on some builds the stale increment walked off the end and crashed. That pattern, works on the toy case and breaks on production data, is the first thing I check for in geometry and PLM code where input size and ordering vary widely.
How I prove it
I rebuild with sanitizers and a deterministic input file, rather than relying on a release build where the stale iterator happens to land somewhere harmless:
g++ -std=c++17 -g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer main.cpp -o debug_build
./debug_build assembly_small.stepAddressSanitizer reports the use of the invalidated iterator on the first suppressed element, which confirms the hypothesis in seconds. I also add a counter print of parts.size() before and after the loop. Before the fix it drops by one when two consecutive parts are suppressed. After the fix it drops by two.
The fix
Use the iterator returned by erase and do not increment it in the loop header:
for (auto it = parts.begin(); it != parts.end(); ) {
if ((*it)->isSuppressed()) {
it = parts.erase(it);
} else {
++it;
}
}An alternative is to build a new vector of kept parts, which is clearer when the filter grows more complex and avoids repeated erase cost on a vector with hundreds of thousands of parts. I would pick the new vector if profiling showed the erase shifting dominating the roll-up.
What I would say about follow-up
I would name the failure mode precisely: undefined behaviour from iterator invalidation, detected by ASan and by a size assertion in a unit test with consecutive suppressed parts. I would also flag the related risks I checked while I was there, such as a dangling Part* if ownership changed during the filter, and integer overflow in the mass accumulation when units changed from grams to kilograms. That closes the loop: reproduce, isolate, prove with a tool, fix the smallest thing that is wrong, and add the regression test that would have caught it on the first run.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-2Write SQL to select the 2nd highest salary in the engineering department?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
I would state the schema I am assuming, then give the window-function version because it handles ties explicitly. Assume employees(id, name, department, salary) where salary is numeric and can repeat, and the department is stored as 'Engineering'.
-- PostgreSQL 16 / MySQL 8 / SQL Server 2019+
SELECT salary
FROM (
SELECT DISTINCT salary,
DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
FROM employees
WHERE department = 'Engineering'
AND salary IS NOT NULL
) ranked
WHERE rnk = 2;DENSE_RANK gives equal salaries the same rank and does not skip a rank after a tie, so the second distinct salary is returned once. If the interviewer wants the second row regardless of ties, ROW_NUMBER() with ORDER BY salary DESC and picking row 2 is the different query, and I would ask which meaning they intend before committing.
Worked trace
Suppose Engineering has these salaries: 180000, 165000, 165000, 150000, 120000.
| salary | DENSE_RANK | ROW_NUMBER | Picked by DENSE_RANK = 2? |
|---|---|---|---|
| 180000 | 1 | 1 | no |
| 165000 | 2 | 2 | yes |
| 165000 | 2 | 3 | yes, same distinct value |
| 150000 | 3 | 4 | no |
| 120000 | 4 | 5 | no |
The result is one row, 165000. With ROW_NUMBER the second row is also 165000 here, but if the top two rows were both 180000, ROW_NUMBER would return 180000 as the "second highest" while DENSE_RANK would return the next distinct value. That distinction is the usual follow-up.
Alternatives and when they break
| Approach | Query shape | Problem |
|---|---|---|
LIMIT 1 OFFSET 1 | ORDER BY salary DESC LIMIT 1 OFFSET 1 | Returns the second row, so a tie at the top makes it return the top salary again. Also syntax differs in SQL Server (OFFSET ... FETCH). |
MAX below max | WHERE salary < (SELECT MAX(salary) ...) then MAX(salary) | Correct for distinct second highest, but needs a correlated subquery and reads the table twice in effect. |
DENSE_RANK | Window as above | Clear about ties, supported in all current mainstream databases. |
The MAX version, for reference:
SELECT MAX(salary) AS second_highest_salary
FROM employees
WHERE department = 'Engineering'
AND salary < (
SELECT MAX(salary) FROM employees WHERE department = 'Engineering'
);It returns NULL when fewer than two distinct salaries exist, whereas the window version returns no row. I would mention that difference if the caller expects a scalar.
Failure modes I would name
NULL salaries sort inconsistently across databases and should be filtered out, as above. Department spelling matters: if the column stores 'engineering', 'Engineering' and 'ENG' as separate values, the filter silently misses rows, so I would check the stored values or use a normalised department code rather than a free-text name. For a large table, an index on (department, salary DESC) lets the database find the top distinct values without scanning every Engineering row, which matters once the table passes a few million rows. If salaries are stored as floats, equality and ranking can be distorted by rounding, so a DECIMAL(12,2) column is the safer type for money.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-3How would you reverse a string?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
I would clarify two things first: whether the string can be modified in place, and whether it is ASCII or Unicode. For a mutable C++ std::string holding ASCII, I use two indices moving inward and swap. That is O(n) time and O(1) extra space. For an immutable string, I build a new string by walking backward. In production code I would call std::reverse, and write the loop by hand only to show the invariant.
// C++17. Reverses in place. Assumes ASCII or single-byte encoding.
#include <string>
#include <algorithm>
void reverseInPlace(std::string& s) {
if (s.size() < 2) return;
std::size_t i = 0;
std::size_t j = s.size() - 1;
while (i < j) {
std::swap(s[i], s[j]);
++i;
--j;
}
}
// Immutable version: O(n) time, O(n) extra space.
std::string reversedCopy(const std::string& s) {
std::string out;
out.reserve(s.size());
for (auto it = s.rbegin(); it != s.rend(); ++it) out.push_back(*it);
return out;
}Worked trace
For s = "CATIA", indices 0 to 4:
| Step | i | j | Swap | String after swap |
|---|---|---|---|---|
| 1 | 0 | 4 | s[0] with s[4] | AATIC |
| 2 | 1 | 3 | s[1] with s[3] | AITAC |
| 3 | 2 | 2 | Loop ends, i is not less than j | AITAC |
The middle character at index 2 never moves. On an odd length string, the pointers meet at the centre and the loop stops. On an even length string, they cross.
Choosing between approaches
| Approach | Time | Extra space | Use it when |
|---|---|---|---|
| Two-pointer swap in place | O(n) | O(1) | Buffer is mutable and large, for example a part name edited in a CAD document |
| Build a reversed copy | O(n) | O(n) | Input is const, or the original must be kept for undo or logging |
| Reverse by code point | O(n) | O(n) | Text may contain multibyte characters |
Where the simple version breaks
Reversing bytes is wrong for UTF-8. A character such as é can occupy two bytes, and swapping bytes scrambles the encoding and can produce invalid UTF-8. Reversing by Unicode code point fixes that, but it still splits grapheme clusters: a flag emoji, a skin-tone modifier, or a letter with a combining accent is made of several code points and will come apart. If display correctness matters, I would say so and use a grapheme cluster library rather than claim the byte swap is enough.
Other failure modes I would name: an empty string, where s.size() - 1 underflows for size_t if I skip the size check; a null C-style char*, where the length must come from strlen and the caller must guarantee writable storage; and modifying a string while iterating it, where a push_back can reallocate and invalidate iterators. Swapping elements does not invalidate iterators, but resizing does.
If the follow-up moves to a singly linked list, the in-place trick no longer applies. I would either reverse the pointers iteratively or build a new list by prepending each node. For a file too large for memory, I would read chunks from the end. For the string as asked, the two-pointer version is the one I would defend.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-4What is a hashmap, and how would you solve array problems efficiently with it?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
A hashmap stores key to value pairs by hashing the key to an index into an array of buckets, then resolving collisions inside the bucket. Lookup, insert and delete are O(1) on average because you jump straight to the bucket instead of scanning. For array problems that turns O(n^2) scans into one pass: keep what you have already seen in the map and check for the complement, the duplicate or the count you need.
In a Dassault Systèmes context I would reach for it for a bill of materials or a 3DEXPERIENCE index. If you have 50,000 component instances and need to find the parent part or the material for a given part number, a linear scan per query is 50,000 comparisons. A map from part number to record makes each query one hash lookup.
How it actually works
hash(key)produces an integer. The map takes it modulo the current capacity to pick a bucket.- If the bucket is empty, the entry goes there. If it is occupied by a different key, the map stores both. Java's
HashMap(Java 21) uses chaining with a linked list, and converts a long chain to a tree when a bucket exceeds 8 entries at capacity 64 or more. Python'sdictuses open addressing with probing. - When entries exceed
capacity * load_factor, the map resizes, usually doubling capacity and rehashing every key. Java defaults to load factor 0.75, so a map starting at capacity 16 resizes at 13 entries, then 25, then 49. That resize is the pause you see in a tight loop.
Average O(1) depends on a decent hash and a load factor that keeps chains short. Worst case is O(n) per operation if many keys collide, for example integer keys that all hash to the same bucket, or keys with a poor hashCode implementation.
Worked example: Two Sum
Given nums = [2, 7, 11, 15] and target = 9, return indices [0, 1].
def two_sum(nums, target):
seen = {}
for i, x in enumerate(nums):
need = target - x
if need in seen:
return [seen[need], i]
seen[x] = i
return []| i | x | need | seen before | action |
|---|---|---|---|---|
| 0 | 2 | 7 | {} | store 2 -> 0 |
| 1 | 7 | 2 | {2: 0} | hit, return [0, 1] |
One pass, O(n) time, O(n) space. The same pattern solves counting frequencies, first non-repeating element, and deduping an array while preserving order. For dedup, store the value as the key and only append to the result when the key was absent.
When a map is the wrong tool
| Need | Better choice | Why |
|---|---|---|
| Membership test on a small fixed range, say values 0 to 100 | boolean array or bitset | No hashing, no collisions, cache friendly |
| Sorted output or range queries | sorted array plus binary search, or a tree map | A hashmap has no order, so min, max and range scans are O(n) |
| Keys are already dense integers | direct-index array | arr[key] beats hashing on latency and memory |
| Iteration order must be sorted | TreeMap in Java, sortedcontainers in Python | Hashmap iteration order is unspecified in Java |
Failure modes to name in an interview: mutable keys. If you use a list or a custom object whose hash changes after insertion, the entry becomes unreachable. In Java that means never mutating a field used by hashCode while the object is a key. In Python, lists are unhashable for exactly this reason, use tuples. Second, memory overhead. A map entry costs far more than an array slot, often 2 to 4 times the raw data, so for 10 million entries that gap matters. Third, adversarial or clustered hashes. If input is attacker controlled, as in a web service accepting arbitrary keys, hash flooding can degrade lookups. Python randomises string hashing per process to mitigate this, Java does not for String in the same way.
I would state the assumption up front: average case, hashable keys, no ordering requirement. If any of those fail, I switch structures rather than forcing the map.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-5What does a database look like conceptually?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
Conceptually, a relational database is a collection of tables that describe the world as sets of rows, with rules that keep those rows consistent. Each table has columns with a fixed type and a primary key that uniquely identifies a row. Other tables point at that key with a foreign key. A query then joins those tables to reconstruct an object that was split across them.
Take a PLM example. A part is not stored as one nested file in the database. It is split into rows that can be queried independently:
-- PostgreSQL 16
CREATE TABLE part (
part_id BIGINT PRIMARY KEY,
part_number TEXT NOT NULL, -- e.g. 'CATIA-BRACKET-042'
revision TEXT NOT NULL, -- e.g. 'B', 'C'
status TEXT NOT NULL, -- DRAFT, RELEASED, OBSOLETE
UNIQUE (part_number, revision)
);
CREATE TABLE assembly_component (
parent_id BIGINT NOT NULL REFERENCES part(part_id),
child_id BIGINT NOT NULL REFERENCES part(part_id),
qty NUMERIC(10,3) NOT NULL CHECK (qty > 0),
PRIMARY KEY (parent_id, child_id)
);The business identity is the pair (part_number, revision). That pair is unique, so the same part number can exist at revision B and at revision C, but never twice at the same revision. part_id is a surrogate key the foreign keys use, so releasing a new revision does not rewrite every reference. assembly_component is a pure relationship table. A bill of materials is then a recursive join over it, not a tree stored inside a row.
That diagram is the conceptual split. The application sees tables, keys and constraints. It does not see pages, buffers or files on disk. The engine maps the logical tables to physical storage, maintains indexes, and guarantees that a transaction either commits all its writes or none of them.
What the model buys you, and where it strains
| Concern | Relational answer | Cost |
|---|---|---|
| Integrity | NOT NULL, UNIQUE, CHECK, foreign keys enforced on write | Schema change is a migration, not a code deploy |
| Concurrent revision | Unique constraint on (part_number, revision) rejects a duplicate release | Loser gets an error and must retry with a new revision |
| BOM explosion | Recursive CTE walks assembly_component to any depth | Cost grows with assembly depth and branching factor |
| CAD geometry | Stored as a blob or external object reference, keyed by part_id | The database guarantees the reference, not the geometry inside the blob |
For the BOM walk, the primary key (parent_id, child_id) already serves lookups by parent_id, because a composite B-tree index can be searched on its leftmost column. No separate index on parent_id is needed for that access pattern. A separate index would only help a different pattern, such as lookups by child_id alone, which the current key does not serve.
A worked trace makes the join concrete. Suppose part 10 is WING-ASSY-A rev C, part 11 is BRACKET-042 rev B, and part 12 is BRACKET-042 rev C. The composite unique constraint allows both 11 and 12. assembly_component holds (10, 11, 4) and (10, 12, 2) during a transition. A query for released children only:
| parent_id | child_id | qty | child part_number | child revision | status |
|---|---|---|---|---|---|
| 10 | 11 | 4 | BRACKET-042 | B | RELEASED |
| 10 | 12 | 2 | BRACKET-042 | C | DRAFT |
Filtering on status = 'RELEASED' returns one row. Without the status column on the part row, the database cannot answer that question at all. That is the point of the conceptual model: facts that must be queried separately get their own rows and columns.
Failure modes I would name in the loop
First, missing foreign keys. If assembly_component.child_id had no constraint, deleting part 11 would leave a dangling BOM entry. The join would silently drop it or return a null part number, and the error would surface in manufacturing, not at delete time.
Second, over-normalisation for a read-heavy path. Splitting every attribute into its own table makes writes clean and a BOM query with many joins slow. In PLM systems the common compromise is to keep the transactional tables normalised and maintain a denormalised read model for the exploded BOM, rebuilt on release.
Third, treating the database as a file store. A 200 MB CAD model in a BYTEA column will bloat backups and buffer pools. The usual pattern is to store the file in object storage and keep only its URI, checksum and owning part_id in the table, with the checksum verified on retrieval.
If the interviewer pushes on alternatives, I would contrast this with a document store, where an assembly and its components live in one JSON document and are fast to fetch together but hard to query across assemblies, and a graph store, where traversing a BOM is natural but ad hoc reporting and transactional constraints are weaker. For engineering data with revisions, permissions and traceability requirements, the relational core with a recursive query on top is the mainstream choice.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-6Tell me about a project you were proud of or had enjoyed most?
Reported in Dassault Systèmes Software Engineer Interview Guide 2026
The 90-second answer
The project I would pick is an incremental clash-detection service I built for large CAD assemblies at my previous employer. The problem was concrete: a 48,000-component assembly took 41 seconds to check for interferences after every parametric edit, so engineers stopped running the check and found clashes in physical prototypes instead.
I was the lead engineer on a four-person team, owning the geometry pipeline from design to release over nine months. We shipped a service that returned results in 5.8 seconds for the same assembly, with zero missed clashes in a 2,000-case regression set drawn from production models. I am proud of it because the win did not come from a faster algorithm alone. It came from deciding what not to recompute.
What we built
The old path loaded the full B-rep, ran an O(n^2) broad phase over every pair of solids, then a precise kernel test on the survivors. On that assembly that was 1.15 billion pair checks.
We split it into three stages and cached aggressively between them:
The key change was the dirty subtree. A parametric edit in CATIA-style models usually touches one feature and its dependents, often 200 to 800 components out of 48,000. We tracked the dependency graph from the edit event, extracted only that subtree, and invalidated cache entries whose geometry hash changed. Unchanged pairs kept their previous result.
The numbers that drove the design
Profiling the old path on a workstation-class machine (8 cores, 32 GB RAM) gave us this split:
| Stage | Before | After | Why |
|---|---|---|---|
| Broad phase | 31.2 s | 0.9 s | Spatial hash replaced pairwise checks |
| Narrow phase | 8.4 s | 3.1 s | Candidates fell from 1.15B pairs to 41k pairs |
| Load + tessellation | 1.4 s | 1.8 s | Slight increase from hash build |
| Total | 41.0 s | 5.8 s | Measured p50 over 30 runs |
The broad phase used a uniform spatial hash over axis-aligned bounding boxes, rebuilt per run because the dirty subtree is small. For a full rebuild we fell back to a BVH, which was slower to build but handled long, thin parts (piping runs, wiring harnesses) that hash badly. That choice mattered: with the hash alone, one harness assembly produced 3.2 million false candidates and the narrow phase regressed to 19 seconds.
A simplified version of the hash insertion:
// C++17, checked against the service codebase
struct CellKey {
int x, y, z;
bool operator==(const CellKey& o) const noexcept {
return x == o.x && y == o.y && z == o.z;
}
};
struct CellKeyHash {
std::size_t operator()(const CellKey& k) const noexcept {
auto h = std::hash<int>{}(k.x * 73856093);
h ^= std::hash<int>{}(k.y * 19349663);
h ^= std::hash<int>{}(k.z * 83492791);
return h;
}
};
// Cell size = 2x median bounding-box diagonal, retuned per assembly class.
// Pairs sharing a cell become narrow-phase candidates.Failure modes we hit, and how we caught them
First, stale results. Our cache key was the component ID, and a parametric edit could change geometry without changing the ID. Two weeks after launch, a user reported a clash that the service had cleared. Root cause: a sketch dimension change propagated through a shared datum, and our dirty-subtree extraction missed one dependent because the graph edge was created by a macro, not the UI. We changed the key to a hash of the tessellated geometry plus the transform, and added a nightly job that recomputes a random 1% of cached pairs and alerts on mismatch. That job has caught three real bugs since.
Second, a race. The narrow phase ran in parallel across cores and shared a B-rep cache that was not thread-safe. It showed up as intermittent crashes under ThreadSanitizer, roughly 1 in 400 runs, never in single-threaded tests. We sharded the cache by cell and made the kernel test take a const view, which removed the shared mutable state entirely.
Third, tolerance. Exact tests at seams between coincident faces produced false positives. We set the clash tolerance to 0.01 mm for machined parts and 0.1 mm for sheet metal, and we surface the tolerance in the report. Hiding it would have made the tool look more precise than it was.
Trade-offs I would defend now
Incremental checking is wrong when the edit is global, such as a unit change or a top-level datum move. In that case the dirty subtree is the whole assembly and the hash rebuild dominates. We detect that case (dirty ratio above 60%) and switch to a full BVH pass rather than pretending the incremental path helps. I would also not use this design for assemblies under about 2,000 components. There the old pairwise check finishes in under a second and the extra machinery is not worth maintaining.
What I took from it: the measurable win was 41 seconds to 5.8, but the durable win was the cache invalidation contract. That contract is what let three other teams reuse the service for mass properties and clearance checks without rewriting the pipeline.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-7What is the problem in this short code snippet?
Reported in Dassault Systemes interview process 2026: rounds, questions and tips · CureBugs
The 90-second answer
I would first ask which language and compiler flags apply, because the same lines are a warning in one language and undefined behaviour in another. Then I would read the snippet for three things in order: memory safety, arithmetic, and contract. A snippet that looks correct on a small input often fails only at the boundary, so I trace the first and last iteration explicitly.
Take this C++17 snippet, the kind of short function that appears in a review:
#include <cstddef>
int sum(const int* data, int n) {
int total = 0;
for (int i = 0; i <= n; ++i) {
total += data[i];
}
return total;
}The primary problem is the loop bound. i <= n reads data[n], one element past the last valid index data[n - 1]. That is an out-of-bounds read. In a large CAD assembly loop at Dassault Systèmes, that read can return a stale value, crash under AddressSanitizer, or silently corrupt a result depending on what happens to sit after the buffer. Two secondary problems sit in the same five lines. Signed overflow of total is undefined behaviour in C++ once the sum passes INT_MAX (2,147,483,647), and there is no check that data is non-null when n > 0.
Worked trace
Assume data points to a buffer of 3 ints, so n = 3 and valid indices are 0, 1, 2.
| Iteration | i | Access | Result |
|---|---|---|---|
| 1 | 0 | data[0] | valid |
| 2 | 1 | data[1] | valid |
| 3 | 2 | data[2] | valid, last element |
| 4 | 3 | data[3] | out of bounds, loop should have stopped |
The trace shows the bug is not a rare race. It fires on every call with n >= 1.
The fix and how I would prove it
#include <cstddef>
#include <span>
long long sum(std::span<const int> data) {
long long total = 0;
for (int v : data) total += v;
return total;
}std::span carries the size with the pointer, so the caller cannot pass a mismatched count. long long pushes overflow far away for realistic inputs: even 10 million values near INT_MAX sum to about 2.1e16, well inside the 9.22e18 limit of a signed 64-bit integer. If the caller really needs 32-bit wrap semantics, I would say so explicitly and use unsigned int or __builtin_add_overflow, rather than relying on signed overflow.
I would verify with a test that fails before the fix and passes after it: an empty span, a single element, and a buffer allocated with a guard page or AddressSanitizer (-fsanitize=address,undefined). AddressSanitizer reports the data[3] read directly, and UndefinedBehaviorSanitizer reports a signed overflow on a large input. That pair of checks catches both classes without me having to eyeball every loop in the codebase.
What I would say about the rest of the snippet
If the interviewer then asks whether the function is thread-safe, the answer is yes for reads, since it writes only to a local. If the snippet instead shared a static accumulator, I would flag a data race. If it allocated inside the loop, I would flag the cost: an allocation per iteration turns an O(n) scan into O(n) allocations, which shows up as p99 latency growth long before it shows up as a correctness bug. Naming the failure mode, the trace that exposes it, and the sanitizer that proves the fix is the pattern I would repeat for any snippet put in front of me.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-8Implement a simple growable array?
Reported in Dassault Systemes interview process 2026: rounds, questions and tips · CureBugs
The 90-second answer
I would implement it as a contiguous buffer with separate size and capacity. size is how many elements are live, capacity is how many slots are allocated. Access is O(1) by index. When push_back finds size == capacity, I allocate a larger buffer, move the live elements across, free the old buffer, then insert. That gives O(1) amortised push and O(n) worst case on the push that grows.
Assumptions I would state first: single threaded, elements stored by value, and the caller wants random access. If I needed concurrent pushes or stable iterators across growth, I would say so and pick a different structure.
// C++17, checked against g++ 13
#include <cstddef>
#include <stdexcept>
#include <utility>
template <typename T>
class GrowableArray {
public:
GrowableArray() = default;
~GrowableArray() { delete[] data_; }
GrowableArray(const GrowableArray&) = delete;
GrowableArray& operator=(const GrowableArray&) = delete;
GrowableArray(GrowableArray&& other) noexcept
: data_(other.data_), size_(other.size_), capacity_(other.capacity_) {
other.data_ = nullptr;
other.size_ = other.capacity_ = 0;
}
std::size_t size() const { return size_; }
std::size_t capacity() const { return capacity_; }
T& at(std::size_t i) {
if (i >= size_) throw std::out_of_range("GrowableArray::at");
return data_[i];
}
void push_back(const T& value) {
if (size_ == capacity_) reserve(capacity_ == 0 ? 1 : capacity_ * 2);
data_[size_++] = value;
}
void push_back(T&& value) {
if (size_ == capacity_) reserve(capacity_ == 0 ? 1 : capacity_ * 2);
data_[size_++] = std::move(value);
}
private:
void reserve(std::size_t new_capacity) {
T* next = new T[new_capacity];
for (std::size_t i = 0; i < size_; ++i) next[i] = std::move(data_[i]);
delete[] data_;
data_ = next;
capacity_ = new_capacity;
}
T* data_ = nullptr;
std::size_t size_ = 0;
std::size_t capacity_ = 0;
};Why doubling works
With growth factor 2, the total number of element moves to reach n elements is bounded by 1 + 2 + 4 + ... + n/2, which is less than 2n. Divide by n pushes and the amortised cost per push is under 2 moves, so O(1) amortised. The trace below shows the copies actually paid.
| Push # | Size before | Capacity before | Reallocation | Elements copied |
|---|---|---|---|---|
| 1 | 0 | 0 | 0 to 1 | 0 |
| 2 | 1 | 1 | 1 to 2 | 1 |
| 3 | 2 | 2 | 2 to 4 | 2 |
| 4 | 3 | 4 | none | 0 |
| 5 | 4 | 4 | 4 to 8 | 4 |
| 6 to 8 | 5 to 7 | 8 | none | 0 |
| 9 | 8 | 8 | 8 to 16 | 8 |
After 9 pushes, 15 elements have been copied in total. That is 1.67 copies per push, inside the bound above. The cost is memory waste: at size 9 with capacity 16, 7 slots sit unused. For a 24 byte element that is 168 bytes wasted, acceptable for a general container.
Growth factor trade-off
| Factor | Copies to reach 1,000,000 elements | Worst case unused slots | When I would pick it |
|---|---|---|---|
| 2.0 | about 1,000,000 | about 50% of capacity | Default. Fewest reallocations. |
| 1.5 | about 2,000,000 | about 33% of capacity | Large elements or memory constrained code, for example vertex buffers in a CAD kernel where a 50% overshoot is megabytes. |
| 1.25 | about 4,000,000 | about 20% of capacity | Rarely. Copy cost dominates. |
I would keep 2.0 unless profiling showed the overshoot mattered. Switching to 1.5 is a one line change, but it doubles total copy work, so I would measure first.
Failure modes I would name
Overflow: capacity_ * 2 wraps when capacity passes SIZE_MAX / 2. I would check if (capacity_ > SIZE_MAX / 2) throw std::bad_alloc(); before multiplying, and also cap growth at max_size() for the allocator. Without that check the buffer silently shrinks and the next write corrupts memory.
Exception during reallocation: if moving an element throws, the old buffer must still own the live elements. The code above allocates next first and only deletes data_ after every move succeeds, so a throw leaks next but leaves the array valid. In production code I would wrap the move loop so next is deleted on the exception path, or require noexcept move for the element type and state that requirement.
Invalid access: operator[] without a check is faster but undefined behaviour on a bad index. I provide at() for checked access and would only add an unchecked operator[] if the hot loop proved it necessary, with the contract documented.
Alternatives and when not to use this
A linked list gives O(1) push at both ends and no reallocation, but access by index is O(n) and cache locality is poor. For sequential scans over geometry data, that is usually a large loss. A chunked array (a list of fixed blocks) keeps iterators stable across growth and avoids one huge allocation, at the cost of two level indexing. I would mention it if the interviewer asked about iterator stability, then stay with the simple contiguous version because that is what was asked.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-9Write SQL queries for a given task: with parts, revisions and change_orders tables, get the latest released revision per part and flag parts with an open change order?
Reported in Dassault Systemes interview process 2026: rounds, questions and tips · CureBugs
The 90-second answer
I would state the grain first: one row per part, showing its latest released revision, plus a flag for an open change order. Then I would write one query, not three, and check it against a small example.
Assume PostgreSQL 15 and this schema:
CREATE TABLE parts (
part_id BIGINT PRIMARY KEY,
part_number TEXT NOT NULL UNIQUE,
status TEXT NOT NULL
);
CREATE TABLE revisions (
part_id BIGINT NOT NULL REFERENCES parts(part_id),
revision TEXT NOT NULL,
released_at DATE,
PRIMARY KEY (part_id, revision)
);
CREATE TABLE change_orders (
co_id BIGINT PRIMARY KEY,
part_id BIGINT NOT NULL REFERENCES parts(part_id),
state TEXT NOT NULL,
opened_at DATE NOT NULL
);The query uses a window function to pick the newest released revision per part, and EXISTS for the flag so joining change orders cannot multiply rows:
SELECT part_number, revision, released_at, has_open_co
FROM (
SELECT p.part_number,
r.revision,
r.released_at,
EXISTS (
SELECT 1
FROM change_orders co
WHERE co.part_id = p.part_id
AND co.state = 'Open'
) AS has_open_co,
ROW_NUMBER() OVER (
PARTITION BY p.part_id
ORDER BY r.released_at DESC, r.revision DESC
) AS rn
FROM parts p
JOIN revisions r ON r.part_id = p.part_id
WHERE r.released_at IS NOT NULL
) ranked
WHERE rn = 1
ORDER BY part_number;released_at IS NOT NULL excludes unreleased revisions. The revision DESC tiebreaker makes the choice deterministic if two revisions share a release date. EXISTS returns true or false without duplicating the part row, which a direct join to change_orders would do when a part has two open orders.
Worked trace with sample data:
| part_number | revisions (revision, released_at) | open change order? | result |
|---|---|---|---|
| BRACKET-10 | A, 2024-01-10; B, 2025-03-01; C, NULL | yes | B, 2025-03-01, true |
| SHAFT-22 | A, 2024-06-15 | no | A, 2024-06-15, false |
| GEAR-7 | A, NULL | no | no row, no released revision |
That trace catches the two mistakes I check for: picking an unreleased revision, and returning a part with no released revision at all.
Failure modes I would name. Join fan-out: if I joined change_orders directly and then aggregated, counts and sums would inflate. EXISTS avoids that. NULL handling: released_at DESC in PostgreSQL puts NULLs first by default, so without the WHERE filter an unreleased revision could win. Indexing: this needs (part_id, released_at DESC) on revisions and (part_id, state) on change_orders, otherwise the window sort and the EXISTS check scan on large tables. If the interviewer then asks for all revisions, not just the latest, I drop the outer WHERE rn = 1 and keep the same inner query.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-10Introduce yourself and explain your MERN stack project in detail?
Reported in Dassault Systemes interview process 2026: rounds, questions and tips · CureBugs
The 90-second answer
"I am a software engineer with two years building full-stack JavaScript products, most recently on a MERN application I built end to end. It is a parts and bill-of-materials tracker for small engineering teams. A user uploads a parts list, the app builds a tree of assemblies, and the team can search, version and export it. I owned the React front end, the Express API and the MongoDB schema. The stack is MongoDB, Express, React and Node.js, deployed as a React build served by Express behind Nginx, with JWT auth and file uploads to S3-compatible storage."
That covers who I am, what the project does, and what I personally built. Then I go deeper only where the interviewer probes.
Architecture I would sketch on the whiteboard
The split matters for a reason I learned the hard way. Parsing a 12,000-row CSV inside the request handler blocked the event loop for about 4 seconds and timed out at the load balancer. Moving the parse to a worker with a job document in MongoDB (status: queued | running | done) dropped the API p95 for that route from 4,100 ms to 90 ms. The client polls GET /api/jobs/{id} and only renders the tree when the job is done.
The API surface
| Route | Purpose | Detail that decides correctness |
|---|---|---|
POST /api/auth/login | issue token | access token 15 min, refresh token 7 days, httpOnly cookie |
GET /api/parts?search=&cursor= | list parts | keyset pagination, 50 per page |
POST /api/assemblies | create assembly | Idempotency-Key required, duplicate uploads return the original |
GET /api/assemblies/{id}/bom | flattened BOM | computed in the worker, cached, invalidated on edit |
PATCH /api/parts/{id} | edit part | If-Match with the document version, 409 on conflict |
Code I would point to
// Node 20, Express 4, Mongoose 8
app.post('/api/assemblies', requireAuth, async (req, res) => {
const key = req.get('Idempotency-Key');
if (!key) return res.status(400).json({ code: 'idempotency_key_required' });
const existing = await Assembly.findOne({ owner: req.user.id, idempotencyKey: key });
if (existing) return res.status(201).json(existing);
const assembly = await Assembly.create({
owner: req.user.id,
idempotencyKey: key,
name: req.body.name,
status: 'draft',
});
res.status(201).location(`/api/assemblies/${assembly.id}`).json(assembly);
});The unique index on (owner, idempotencyKey) is the real guard. Two concurrent retries can both miss the findOne, but only one create wins. The loser gets a duplicate-key error, which I catch and return the winner.
Worked trace: duplicate upload
| Time | Event | Result |
|---|---|---|
| 0 ms | POST /api/assemblies with key a91f | creates assembly asm_42, returns 201 |
| 900 ms | client retries after a network timeout, same key | findOne hits, returns asm_42, 201 |
| 950 ms | second tab sends a new key b102 | creates asm_43, a genuinely new assembly |
Trade-offs and failure modes I would name unprompted
MongoDB fits the document shape here. A part has a variable set of attributes (material, supplier, revision) and the BOM tree is naturally nested. Where I would not use it is the revision history. That is relational and append-only, so I kept a separate revisions collection with a compound index and treated it as immutable. If the data had been mostly joins across users, orders and payments, I would have picked Postgres and used Mongo only for the document store.
Three failures I actually hit. First, N+1 queries on the BOM page: one query per child part turned a 300-part assembly into 301 round trips. I fixed it with a single $graphLookup plus a flat children array denormalised at write time, and the page went from 1,800 ms to 140 ms. Second, JWT in localStorage meant any XSS would steal the token, so refresh tokens moved to an httpOnly cookie with SameSite=Lax. Third, CORS worked in development and failed in production because the Vite proxy hid the missing Access-Control-Allow-Origin header. I now test the built bundle against the real API origin in CI.
What I would change next
I would add server-side search with an Atlas Search index instead of a regex on name, because the regex cannot use the text index and scans the collection past about 50,000 parts. I would also add integration tests with Supertest against a real MongoDB instance in Docker rather than mocking Mongoose, since the duplicate-key race above only shows up against a real index.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-11How would you build a vector?
Reported in Dassault Systemes interview process 2026: rounds, questions and tips · CureBugs
The 90-second answer
I would clarify first whether they mean a mathematical vector or a C++ dynamic array, and assume the latter, as in std::vector<T>. The core idea is a contiguous buffer on the heap, a size for live elements, and a capacity for allocated slots. push_back writes in place when size < capacity. When full, it allocates a larger buffer, moves the elements across, frees the old buffer, and continues. That gives amortised O(1) insertion and O(1) random access, which is why geometry code in CATIA-style kernels stores vertices and faces this way: a mesh can be indexed by pointer arithmetic without chasing nodes.
// C++17, checked against g++ -std=c++17 -Wall
#include <cstddef>
#include <utility>
template <typename T>
class Vector {
public:
Vector() = default;
~Vector() { delete[] data_; }
Vector(const Vector& other) { reserve(other.size_); append_from(other); }
Vector& operator=(const Vector& other) {
if (this != &other) { Vector copy(other); swap(copy); }
return *this;
}
Vector(Vector&& other) noexcept : data_(other.data_), size_(other.size_), capacity_(other.capacity_) {
other.data_ = nullptr; other.size_ = other.capacity_ = 0;
}
Vector& operator=(Vector&& other) noexcept {
if (this != &other) {
delete[] data_;
data_ = other.data_; size_ = other.size_; capacity_ = other.capacity_;
other.data_ = nullptr; other.size_ = other.capacity_ = 0;
}
return *this;
}
void push_back(const T& value) {
if (size_ == capacity_) reserve(capacity_ == 0 ? 1 : capacity_ * 2);
data_[size_++] = value;
}
void push_back(T&& value) {
if (size_ == capacity_) reserve(capacity_ == 0 ? 1 : capacity_ * 2);
data_[size_++] = std::move(value);
}
void reserve(std::size_t n) {
if (n <= capacity_) return;
T* next = new T[n];
for (std::size_t i = 0; i < size_; ++i) next[i] = std::move(data_[i]);
delete[] data_;
data_ = next; capacity_ = n;
}
std::size_t size() const { return size_; }
std::size_t capacity() const { return capacity_; }
T& operator[](std::size_t i) { return data_[i]; }
const T& operator[](std::size_t i) const { return data_[i]; }
private:
void append_from(const Vector& other) {
for (std::size_t i = 0; i < other.size_; ++i) push_back(other.data_[i]);
}
void swap(Vector& other) noexcept {
std::swap(data_, other.data_); std::swap(size_, other.size_); std::swap(capacity_, other.capacity_);
}
T* data_ = nullptr;
std::size_t size_ = 0;
std::size_t capacity_ = 0;
};Why doubling, and what it costs
Growth factor decides the amortised cost. With doubling, the total number of element moves for n pushes is bounded by 1 + 2 + 4 + ... < 2n, so each push pays O(1) on average. A growth factor of 1.5 lowers wasted memory (at most 50% slack instead of 100%) at the price of more reallocations. std::vector leaves the factor implementation-defined; libstdc++ uses 2.
Worked trace for nine pushes of an int, starting empty:
| Push # | size before | capacity before | Action | Elements moved |
|---|---|---|---|---|
| 1 | 0 | 0 | allocate 1 | 0 |
| 2 | 1 | 1 | allocate 2 | 1 |
| 3 | 2 | 2 | allocate 4 | 2 |
| 4 | 3 | 4 | in place | 0 |
| 5 | 4 | 4 | allocate 8 | 4 |
| 6 | 5 | 8 | in place | 0 |
| 7 | 6 | 8 | in place | 0 |
| 8 | 7 | 8 | in place | 0 |
| 9 | 8 | 8 | allocate 16 | 8 |
Total moves: 15 for 9 pushes, and capacity ends at 16 with 7 slots spare. For a 1 million vertex mesh with a 12-byte vertex struct, the live data is 12 MB. Doubling can allocate up to just under twice the live size, so in the worst case (just over 524,288 vertices, capacity 1,048,576) about 6 MB of the 12.6 MB allocation is unused. Calling reserve(1'000'000) up front removes both the copies and that slack uncertainty.
| Structure | Access | Insert at end | Insert in middle | Memory layout |
|---|---|---|---|---|
Vector above | O(1) | amortised O(1) | O(n) shift | contiguous |
std::list | O(n) | O(1) | O(1) with iterator | scattered nodes |
| Fixed array | O(1) | O(1) until full, then fails | O(n) shift | contiguous, fixed size |
Failure modes I would name in the interview
Reallocation invalidates every reference, pointer and iterator into the old buffer. Code that caches &v[i] across a push_back that triggers growth reads freed memory, and the bug only appears once the vector crosses a power of two. The fix is to re-fetch the pointer after growth, or reserve before taking addresses.
Exception safety is the second trap. If T's move or copy throws halfway through reserve, the old buffer must still own the elements. The copy-and-swap assignment above gives the strong guarantee for assignment; reserve as written assumes T's move does not throw, which holds for most value types but not all. A production version would use std::move_if_noexcept and fall back to copying.
Two smaller ones: capacity_ * 2 can overflow std::size_t for gigantic vectors, so check capacity_ > max_size() / 2 before doubling. And a missing destructor or a shallow copy constructor leaks or double-frees, which is exactly what the rule of five in the snippet prevents. If the interviewer meant a mathematical vector instead, the answer changes shape: three components, dot and cross products, normalisation, and no allocation at all, usually as a small fixed-size struct passed by value.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-12Draw an architecture diagram of your past project and explain its microservice architecture, asynchronous communications, API Gateways, Spring Security, and Load Balancing?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
I would start at the left of the board and draw the request path, then the data path. A client hits a load balancer, the load balancer forwards to an API Gateway, and the gateway routes to three Spring Boot services split by domain: identity, part management, and workflow. Synchronous calls stay inside one request. Anything that other services need to react to later goes through Kafka. That split is the whole design: the gateway owns cross cutting concerns, each service owns its database, and no service reads another service's tables.
For a PLM style project I worked on, the services were identity and access, a part and document service, and a change workflow service. The part service owned parts, revisions and files metadata in PostgreSQL. Workflow owned approvals and state transitions. Identity owned users, roles and tokens. If workflow needs a part revision, it calls the part service API or consumes an event. It never joins the part tables.
API Gateway and load balancing. The load balancer, in our case the cloud load balancer in front of Kubernetes, spreads traffic across gateway replicas using round robin with health checks. A replica that fails two consecutive health checks is removed from rotation. Because the gateway is stateless, we do not need sticky sessions. That matters at scale: with three gateway replicas behind the balancer, losing one drops capacity by a third, not every session.
The gateway then does routing, rate limiting and token validation before a request reaches a service. A typical route set:
| Route | Target | Policy |
|---|---|---|
/api/parts/** | part service | JWT required, 100 req/min per user |
/api/workflows/** | workflow service | JWT required, role check |
/auth/** | identity service | public, stricter rate limit |
If the gateway is down, nothing is reachable, so we run at least two replicas in different availability zones and put the load balancer health check on the gateway actuator endpoint, not just the port.
Spring Security. Each service is an OAuth2 resource server. The gateway validates the JWT signature against the identity service's JWKS endpoint and rejects expired or badly signed tokens with 401. Inside a service, method security enforces the finer rule, because a valid token does not mean this user may approve a change.
// Spring Boot 3, Java 17
@Configuration
@EnableMethodSecurity
public class SecurityConfig {
@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.requestMatchers("/actuator/health").permitAll()
.anyRequest().authenticated())
.oauth2ResourceServer(oauth -> oauth.jwt(jwt -> {}));
return http.build();
}
}
@PreAuthorize("hasRole('CHANGE_APPROVER')")
public void approveChange(UUID changeId) { /* ... */ }Passwords, where local login existed, were stored with BCrypt at cost 10. Tokens were short lived access tokens, 15 minutes, with refresh tokens handled by identity. The failure mode I watch for is clock skew between gateway and identity causing valid tokens to fail. We allow a 60 second clock skew in the JWT decoder and alert on 401 rate spikes.
Asynchronous communication. Synchronous REST is used when the caller needs an answer now: check a part revision exists, fetch its current state. Events are used when the caller should not wait: part.revision.published, change.approved, document.uploaded. The part service publishes to Kafka after committing to its database, using a transactional outbox table so a crash between commit and publish does not lose the event. Workflow consumes part.revision.published and starts an approval task.
| Pattern | Use it when | Risk if misused |
|---|---|---|
| Sync REST | caller needs the result to continue | cascading timeouts, tight coupling |
| Kafka event | many consumers, caller can continue | lag, duplicate delivery, ordering |
| Request reply over Kafka | rare, needs async but waits | complexity, timeout handling |
Consumers are idempotent. Each event carries an event id, and workflow stores processed ids so a redelivery after a rebalance does not create a second approval task. We monitored consumer lag per topic. Lag above 10,000 messages for more than five minutes paged the team, because that usually meant a poison message or a downstream database slowing the consumer.
What I would flag unprompted. Three things break this design in practice. First, the gateway becomes a single point of policy failure, so its config is versioned and tested like code. Second, chatty sync calls between services turn a part lookup into five hops, so we kept the call graph to one hop from the gateway and used events for the rest. Third, load balancing hides a sick instance if health checks only check the port, so our checks hit /actuator/health including database connectivity. If an interviewer pushed on scaling further, I would add caching for read heavy part metadata and partition Kafka topics by part id to keep ordering per part.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-13Write pseudo-code to print a basic star ('*') pattern?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
I would first pin down the shape, because "basic star pattern" usually means a left-aligned triangle in these whiteboard rounds. I will assume n rows, row i prints i stars, and each row ends with a newline. If the interviewer meant a centred pyramid, only the spacing loop changes.
read n
if n <= 0: stop
for row from 1 to n:
for col from 1 to row:
print "*"
print newlineThat is two nested loops. The outer loop controls the row, the inner loop controls how many stars that row gets. No array is needed, and the running time is proportional to the number of stars printed.
Worked trace for n = 4
| row | inner loop runs | output for the row |
|---|---|---|
| 1 | 1 time | * |
| 2 | 2 times | ** |
| 3 | 3 times | *** |
| 4 | 4 times | **** |
Total stars printed: 1 + 2 + 3 + 4 = 10, which is n(n+1)/2. For n = 1000 that is 500,500 characters plus 1000 newlines, so output size, not loop overhead, dominates. That is worth saying aloud, because it shows the candidate is thinking about cost rather than just syntax.
If the shape is a pyramid instead
A centred pyramid adds a leading-space loop before the stars. Row row needs n - row spaces, then 2*row - 1 stars.
for row from 1 to n:
for s from 1 to (n - row):
print " "
for col from 1 to (2*row - 1):
print "*"
print newlineFor n = 3 this prints:
*
***
*****The same skeleton covers a diamond (run the pyramid up to n, then run it back down from n-1) and an inverted triangle (start the inner loop at n and decrement). Naming those variants signals that the pattern is a loop-bound choice, not a new algorithm.
Failure modes interviewers probe
Off-by-one errors are the usual one. Starting row at 0, or using col < row instead of col <= row, drops or adds a star on every line and the trace table above catches it immediately. I would trace n = 1 and n = 2 on the board before generalising.
The second is the missing newline. Without it, all rows collapse into one line of 10 stars for n = 4, which looks correct in a count but wrong on screen. The third is unhandled input: n <= 0 should print nothing rather than a stray newline or an error, and non-integer input should be rejected before the loops start.
In a Java or C++ follow-up I would keep the same structure, use a StringBuilder or buffered writer for large n to avoid a flush per character, and keep the loops as for loops with explicit bounds so the trace stays readable under time pressure.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-14Implement a simple user-defined exception?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
In Java, a user-defined exception is a class that extends Throwable, usually through Exception for a recoverable condition the caller is expected to handle. Extending Exception makes it checked, so the compiler forces the caller to catch it or declare it with throws. I would add a serialVersionUID, constructors that carry the failing values, and a cause-preserving constructor for wrapping a lower-level failure.
// Checked against Java 17
public class InsufficientFundsException extends Exception {
private static final long serialVersionUID = 1L;
private final long requestedCents;
private final long availableCents;
public InsufficientFundsException(long requestedCents, long availableCents) {
super("Requested " + requestedCents + " cents, only "
+ availableCents + " cents available");
this.requestedCents = requestedCents;
this.availableCents = availableCents;
}
public InsufficientFundsException(String message, Throwable cause) {
super(message, cause);
this.requestedCents = -1;
this.availableCents = -1;
}
public long getRequestedCents() { return requestedCents; }
public long getAvailableCents() { return availableCents; }
}Usage, with the throw site and the handler kept separate:
public class Account {
private long balanceCents;
public void withdraw(long amountCents) throws InsufficientFundsException {
if (amountCents > balanceCents) {
throw new InsufficientFundsException(amountCents, balanceCents);
}
balanceCents -= amountCents;
}
}
// Caller
try {
account.withdraw(5_000);
} catch (InsufficientFundsException e) {
System.out.println("Rejected: " + e.getMessage());
// e.getRequestedCents() / e.getAvailableCents() are available here
}Worked trace
Assume balanceCents = 3_000 and the caller requests 5_000.
| Step | What happens | State after |
|---|---|---|
| 1 | withdraw(5_000) compares 5_000 > 3_000, true | balance still 3_000 |
| 2 | throw new InsufficientFundsException(5_000, 3_000) | exception object created, stack captured at throw site |
| 3 | Method exits abnormally, balanceCents -= amountCents never runs | balance still 3_000 |
| 4 | JVM searches for a matching catch in the caller | found at the try around withdraw |
| 5 | catch block runs with requestedCents = 5_000, availableCents = 3_000 | caller decides: retry smaller, abort, or escalate |
The balance is unchanged because the check runs before the mutation. That ordering is the point of the exercise: validate first, mutate second, so a rejected operation leaves no partial state.
Checked or unchecked
Checked (extends Exception) | Unchecked (extends RuntimeException) | |
|---|---|---|
| Compiler | Caller must catch or declare throws | No compile-time obligation |
| Typical use | Recoverable business failures: insufficient funds, invalid part revision, file not found | Programming errors: IllegalArgumentException, NullPointerException |
| Risk | Can clutter signatures if overused | Can be silently ignored if the caller never expects it |
I would pick checked here because the caller can plausibly recover by asking for a smaller amount. For a bug like a negative withdrawal amount, I would throw IllegalArgumentException instead, since that signals a defect in the caller rather than a state the caller should handle.
Failure modes I would name in the interview
Catching Exception instead of the specific type hides unrelated bugs, so I catch InsufficientFundsException directly. Swallowing the exception with an empty catch block loses the diagnostic, so at minimum I log e.getMessage() and the two amounts. When wrapping, I pass the original as cause so the stack trace shows the root failure. Finally, serialVersionUID matters once the exception crosses a serialization boundary such as RMI or a message queue; without it, a recompiled class can fail deserialization with InvalidClassException even when the fields look identical.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-15Explain Spring Boot core concepts, annotation usage, REST architecture principles, and validation checks?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
Spring Boot is a convention layer over Spring Framework. It gives you an embedded server, dependency injection, and auto-configuration so you do not write XML or boilerplate wiring. The core idea is inversion of control: the container creates and wires beans, your code declares what you need. Auto-configuration then fills in defaults for Tomcat, Jackson, JPA, and validation, and starters pull the right libraries for web, data, or security in one dependency.
For a Dassault PLM style service, say a part revision API, I would structure it as a thin controller, a service that owns transactions, and a repository. REST gives the contract, annotations declare the wiring and the contract, and Bean Validation rejects bad input before it reaches the service.
// Spring Boot 3.2, Java 17, Jakarta namespace
@RestController
@RequestMapping("/parts")
@Validated
public class PartController {
private final PartService service;
// Constructor injection: one required dependency, easy to test
public PartController(PartService service) {
this.service = service;
}
@PostMapping
public ResponseEntity<PartResponse> create(
@Valid @RequestBody CreatePartRequest request) {
PartResponse created = service.create(request);
return ResponseEntity.status(HttpStatus.CREATED)
.location(URI.create("/parts/" + created.id()))
.body(created);
}
@GetMapping("/{id}")
public PartResponse get(@PathVariable @NotBlank String id) {
return service.get(id);
}
}
public record CreatePartRequest(
@NotBlank @Size(max = 64) String partNumber,
@NotBlank @Pattern(regexp = "^[A-Z]\\d{3}$") String revision,
@DecimalMin("0.001") BigDecimal massKg,
@NotEmpty List<@NotBlank String> materialCodes) {}Annotations I actually use, and what they do
| Annotation | Where | Effect |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
@SpringBootApplication | Main class | Meta annotation for @Configuration, @EnableAutoConfiguration, @ComponentScan |
@RestController | Controller | @Controller plus @ResponseBody, return values are serialised to JSON |
@Service, @Repository | Service, repository | Component scan markers, @Repository also translates data access exceptions |
@ConfigurationProperties | Config class | Binds application.yml properties with type safety, preferred over @Value for groups |
@Transactional | Service method | Starts a transaction, rolls back on unchecked exceptions by default |
@Valid, @Validated | Controller params, class | Triggers Bean Validation on the request body or on method parameters |
Field injection with @Autowired on fields works, but constructor injection is the default I defend in review. It makes dependencies explicit, the bean is immutable after construction, and a unit test is just new PartController(mockService).
REST principles, applied to the same API
Resources are nouns in the path, verbs are HTTP methods. POST /parts creates, GET /parts/{id} reads, PATCH /parts/{id} amends, POST /parts/{id}/release performs a state change that is not a field edit. The API is stateless, so each request carries its identity and version, which lets a load balancer route any request to any instance. Responses use status codes with their RFC 9110 meaning, an ETag for conditional reads, and pagination for collections.
Validation checks, in order
Validation happens in layers, and each layer has a distinct failure.
- Syntax: malformed JSON fails in Jackson before the controller runs. Return 400.
- Bean Validation:
@Validon@RequestBodychecks the constraints onCreatePartRequestbefore the method body runs. A blankpartNumberor a revision likea12returns 400 with field errors. - Semantic checks in the service: the part number already exists, or a referenced material code is unknown. Those are 409 or 422, because the syntax was valid and the business rule failed.
- Authorisation and state: a user without release rights, or a part already released, is 403 or 409.
Spring Boot 3 returns validation failures as ProblemDetail by default when you add a handler, and clients should branch on the error code and field name, not on parsing a message string.
@RestControllerAdvice
public class ApiExceptionHandler {
@ExceptionHandler(MethodArgumentNotValidException.class)
ProblemDetail handleValidation(MethodArgumentNotValidException ex) {
ProblemDetail detail = ProblemDetail.forStatus(HttpStatus.BAD_REQUEST);
detail.setTitle("Validation failed");
detail.setProperty("fields", ex.getBindingResult().getFieldErrors().stream()
.map(f -> f.getField() + ": " + f.getDefaultMessage())
.toList());
return detail;
}
}Two checks candidates miss in interviews: validation groups, so POST /parts requires massKg but PATCH /parts/{id} does not, and custom constraints for cross-field rules, for example release date after creation date, which a single field annotation cannot express. I put those in a class level @Constraint or in the service, and I test them with @WebMvcTest plus a full integration test, because annotation wiring is exactly the part that breaks silently when a starter is missing.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-16Explain Java 8 features, exception handling, concurrency, inheritance, and abstraction?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
Java 8 changed how I write everyday Java, not just syntax. Lambdas and method references replace anonymous inner classes, streams give a declarative pipeline over collections, Optional makes absence explicit, java.time replaces Date and Calendar, and default methods let interfaces evolve without breaking existing implementers. Underneath, the concurrency story also moved: CompletableFuture, ConcurrentHashMap compute methods, and the ForkJoinPool behind parallel streams.
Exception handling, concurrency, inheritance and abstraction are where interviewers check whether I can use those features safely. Streams do not make exceptions disappear, parallel streams do not make shared state safe, and a default method does not fix a bad hierarchy.
Java 8 features I actually use
// Checked against Java 8 and later. No external libraries.
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
public class PartLoader {
public List<String> load(Path file) throws IOException {
// try-with-resources closes the reader even if readLine fails.
try (BufferedReader reader = Files.newBufferedReader(file)) {
return reader.lines()
.map(String::trim)
.filter(s -> !s.isEmpty())
.sorted()
.collect(Collectors.toList());
}
}
public CompletableFuture<String> fetchAsync(String id) {
return CompletableFuture.supplyAsync(() -> "part-" + id);
}
}map(String::trim) is a method reference. The stream pipeline is lazy until collect, so filter and sorted do not iterate three times. That matters on a 2 million row BOM export: a loop with an ArrayList is often clearer and avoids intermediate collections if memory is tight. Streams are for transformation, not a replacement for every loop.
Optional<T> is a return type for a value that may be absent, for example Map.get wrapped as Optional.ofNullable(map.get(key)). It is not a field type, not a method parameter, and not a substitute for throwing on an error. Throwing NoSuchElementException from optional.get() on an empty value is a common bug.
Exception handling
Checked exceptions (IOException, SQLException) must be caught or declared. Unchecked exceptions (IllegalArgumentException, NullPointerException, IllegalStateException) extend RuntimeException and signal programming errors or bad arguments. I do not catch Exception or Throwable to swallow failures. In a PLM or simulation service, swallowing an IOException while reading a part file turns a clear failure into a silently incomplete model.
Two Java 7 and 8 mechanisms I use daily:
| Mechanism | Use | Failure it prevents |
|---|---|---|
| --- | --- | --- |
try-with-resources | Files, sockets, JDBC connections | Leaked handles when an exception occurs mid-read |
Multi-catch catch (IOException | SQLException e) | Related exceptions handled the same way | Duplicated catch blocks |
| Suppressed exceptions | Primary exception plus close failure | Close failure hiding the real cause |
If the body throws and close() also throws, the close exception is added via addSuppressed and the original propagates. That trace is visible in a stack trace, which is how on-call finds the root cause.
Concurrency
synchronized gives mutual exclusion and visibility for a monitor. ReentrantLock adds try-lock with timeout and fair ordering, at the cost of manual unlock in a finally block. volatile gives visibility and atomicity for reference writes, but volatile int count does not make count++ atomic. That increment is read, add, write, so two threads can lose an update.
For shared maps I use ConcurrentHashMap. Its computeIfAbsent is atomic per key, so this is safe:
cache.computeIfAbsent(partId, id -> loadPart(id));The equivalent if (!cache.containsKey(id)) cache.put(id, loadPart(id)) races. Two threads can both load the same part.
CompletableFuture.supplyAsync runs on the common ForkJoinPool by default. That pool has parallelism equal to available processors. Blocking IO on it, for example a slow file or network call per task, can starve other async work. In production I pass an explicit ExecutorService with a bounded queue and a timeout, and I set a deadline on the future. Deadlock detection: lock ordering must be consistent. If thread A locks part then revision and thread B locks in reverse order, both wait forever. I avoid nested locks across objects and prefer immutable objects or concurrent collections.
Parallel streams use the same common pool. They help for CPU bound work on large in-memory data. They hurt for IO bound work or small collections, where overhead exceeds the gain.
Inheritance and abstraction
Inheritance is extends: a subclass gets fields, methods and state from a superclass, and is-a must hold. class Revision extends Part only works if every Part operation is valid for a Revision. If not, composition is safer: hold a Part inside a Revision instead of extending it.
Abstraction is abstract class or interface. An abstract class can hold state, constructors and concrete methods. An interface, since Java 8, can hold default methods and static methods, but no instance fields. A class implements many interfaces but extends one class, which is how Java avoids the diamond problem for state. If two interfaces supply the same default method, the implementing class must override it and resolve the conflict explicitly. The compiler forces that choice, which is the point.
| Abstract class | Interface | |
|---|---|---|
| State | Instance fields allowed | Constants only |
| Multiple | Extends one | Implements many |
| Evolution | Adding a method breaks subclasses | Adding a default method does not break implementers |
| Typical use | Shared base with state, for example AbstractPart | Capability contract, for example Loadable, Versioned |
My rule: model capabilities as interfaces, share state only when the is-a relationship is real, and prefer composition when I need reuse without a hierarchy. A deep hierarchy in a large Dassault codebase becomes hard to change when a new part type must fit an old base class. A small interface plus a composed helper is easier to test and to mock.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-17How did you handle bugs encountered during UAT and exceptions in production, and how do you approach unit testing?
Reported in Interview Experience: Dassault Systemes- 3YOE Java
The 90-second answer
I treat UAT bugs, production exceptions and unit tests as one loop: reproduce with the exact data and version, fix the cause, and add a test that would have caught it before a customer did. In a PLM environment like 3DEXPERIENCE that matters because a UAT defect often comes from a customer configuration, a large assembly, or a revision state that never appears in a small dev dataset.
For UAT I first separate a real defect from a configuration or training issue. I ask for the build number, the tenant or server configuration, the part or change order ID, and steps that reproduce it on a clean dataset. If I cannot reproduce it, I still log what I tried and ask the tester for logs around the timestamp. Severity is set by impact, not by who reported it: a crash on save, data loss on revision release, or a wrong bill of materials in a released state is critical; a wrong label that does not change data is minor. Critical defects get a same-day workaround or fix, a regression run on the affected module, and a check of related flows such as check-in, check-out and release.
For production exceptions I do not start by catching everything. I classify the exception, find where it crossed a boundary, and decide whether the caller can recover. A validation failure should return a clear error to the user. A downstream timeout should be retried only if the operation is idempotent, otherwise it should fail fast and be alerted on. Swallowing an exception and returning a default value is how a failed save turns into silent data corruption.
For unit testing I test the rule, not the framework. In Java I write small JUnit 5 tests for business rules such as revision transitions, permission checks and BOM calculations, mock only the repository or external service at the boundary, and use parameterized tests for the edge cases a reviewer would ask about.
// JUnit 5, checked against JUnit 5.10 / Mockito 5
@ParameterizedTest
@CsvSource({"DRAFT,RELEASED,true", "RELEASED,DRAFT,false", "RELEASED,RELEASED,false"})
void releaseTransitionRules(String from, String to, boolean expected) {
assertEquals(expected, RevisionRules.canTransition(from, to));
}
@Test
void saveFailsWhenPartIsReleased() {
Part part = new Part("P-1042", RevisionState.RELEASED);
assertThrows(IllegalStateException.class, () -> partService.save(part));
verify(partRepository, never()).save(any());
}UAT bug flow
A worked triage example, with figures labelled as an example: a tester reports that releasing a change order on build 2024x fails for assemblies over 5,000 components. I reproduce it with a 6,200-component assembly, find a timeout in the BOM expansion service, and set severity to critical because release is blocked. The fix adds pagination to the expansion call and a test with a mocked slow service. Regression covers release, BOM export and check-in, because all three call the same service.
Production exceptions: what I do with each type
| Exception type | Example in PLM code | Response |
|---|---|---|
| Validation | Invalid revision transition, missing mandatory attribute | Return 422 with a field-level code, no alert |
| Business rule | Editing a released part, releasing with an open change order | Return 409 or 422, log at info with part and revision IDs |
| Downstream failure | BOM service or database timeout | Fail fast if not idempotent, alert on rate, include correlation ID |
| Unexpected runtime | NullPointerException, ClassCastException | Log stack trace with correlation ID, alert, treat as a bug to fix |
In production code I keep the handler at the boundary and keep business code free of generic catch blocks:
@ExceptionHandler(IllegalStateException.class)
ResponseEntity<ErrorBody> handleState(IllegalStateException ex, HttpServletRequest req) {
log.warn("state_conflict path={} correlation={}", req.getRequestURI(), req.getHeader("X-Correlation-Id"));
return ResponseEntity.status(409)
.body(new ErrorBody("invalid_state", ex.getMessage()));
}What I would not do
I would not close a UAT bug as "cannot reproduce" without recording the build, data volume and steps tried. I would not add a catch-all handler that returns 500 for every exception, because it hides the difference between a user error and a system failure. And I would not chase a coverage percentage. I aim for tests on the rules that protect released data, because those are the failures a customer in UAT or production will feel first.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-18Given jobs with dependencies and estimated runtimes, implement an algorithm to determine the minimum time to complete all jobs assuming infinite parallel processing capacity?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
With unlimited parallelism, the minimum time is the length of the longest dependency chain, also called the critical path. A job starts as soon as all its predecessors finish, so its earliest finish is its runtime plus the largest earliest finish among its predecessors. The answer is the largest earliest finish over all jobs. That is a longest path computation on a directed acyclic graph (DAG), solved in topological order.
I would state the assumptions first: dependencies form a DAG, runtimes are non-negative, and a job is non-preemptive once started. If there is a cycle, no valid schedule exists and the algorithm must report it instead of returning a number.
Algorithm
- Build adjacency lists and indegree counts from the dependency edges.
- Run Kahn's algorithm to get a topological order. Jobs with indegree zero go first.
- Walk that order once, maintaining
earliest_finish[job]. For a job with no predecessors it is its runtime. Otherwise it is its runtime plus the maximumearliest_finishof its predecessors. - The makespan is the maximum
earliest_finish. If fewer jobs are emitted than exist, the remaining jobs are in or downstream of a cycle.
from collections import defaultdict, deque
def min_completion_time(jobs):
# jobs: dict job_id -> runtime; edges: list of (before, after)
runtime, edges = jobs
succ = defaultdict(list)
indegree = {j: 0 for j in runtime}
for before, after in edges:
succ[before].append(after)
indegree[after] += 1
queue = deque(j for j, d in indegree.items() if d == 0)
earliest_finish = {}
processed = 0
while queue:
job = queue.popleft()
processed += 1
preds = [b for b, a in edges if a == job]
start = max((earliest_finish[p] for p in preds), default=0)
earliest_finish[job] = start + runtime[job]
for nxt in succ[job]:
indegree[nxt] -= 1
if indegree[nxt] == 0:
queue.append(nxt)
if processed != len(runtime):
raise ValueError("cycle in dependencies: no valid schedule")
return max(earliest_finish.values(), default=0)The predecessor lookup inside the loop is O(E) per job, so for production code I would store predecessors explicitly and keep the whole pass at O(V + E). Time is O(V + E) and memory is O(V + E) for the graph plus O(V) for the finish times. A DFS with memoised recursion computes the same values and is shorter to write, but Kahn's version detects cycles naturally and avoids recursion depth limits on graphs with tens of thousands of jobs, which matters for a Dassault build or simulation pipeline where a CATIA generation step can fan out into many solver jobs.
Worked trace
Take runtimes A=3, B=2, C=5, D=1 with edges A to B, A to C, B to D, C to D. This resembles a model build (A), then meshing (B) and material setup (C) in parallel, then a solver run (D).
| Job | Predecessors | Earliest start | Runtime | Earliest finish |
|---|---|---|---|---|
| A | none | 0 | 3 | 3 |
| B | A | 3 | 2 | 5 |
| C | A | 3 | 5 | 8 |
| D | B, C | 8 | 1 | 9 |
The longest chain is A to C to D, totalling 9. B finishes at 5 and waits. No schedule can beat 9 because those three jobs must run sequentially, and the earliest-start schedule achieves 9, so it is optimal. That lower-bound argument is the proof to give if the interviewer pushes on correctness.
Where this stops applying
The result depends entirely on infinite capacity. With a fixed number of cores or licensed solver seats, the problem becomes resource-constrained scheduling, which is NP-hard in general, and the critical path is only a lower bound. List scheduling by priority (for example longest runtime first) is the usual heuristic there, and its makespan can exceed the critical path. Other failure modes to name: a missing dependency entry silently treated as no predecessor, negative or zero runtimes breaking the longest-path reasoning, and estimated runtimes drifting from actuals, which shifts the critical path after the fact. If runtimes are uncertain, I would rerun the pass with updated estimates rather than add a fudge factor, since the DAG computation is cheap.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-19Design a system to manage the version history of complex 3D CAD models in a SaaS environment and efficiently retrieve a specific version?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
I would not store a CAD model as a file that gets overwritten. I would store immutable, content-addressed blobs plus a small mutable manifest per version. The blob store holds the geometry and parametric data. Postgres holds the graph: which model exists, which version points to which blobs, and which assembly version depends on which part versions. A version is then a row plus a manifest, not a 400 MB copy.
Upload is chunked and resumable. The client sends chunks, the server hashes each chunk with SHA-256, and deduplicates on that hash. On commit, the client submits a manifest listing blob hashes, the parent version, and the dependency list. The server validates that every hash exists and every dependency is released or at least committed, then writes the version row in one transaction. Retrieval reverses that: fetch the manifest, resolve the dependency closure, hand back presigned URLs for the blobs, and let the client or a reconstruction service apply deltas if the version was stored as a delta.
Why this shape fits CAD
A CATIA or SOLIDWORKS style model is not one blob. An assembly references dozens of parts, each with its own history, and a part has a parametric feature tree. Editing one bracket should not duplicate the whole assembly. Content addressing gives that for free: if version 12 of an assembly reuses 40 of 42 part blobs from version 11, only the two new hashes are stored.
Deltas help for the parametric history inside a single part. Store a full snapshot every N versions, say every 10, and store the feature-level delta between snapshots. Reconstructing version 37 means loading snapshot 30 and applying seven deltas. That trades retrieval CPU for storage, which is the right trade when storage is billed per GB per month in a SaaS and retrieval is occasional.
| Strategy | Storage for 100 versions of a 400 MB part | Retrieval cost | Risk |
|---|---|---|---|
| Full copy per version | 40 GB | One download | Simple, wasteful |
| Snapshot every 10 plus deltas averaging 25 MB | 400 MB x 10 snapshots + 90 x 25 MB = about 6.25 GB | Load snapshot, apply up to 9 deltas | Delta chain must be checksummed |
| Content-addressed blobs with dedup across parts | Often 2 to 4 GB in practice for assemblies sharing standard parts | Manifest lookup plus parallel blob fetch | Manifest and hash bookkeeping |
Those figures are illustrative, but the ratio is the point. At 10,000 tenants, the full copy column is what kills the business.
Retrieval path, concretely
GET /models/{id}/versions/{version}/manifest returns the manifest and an ETag. The client then requests blobs by hash, which are immutable and therefore cacheable forever at the CDN. For a delta version, the response includes base_version and the ordered delta list. A reconstruction worker can materialise a full file server side for viewers that cannot apply deltas, and cache that materialised file under the version hash.
# Python 3.11, checked against the manifest schema described above
def resolve(manifest, store):
blobs = []
for ref in manifest["dependencies"]:
dep = store.get_manifest(ref["model_id"], ref["version"])
blobs.extend(resolve(dep, store))
blobs.append(manifest["base_blob"])
for delta in manifest.get("deltas", []):
blobs.append(delta)
return blobs # caller fetches in parallel, verifies SHA-256 per blobFailure modes I would name in the interview
Dangling references: a commit that points at a part version deleted by a retention policy. Prevent it with a foreign key from version dependencies to versions, and never hard delete a version that is referenced. Retention marks versions superseded, it does not remove blobs until a garbage collector proves no manifest references them.
Branching: two engineers edit the same part from version 20. CAD history is a DAG, not a line, so parent_version is a list, not a single column. Merge is a new version whose parents are both branches. The UI shows the fork; the storage layer does not need to care.
Large assemblies: a manifest with 500 dependencies makes naive sequential retrieval slow. Fetch blobs in parallel with a bounded fan-out, and cache the resolved closure as one object keyed by the assembly version hash, so the second retrieval is a single CDN hit.
Concurrency and permissions: SaaS means tenant isolation on every query, and a checkout lock per part so two people do not commit conflicting parametric edits. The lock is a row with a lease expiry, not a distributed lock service, because a lease that expires is recoverable and a lock that does not is an outage.
That gives me version history that is cheap to store, fast to retrieve by hash, and honest about the graph structure CAD actually has.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-20Implement a function to merge concurrent changes to scene objects using a Last-Write-Wins strategy, flagging conflicts within a very short time window for manual resolution?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
I would apply Last-Write-Wins per field, not per scene object. A position edit from one user and a rotation edit from another can both survive. Only two edits to the same field compete. The edit with the later timestamp wins automatically. If the two timestamps fall inside a short conflict window, say 500 ms, and the values differ, I still apply the winner but I flag the pair for manual resolution. That gives fast convergence for the common case and keeps the risky case visible.
Assumptions I would state first: every change carries object_id, field, value, author_id, a hybrid logical timestamp, and the base_version the author saw. The server is the authority for ordering. Client wall clocks alone are not trusted.
# Python 3.11, checked against CPython 3.11
from dataclasses import dataclass
@dataclass(frozen=True)
class Change:
object_id: str
field: str # "position", "rotation", or "scale"
value: tuple[float, ...]
author_id: str
ts_ms: int # hybrid logical clock, server assigned on receipt
base_version: int
@dataclass
class FieldState:
value: tuple[float, ...]
ts_ms: int
author_id: str
version: int
def merge_field(current: FieldState, incoming: Change,
conflict_window_ms: int = 500) -> tuple[FieldState, dict | None]:
conflict = None
if incoming.ts_ms > current.ts_ms:
winner, loser = incoming, current
elif incoming.ts_ms < current.ts_ms:
winner, loser = current, incoming
else:
# Exact tie: break deterministically so every replica converges.
winner, loser = (incoming, current) if incoming.author_id > current.author_id else (current, incoming)
if (abs(incoming.ts_ms - current.ts_ms) <= conflict_window_ms
and incoming.author_id != current.author_id
and incoming.value != current.value):
conflict = {
"object_id": incoming.object_id,
"field": incoming.field,
"winner": {"author": winner.author_id, "value": winner.value, "ts_ms": winner.ts_ms},
"loser": {"author": loser.author_id, "value": loser.value, "ts_ms": loser.ts_ms},
"resolution": "pending_manual",
}
if winner is incoming:
return FieldState(incoming.value, incoming.ts_ms, incoming.author_id, current.version + 1), conflict
return current, conflictmerge_scene loops over incoming changes, calls merge_field for each, stores the returned state, and appends any conflict to a conflicts table keyed by object_id + field + winner.ts_ms. A UI can then show "Ana moved door-7 at 10:00:00.120, Ben moved it at 10:00:00.310, Ana's value is live, review pending."
Worked trace, hypothetical figures. Object door-7, field position, current state (1.0, 0.0, 0.0) at ts_ms=1000 by Ana.
| Incoming change | Author | ts_ms | Winner | Conflict flagged? |
|---|---|---|---|---|
(1.2, 0.0, 0.0) | Ben | 1120 | Ben, later timestamp | Yes, 120 ms apart, different values |
(1.5, 0.0, 0.0) | Ana | 900 | Current state stays | No, outside window and older |
(1.2, 0.0, 0.0) | Ben | 1120 duplicate | Current state stays | No, same value as current |
(1.2, 0.0, 0.0) | Ana | 1120 | Ben by author tie-break | No, values identical |
Why LWW here, and where it breaks
| Strategy | Convergence | Preserves both edits? | Cost |
|---|---|---|---|
| LWW per field | Yes, deterministic | No, loser is overwritten | O(1) per field |
| Operational transform | Yes, with transform functions | Often, by rebasing | High, needs a transform per operation pair |
| CRDT register | Yes, by design | No for a plain register, yes for a multi-value register | Storage and GC overhead |
| 3-way merge against base | Yes if base is shared | Yes when edits touch different fields | Needs base version retained |
For transform fields in a CAD or scene graph, LWW per field is defensible because position, rotation and scale are independent scalars. OT would be overkill and hard to get right for quaternion rotation. A multi-value CRDT register is the closest alternative. It would keep both values live until a user picks one, which matches the manual resolution requirement more cleanly, at the price of unbounded growth if users never resolve.
Failure modes I would name in the loop:
- Clock skew. Two clients 2 s apart make the later real edit lose. Mitigation: server assigns
ts_mson receipt using a hybrid logical clock,max(wall, last + 1). Client timestamps are kept only for display. - Silent data loss. LWW discards the loser by design. Mitigation: never delete it. Write the loser into the conflict record with its full value, so a reviewer can restore it in one click.
- Conflict flood. A 500 ms window with many collaborators flags every near-simultaneous edit. Mitigation: flag only when values differ by more than an epsilon for floats, for example 1e-4 on position, and coalesce repeat flags for the same field within 5 s.
- Stale base. An author edits against version 3 while the object is at version 9. LWW still applies it if its timestamp is newest, which can resurrect an old intent. Mitigation: reject or rebase changes whose
base_versionis more than N versions behind, N set by the product team, and surface that as a conflict instead.
If the interviewer pushes on the window size, I would say 500 ms is a product choice, not a technical constant. Smaller windows miss real conflicts. Larger windows flag edits that users never saw as competing. I would instrument the flag rate and tune it from data.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-21Design a scalable SaaS backend for a real-time collaborative 3D modeling application?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
I would assume a browser client editing a shared CAD document, 1 to 20 collaborators per document, tens of thousands of concurrent sessions across tenants, and geometry operations that are too heavy for the request path. The backend has to do four things well: sequence edits so every client converges, keep presence and cursors cheap, run geometry work asynchronously, and store a versioned document that can be replayed.
The gateway handles REST for document CRUD, sharing and version history, plus WebSocket upgrade for live sessions. A session service issues short-lived tokens scoped to one document and one tenant, so a leaked token cannot open another customer's model. Each live document is pinned to one room shard. That shard owns the authoritative operation sequence for that document. Clients never write directly to the database.
How collaboration converges
Every edit is an operation with a client-generated ID, a base sequence number, and a payload: transform, set_parameter, add_feature, delete_feature, or set_property. The room shard assigns the next sequence number, appends the operation to the log, broadcasts it, and only then acknowledges the sender. If two users move the same body at once, the later sequence wins for that transform, and both clients apply the same ordered stream, so they converge without a merge step on the client.
For properties that can be edited concurrently, such as a material name or a comment, I use a last-writer-wins register keyed by field with the server sequence as the tie-breaker. For the feature tree, deletions are tombstones. A delete that arrives after a concurrent edit to the same feature marks it deleted and keeps the edit in history, which avoids resurrecting geometry a user just removed.
// Room shard: sequence and broadcast before ack.
func (r *Room) Apply(op Op) Ack {
op.Seq = r.nextSeq()
op.ServerTime = time.Now().UTC()
if err := r.log.Append(op); err != nil {
return Ack{Err: err}
}
r.broadcast(op) // WebSocket fan-out to room members
return Ack{Seq: op.Seq}
}A client that reconnects sends its last seen sequence. The shard replays operations after that point from the log. If the gap is larger than the retained window, say more than 5,000 operations, the server sends the latest snapshot instead and the client replaces its local state. That bounds reconnect cost.
| Operation | Conflict rule | Stored as |
|---|---|---|
| transform | higher sequence wins | delta in op log |
| set_parameter | higher sequence wins, validated against schema | delta in op log |
| add_feature | always applies, new feature ID | delta in op log |
| delete_feature | tombstone, concurrent edits retained | tombstone in op log |
| set_property | last-writer-wins per field | delta in op log |
Scaling the heavy parts
Presence is ephemeral. Cursor positions, selections and viewport state go through Redis pub/sub per room with a 2 second TTL, never through Postgres. At 10,000 concurrent users sending presence at 5 Hz, that is 50,000 small messages per second, which Redis handles in memory, while the durable log only sees real edits. Suppose 2,000 users are actively editing at 2 operations per second. That is 4,000 operations per second across all rooms, and because a room shard only sequences its own document, a single shard rarely exceeds a few hundred operations per second. Sharding by documentId therefore scales by adding shards, not by making one shard faster.
Geometry work, tessellation, clash detection and STEP or IGES export, runs in workers consuming Kafka. The room shard publishes a job when a feature changes and the client does not need the result to keep editing. Workers write meshes and snapshots to object storage and publish a geometry_ready event with the operation sequence it reflects. The client renders the preview it already has and swaps in the tessellated mesh when the event arrives. If a worker falls behind, editing continues and only mesh freshness lags, which is visible in the UI as a stale mesh badge tied to the sequence number.
Storage and tenancy
Postgres holds tenants, users, documents, permissions and the operation log, partitioned by month and indexed on (document_id, seq). Snapshots every 1,000 operations or every 5 minutes, whichever comes first, keep replay short. Object storage holds snapshots, meshes and exports, addressed by document and sequence. Every row carries tenant_id, and the gateway injects it from the token rather than trusting the client. That gives tenant isolation for queries and lets us shard Postgres by tenant later without changing the API.
Failure modes I would name in the interview
A room shard crash loses in-memory presence but not edits, because the log append happens before broadcast. On restart the shard replays from the last snapshot plus the log tail. A client that sends an operation with a stale base sequence still gets sequenced, and the server rejects only operations that fail schema validation, such as a parameter outside its allowed range, with a 422 and the field name. A slow geometry worker shows up as growing Kafka lag and a rising gap between the latest sequence and the latest geometry_ready sequence, which is the alert I would page on, not CPU alone.
I would not put a CRDT library on the client for the whole document. The feature tree and geometry are not a text buffer, and a server-sequenced log gives us audit, replay and export for free. CRDT style registers are enough for the concurrent fields where ordering does not matter.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-22Implement a function that takes a list of geometric primitives (e.g., spheres, cubes, planes) and their transformations, and efficiently determines if any two primitives intersect?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
I would not test every pair against every other pair. I would split the problem into a broad phase that rejects most pairs cheaply, and a narrow phase that runs the exact test only on survivors, with early exit on the first hit because the question asks if any two intersect.
Assume primitives are already in world space or carry a 4x4 transform, n is up to tens of thousands, and we need a boolean, not the contact point. If we needed contact points I would return them from the narrow phase, but the boolean case lets us stop early.
Broad phase: compute a world axis-aligned bounding box (AABB) for each primitive. For a sphere that is centre plus/minus radius. For a cube under rotation, transform its eight corners and take min/max, which is conservative but correct. For an infinite plane, an AABB is useless, so I would treat planes separately: test plane against AABBs of everything else, or bound the plane to a large finite patch if the scene does. Then sort AABBs by min x and sweep: keep active boxes whose max x is still ahead of the current min x, and test y and z overlap only for those. That drops the common case from O(n^2) to roughly O(n log n + k), where k is the number of overlapping AABB pairs.
Narrow phase: dispatch on the pair type. Sphere-sphere is a distance check. Sphere-OBB clamps the sphere centre into the box in box space. OBB-OBB uses the separating axis theorem on 15 axes. Plane tests are a signed distance check.
// C++17, checked against the usual double-precision scene setup
struct AABB { Vec3 lo, hi; };
struct Primitive { Kind kind; Mat4 world; Vec3 centre; double radius; };
bool anyIntersect(const std::vector<Primitive>& prims) {
std::vector<AABB> boxes;
boxes.reserve(prims.size());
for (auto& p : prims) boxes.push_back(worldAABB(p));
std::vector<int> order(prims.size());
std::iota(order.begin(), order.end(), 0);
std::sort(order.begin(), order.end(),
[&](int a, int b){ return boxes[a].lo.x < boxes[b].lo.x; });
std::vector<int> active;
for (int idx : order) {
active.erase(std::remove_if(active.begin(), active.end(),
[&](int a){ return boxes[a].hi.x < boxes[idx].lo.x; }), active.end());
for (int a : active) {
if (boxes[a].lo.y <= boxes[idx].hi.y && boxes[idx].lo.y <= boxes[a].hi.y &&
boxes[a].lo.z <= boxes[idx].hi.z && boxes[idx].lo.z <= boxes[a].hi.z) {
if (narrowTest(prims[a], prims[idx])) return true;
}
}
active.push_back(idx);
}
return false;
}worldAABB for a rotated cube must transform all eight corners. Transforming only the centre and adding a fixed extent underestimates the box and silently misses intersections. For non-uniform scale, normals need the inverse transpose, and a sphere under non-uniform scale becomes an ellipsoid, so I would either reject non-uniform scale on spheres or convert that case to an ellipsoid test.
| Pair | Narrow test | Cost | Main trap |
|---|---|---|---|
| sphere-sphere | dist(c1,c2) <= r1+r2+eps | O(1) | squared distance overflow in float |
| sphere-OBB | clamp centre in box space, distance to clamped point | O(1) | forgetting to move centre into box space with inverse transform |
| OBB-OBB | SAT on 3+3+9 axes | O(15) | using only 3 axes and missing edge-edge separation |
| plane-AABB | signed distances of 8 corners have mixed signs, or min distance within tolerance | O(8) | infinite plane with no bound |
| plane-plane | parallel check, then offset check | O(1) | coincident planes counted as intersecting or not, depending on spec |
Worked trace, sweep on x, boxes shown as [lo.x, hi.x]:
| Step | Current box | Active before test | AABB overlap in y,z | Narrow test | Result |
|---|---|---|---|---|---|
| 1 | A [0,2] | none | no | no | continue |
| 2 | B [1,3] | A | yes | sphere-sphere false | continue |
| 3 | C [5,6] | none, A and B expired | no | no | continue |
| 4 | D [5.5,7] | C | yes | OBB-OBB true | return true |
Arithmetic for scale: at n = 5,000 the naive loop is about 12.5 million pairs. If only 0.1% of AABBs overlap, the sweep runs about 12,500 narrow tests. At n = 100,000 the naive loop is 5 billion pairs and is not viable, while a BVH or sweep stays practical if the scene is sparse. If the scene is dense, for example 100,000 parts all in one assembly volume, no broad phase saves you and I would say so and switch to a BVH built over the AABBs so queries still prune by volume.
Failure modes I would name in the interview: touching versus intersecting. CAD code usually has a tolerance, often 1e-7 in model units or a task tolerance in mm, so I would pass an explicit epsilon and document whether touching counts. Degenerate transforms, zero scale or a singular matrix, make the inverse transform blow up, so I would validate the matrix determinant before the narrow phase. Float precision on large coordinates, common in plant layouts where coordinates are in the thousands of mm, can shift a sphere test by more than the tolerance, so I would keep the broad phase in float if I must but run narrow tests in double. Finally, planes need a decision up front: an infinite mathematical plane intersects almost everything, so in a product scene I would bound it or handle it as a separate category rather than forcing it into the sweep.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-23Implement a parser and interpreter for a simple domain-specific language (DSL) that defines workflows?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
I would build three separate pieces: a lexer that turns text into tokens, a recursive descent parser that builds an AST, and an interpreter that validates the AST as a graph before running anything. Separation matters because a syntax error should be reported before any step runs, and a workflow definition should be testable without executing it.
Assume a workflow file looks like this:
workflow ReleasePart {
step Model { task = "catia.model"; timeout = 120; }
step Simulate { task = "simulation.run"; after Model; timeout = 600; }
step Approve { task = "plm.approve"; after Simulate; }
step Release { task = "plm.release"; after Approve; }
}Grammar, in EBNF:
workflow = "workflow" IDENT "{" step+ "}"
step = "step" IDENT "{" property* "}"
property = IDENT "=" value ";" | "after" IDENT ("," IDENT)* ";"
value = STRING | NUMBER | IDENTThe lexer skips whitespace and emits IDENT, STRING, NUMBER, {, }, =, ;, ,. Words such as workflow, step and after are lexed as IDENT and recognised by value in the parser, which keeps the token set small. The parser is one method per grammar rule, so an error can name the line and column instead of failing generically.
# Python 3.11
import re
from dataclasses import dataclass, field
@dataclass
class Token:
kind: str
value: str
pos: int
TOKEN_RE = re.compile(
r'\s*(?:(?P<STRING>"[^"]*")|(?P<NUMBER>\d+)'
r'|(?P<IDENT>[A-Za-z_][A-Za-z0-9_]*)|(?P<SYM>[{}=;,]))'
)
def tokenize(text):
tokens, pos = [], 0
while pos < len(text):
m = TOKEN_RE.match(text, pos)
if not m or m.end() == pos:
raise SyntaxError(f"unexpected character at offset {pos}: {text[pos]!r}")
pos = m.end()
kind = m.lastgroup
tokens.append(Token(kind, m.group(kind), m.start(kind)))
tokens.append(Token("EOF", "", len(text)))
return tokens
@dataclass
class Step:
name: str
task: str = ""
timeout: int = 60
after: list = field(default_factory=list)
@dataclass
class Workflow:
name: str
steps: dict
class Parser:
def __init__(self, tokens):
self.tokens, self.pos = tokens, 0
def peek(self):
return self.tokens[self.pos]
def expect(self, kind, value=None):
tok = self.peek()
if tok.kind != kind or (value is not None and tok.value != value):
want = value if value is not None else kind
raise SyntaxError(f"expected {want} at offset {tok.pos}, got {tok.value!r}")
self.pos += 1
return tok
def parse_value(self):
tok = self.peek()
if tok.kind == "STRING":
self.pos += 1
return tok.value[1:-1]
if tok.kind == "NUMBER":
self.pos += 1
return int(tok.value)
if tok.kind == "IDENT":
self.pos += 1
return tok.value
raise SyntaxError(f"expected value at offset {tok.pos}, got {tok.value!r}")
def parse_step(self):
self.expect("IDENT", "step")
name = self.expect("IDENT").value
self.expect("SYM", "{")
step = Step(name=name)
while self.peek().value != "}":
key = self.expect("IDENT").value
if key == "after":
step.after.append(self.expect("IDENT").value)
while self.peek().value == ",":
self.expect("SYM", ",")
step.after.append(self.expect("IDENT").value)
else:
self.expect("SYM", "=")
setattr(step, key, self.parse_value())
self.expect("SYM", ";")
self.expect("SYM", "}")
if not step.task:
raise SyntaxError(f"step {name} has no task")
return step
def parse_workflow(self):
self.expect("IDENT", "workflow")
name = self.expect("IDENT").value
self.expect("SYM", "{")
steps = {}
while self.peek().value != "}":
step = self.parse_step()
if step.name in steps:
raise SyntaxError(f"duplicate step {step.name}")
steps[step.name] = step
self.expect("SYM", "}")
self.expect("EOF")
return Workflow(name, steps)
wf = Parser(tokenize(open("release.wf").read())).parse_workflow()
assert wf.steps["Model"].timeout == 120
assert wf.steps["Simulate"].after == ["Model"]Note the type handling in parse_value: timeout = 120 arrives as a NUMBER token and is stored as int, while task = "catia.model" arrives as a STRING token and is stored without quotes. Storing the timeout as a string would break the interpreter when it passes it to a scheduler.
Interpreter
The interpreter does not run steps in file order. It validates the graph first, then runs ready steps in parallel. Validation catches three errors before side effects happen: a step depends on an undefined step, a step depends on itself, and the graph contains a cycle. A topological sort with Kahn's algorithm catches all three. Steps with no unsatisfied dependencies are ready. If no step is ready but steps remain, the remaining steps form or depend on a cycle, and their names are reported.
def topo_order(wf):
indegree = {name: 0 for name in wf.steps}
dependents = {name: [] for name in wf.steps}
for step in wf.steps.values():
for dep in step.after:
if dep not in wf.steps:
raise ValueError(f"step {step.name} depends on unknown step {dep}")
indegree[step.name] += 1
dependents[dep].append(step.name)
ready = sorted(n for n, d in indegree.items() if d == 0)
order = []
while ready:
name = ready.pop(0)
order.append(name)
for nxt in dependents[name]:
indegree[nxt] -= 1
if indegree[nxt] == 0:
ready.append(nxt)
if len(order) != len(wf.steps):
stuck = sorted(n for n, d in indegree.items() if d > 0)
raise ValueError(f"cycle involving steps: {', '.join(stuck)}")
return orderExecution trace for the example, with a thread pool of 4:
| Time | Ready steps | Action | Result |
|---|---|---|---|
| 0 s | Model | start catia.model | running |
| 120 s | Simulate | start simulation.run | Model succeeded |
| 720 s | Approve | start plm.approve | Simulate succeeded |
| 730 s | Release | start plm.release | Approve succeeded |
Each step runs with its timeout. On timeout or task exception, the interpreter marks that step FAILED, marks every transitive dependent SKIPPED, and leaves independent branches running. In a release workflow, Release must never run if Approve failed, but an unrelated documentation step could still finish. A compensation hook per step, such as rolling back a provisional PLM release, handles partial completion. Without it, a failure halfway through leaves the part in an inconsistent state.
Trade-offs and follow-ups
Recursive descent is enough for a DSL this size and is easy to extend. A parser generator such as ANTLR pays off when the grammar grows past a few dozen rules or when error recovery matters, and it costs a generated parser that is harder to debug. I would not add loops or arbitrary expressions to the first version. A while in a workflow DSL creates non-termination risk and makes static validation much harder. If branching is needed, add when with a named predicate evaluated by the host application, so the DSL stays declarative.
Two failure modes interviewers probe: first, a step that succeeds but writes no output, so a downstream step reads stale data. I would require each task handler to return a typed result or raise, and the interpreter stores it in a context map keyed by step name. Second, duplicate step names. The parser above rejects a second definition at parse time, because silently overwriting Approve would make the executed workflow differ from the file the reviewer read.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-24Tell me about a time you had to influence a team or stakeholder to adopt a new technology or approach for a project?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
On a 3DEXPERIENCE customisation project, I persuaded a 12-person team to move from SVN with a manual nightly build to Git with GitLab CI and short-lived feature branches. I did not pitch it as a tooling preference. I framed it as a delivery risk: our build took 42 minutes, integration bugs surfaced on average 6 days after the code was written, and a release candidate took a full day to assemble. The lead architect opposed the move because Dassault customers audit traceability, and QA opposed it because faster merges could mean weaker testing. I ran a 3-week pilot on one service, published the numbers, and let the team keep a rollback path. We cut build time to 9 minutes, and the pilot service shipped two releases without a rollback.
Situation and task
I was a backend engineer on a team maintaining Java services that integrate CATIA V5 data into ENOVIA. The codebase was 8 years old, built with Maven, and merged to a single trunk branch. Developers worked on branches for 2 to 4 weeks because a long-lived branch was the only way to keep a feature out of a release. That created merge conflicts that took a day or more to resolve, and the nightly build was the first time most code compiled together.
My task was not to own the migration. It was to get agreement to try it, because I had no authority over the architect or the QA lead.
What I did first: listen and quantify
I spent a week shadowing developers and recording the pain in their terms. I pulled the last 20 builds from Jenkins and the last 30 merge conflicts from SVN logs. The pattern was clear: 14 of 20 builds failed on integration, median time from commit to a tested build was 19 hours, and conflicts clustered in generated configuration files that everyone edited.
I then mapped each stakeholder's objection to evidence I could produce, rather than arguing in general terms.
| Stakeholder | Objection | Evidence I produced | Mitigation offered |
|---|---|---|---|
| Lead architect | Git loses audit traceability required for regulated customers | Traceability matrix mapping commit SHA to change request ID | Signed tags per release, protected main, no force push, export to the existing PLM record |
| QA lead | Faster merges will let untested code reach UAT | Defect escape rate for the pilot service over 3 weeks | CI gate: unit tests plus contract tests must pass before merge |
| Product owner | Migration will miss the release date | Pilot scoped to one service, 3 weeks, with SVN still available | Rollback: mirror back to SVN nightly during the pilot |
The pilot
I asked for one service, the order synchronisation service, which had the most churn and the fewest external dependencies. I built the pipeline myself over a weekend so the team did not carry the setup cost.
# .gitlab-ci.yml, checked against GitLab CI 16.x
stages: [build, test, package]
build:
stage: build
script: mvn -B -DskipTests package
test:
stage: test
script: mvn -B verify
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
package:
stage: package
script: mvn -B -DskipTests packageFeature flags handled the other concern. Instead of a branch living for a month, a developer merged small changes to main behind a flag and enabled the flag per customer. That gave the architect a single integration line and gave QA a tested build on every merge.
Result, with numbers
After 3 weeks the pilot service showed a build time of 9 minutes instead of 42, a median commit to tested build of 22 minutes instead of 19 hours, and zero merge conflicts lasting more than 2 hours. Defect escapes to UAT stayed at 1 in the pilot period, compared with 2 in the previous period for the same service, which addressed the QA lead's concern with data rather than reassurance.
The architect reviewed the traceability export and approved the approach for the remaining services once I added signed release tags. We migrated the other services over the next 6 weeks, one at a time, and retired the nightly SVN build. The release candidate assembly dropped from a day to about 3 hours because artifacts were already built and tagged.
What I would do differently
I started the pilot too late. I had spent 2 weeks building a comparison document before I had any data from our own codebase. The pilot data changed minds in one review meeting. If I repeated this, I would ask for the pilot in the first conversation and bring the comparison document only after the first week of numbers.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-25Describe a time you encountered a significant technical challenge while working on a complex software project related to performance, scalability, or data integrity in a SaaS context?
Reported in Dassault Systèmes Software Engineer Interview Questions
The 90-second answer
On a multi-tenant SaaS service for CAD model metadata, retrieval of a specific revision degraded under load. P99 for GET /models/{id}/revisions/{rev} went from 120 ms to 1.8 s at about 400 concurrent users, and we saw occasional duplicate revision rows after retries. I traced it to two causes: an N+1 query over the revision graph, and a non-atomic insert that let a retried request create a second head revision. The fix was a keyset-paginated, indexed query for the revision chain, plus an idempotency key and a partial unique index on (model_id, parent_rev) so the database, not the application, enforced one head.
Context, so the numbers make sense: hypothetical production shape at the time, 2.1 million models, 18 million revisions, Postgres 15, object storage for geometry blobs, tenants isolated by tenant_id on every row. The endpoint had to return the exact revision a user opened, because downstream viewers cached by revision hash. Returning the wrong head was a data integrity bug, not just a slow one.
How I found it
I started with the p99 trace, not the code. In the trace table below, the pattern was obvious once I grouped by query count per request.
| Request | Queries | Rows scanned | P99 contribution |
|---|---|---|---|
GET /models/42/revisions/7 before fix | 47 | 18,400 | 1.8 s |
| Same, after fix | 2 | 51 | 95 ms |
POST /models/42/revisions retry | 2 inserts | 2 | duplicate head |
The old code walked parents one by one:
// Before: one query per ancestor, no tenant predicate on the walk
Revision r = repo.findByModelIdAndRev(modelId, rev);
while (r.getParentRev() != null) {
r = repo.findByModelIdAndRev(modelId, r.getParentRev());
chain.add(r);
}Each step was a round trip, and under connection pool saturation at 20 connections those round trips queued. That explains the cliff: latency was flat until concurrency rose, then it multiplied by chain length.
The fix
// After: single recursive query, tenant-scoped, keyset paginated
@Query(value = """
WITH RECURSIVE chain AS (
SELECT * FROM revisions
WHERE model_id = :modelId AND rev = :rev AND tenant_id = :tenantId
UNION ALL
SELECT r.* FROM revisions r
JOIN chain c ON r.rev = c.parent_rev
WHERE r.model_id = :modelId AND r.tenant_id = :tenantId
)
SELECT * FROM chain ORDER BY rev DESC LIMIT :limit
""", nativeQuery = true)
List<Revision> loadChain(@Param("modelId") Long modelId,
@Param("rev") Integer rev,
@Param("tenantId") Long tenantId,
@Param("limit") int limit);Supporting index, checked with EXPLAIN ANALYZE before and after:
CREATE INDEX CONCURRENTLY idx_revisions_model_rev
ON revisions (tenant_id, model_id, rev);
CREATE UNIQUE INDEX uq_revisions_head
ON revisions (tenant_id, model_id, parent_rev)
WHERE parent_rev IS NOT NULL;For the duplicate head, the create endpoint now requires Idempotency-Key. The server stores key -> revision_id in the same transaction as the insert. A retry returns the stored revision instead of inserting again. If two different keys race on the same parent, the unique index rejects the second one with a constraint violation, which the API maps to 409 revision_conflict and the client reloads the head.
What I would not do again, and what I checked
Caching the chain in Redis looked tempting, but invalidation was the hard part. A new revision changes the head, and tenants share the cache key space, so a stale entry would serve the wrong geometry hash. I skipped the cache and took the index plus the single query. P99 dropped to 95 ms in load test at 800 concurrent users, and the duplicate head count went to zero over the next release because the index made it impossible, not just unlikely.
I also added a guardrail I should have had first: a per-request query count metric and an alert when a single endpoint exceeds 5 queries per request in production. That would have caught the N+1 before customers did.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Curated: · Written: · Reviewed: