In the previous chapter, Tool Configuration Interface, we established the "ID Badge" contract. We learned that every tool must export a specific object so the system can recognize it.
Now, we need to fill in the most important line on that badge: The Name.
Imagine a busy parking lot managed by a computer system. There are hundreds of cars: some are red, some are blue, some are fast, and some are slow.
If the parking system wants to charge a specific car for parking, it can't just say, "Charge the red car." There might be fifty red cars! It needs a specific, unique way to identify exactly one vehicle.
In software, we have the same problem. Your application might load 20 different debugging tools. When the application wants to say, "The user just clicked a button, please tell the Stub tool to log this," it needs a unique handle to find that specific tool.
To solve this, we use Component Identity.
Think of the name property in our code as a License Plate.
Traffic cameras don't care how the engine works; they just read the plate. Similarly, our System doesn't need to know how our tool works; it just reads the name to track it.
To give our tool an identity, we assign a string (text) to the name property of our configuration object.
Goal: The system wants to register our tool so it can send logs to it later.
Input: The system reads our file.
Action: The system extracts the name property.
Output: The system saves our tool into a list under the label 'stub'.
We are building a "Stub" tool (a placeholder). So, we will give it the identity 'stub'.
// index.js
export default {
name: 'stub', // <--- This is the Identity
isEnabled: () => false,
isHidden: true
};
Explanation:
'stub'.'stub', the system would likely reject it (just like two cars can't have the same license plate).
Strings are easy for computers to compare. if (tool.name === 'stub') is a very fast and reliable check.
What happens inside the system when it reads this name? Let's look at the registration process.
The system acts like a parking garage attendant writing down license plates in a ledger.
Let's look at the file index.js again. While the other properties define behavior, name defines existence.
--- File: index.js ---
export default {
// The unique identifier for this module
name: 'stub',
// Other configuration details
isEnabled: () => false,
isHidden: true,
};
Even though the code is simple, the implications are important:
getTool('stub') to find this specific code.'stub', not the complex file path or the function logic.Notice the other properties sitting next to our name?
isEnabled: Now that the system knows who the tool is (Name), it needs to ask if it is working. We cover this in Runtime Availability Logic.isHidden: The system knows the tool's name, but does the user need to see it? We cover this in Visibility Management.In this chapter, we learned:
name: 'stub'.Now that our tool has an ID badge and a name printed on it, the system needs to know if the employee is actually at their desk working or on vacation.
Next Chapter: Runtime Availability Logic
Generated by Code IQ