CodeBlanks Logo Icon CodeBlanks

Putting it together

Combine all expert topics into a working mini app.

Putting it together: integration report

In the final lesson we combine all four layers into one report. The integrationReport function calls setupProject, nativeAddon, distributedLayer and performanceLayer, joining their results with ' | '.

The report's returned last line is ExpertProject | N-API | OpenTelemetry | --turbofan. This summarizes the whole expert final in one string. The starting code carries all four previous solutions, so the previous lessons' outputs also appear above the new line. You only add the integrationReport function. With cumulative growth, every piece is in place. This lesson is the meeting point of the native addon, distributed tracing and performance engineering groups.

Calling every layer

The integrationReport function takes each layer's identifier field and joins them with ' | '. setupProject().name, nativeAddon().api, distributedLayer().tracing and performanceLayer().flag are the four pieces.

This pattern shows why each layer's object shape had to be consistent. Because every layer returns with an identifier field, the report combines into one chain. Output: ExpertProject | N-API | OpenTelemetry | --turbofan. This summarizes the project's four lessons in one line. In a real expert project this report could be a log line, a health endpoint or a monitoring dashboard. Here the model shows the logic clearly.

Practice Write the integration report

Take all four previous solutions. Add function integrationReport(). Return setupProject().name + ' | ' + nativeAddon().api + ' | ' + distributedLayer().tracing + ' | ' + performanceLayer().flag. Print console.log(integrationReport()).

Starter code

index.js
function setupProject() {
  return { name: 'ExpertProject', version: '1.0' };
}
console.log(setupProject().name);
console.log(setupProject().version);
function nativeAddon() {
  return { api: 'N-API', status: 'hazır' };
}
console.log(nativeAddon().api + ': ' + nativeAddon().status);
function distributedLayer() {
  return { tracing: 'OpenTelemetry', status: 'hazır' };
}
console.log(distributedLayer().tracing + ': ' + distributedLayer().status);
function performanceLayer() {
  return { flag: '--turbofan', status: 'hazır' };
}
console.log(performanceLayer().flag + ': ' + performanceLayer().status);
// Write the integrationReport function
// Join four layer strings with ' | ' and return
// Call and print
// write here

Sample solution

index.js
function setupProject() {
  return { name: 'ExpertProject', version: '1.0' };
}
console.log(setupProject().name);
console.log(setupProject().version);
function nativeAddon() {
  return { api: 'N-API', status: 'hazır' };
}
console.log(nativeAddon().api + ': ' + nativeAddon().status);
function distributedLayer() {
  return { tracing: 'OpenTelemetry', status: 'hazır' };
}
console.log(distributedLayer().tracing + ': ' + distributedLayer().status);
function performanceLayer() {
  return { flag: '--turbofan', status: 'hazır' };
}
console.log(performanceLayer().flag + ': ' + performanceLayer().status);
function integrationReport() {
  return setupProject().name + ' | ' + nativeAddon().api + ' | ' + distributedLayer().tracing + ' | ' + performanceLayer().flag;
}
console.log(integrationReport());

Expected output

ExpertProject
1.0
N-API: hazır
OpenTelemetry: hazır
--turbofan: hazır
ExpertProject | N-API | OpenTelemetry | --turbofan

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does integrationReport do?

  • Only calls setupProject
  • Only calls nativeAddon
  • Returns nothing
  • Joins the four layers into one string Correct answer

Explanation: integrationReport combines four layers into one string.

2 Match each piece to its role

Term Meaning
setupProject Skeleton
nativeAddon N-API layer
distributedLayer Tracing layer
performanceLayer Flag layer

3 Complete the join separator

Question
return setupProject().name + '____' + nativeAddon().api + ' | ' + distributedLayer().tracing + ' | ' + performanceLayer().flag;
Answer
return setupProject().name + ' | ' + nativeAddon().api + ' | ' + distributedLayer().tracing + ' | ' + performanceLayer().flag;

Explanation: Layers are joined with ' | '.

All lessons in Expert