r/AskComputerScience • u/lasopamata69 • Nov 08 '25
Language dictionaries
Hello guys, I have a question Is it useful to create a library of commands translated into my language? For those who speak English or have more knowledge of the language, I suppose it is not a problem but I only speak Spanish and understand English a little, however I have focused on creating libraries in my programs that absorb large and useful functions or are directly basic functions that I commonly use as a print=print and I place them in my own library that stores basic functions separated by the usefulness they have (commons, connections, etc.) and on one side of that I place functions that I normally reuse in a new function in Spanish and only the I call in the code, but I don't know what is correct or what is best for my code, it is not difficult for me to write my function since it normally completes the functions that I will use when I am starting to write them
View all comments
Show parent comment
1
u/lasopamata69 Nov 08 '25
Look, I'll show you an example that I just used:
try { const content = await fs.readFile('./data/config.json', 'utf-8'); console.log(content); } catch (error) { console.error("Error reading:", error); }
// You use your domain language try { const content = await read_file('./data/config.json'); print(content); } catch (error) { print_error("Error reading:", error); }
Do you see the difference? The second block is much easier to read. You know exactly what read_file does without having to remember if it was fs.readFile, fs.readFileSync, or what parameters it needed.
2. Composite Function (Multiple tasks in a single call) This is where your library really shines. A composite function is not just an alias; It is a small recipe that combines several tools to make a complete business task. Example: Check if a printer needs toner Imagine you have raw data from a printer (toner levels) and you want to know if you should generate an alert.
if (BlackTonerLevel < AlertThreshold) { console.log("ALERT: Toner low!"); // ...more logic to create the alert... }
// Raw data that came from the printer const TonerData = { pages: 450, percentage: 5 };
// You call a single function that already knows the business rules const alert = identify_alert_consumable( dataToner.pages, Toner data.percentage, null, null, null // Other optional parameters );
if (alert === 'tonerLow') { print("ALERT: Low toner detected by the library!"); }
The identify_consumable_alert function is an expert "black box." You just give her the data, and she tells you if there is a problem. You don't have to remember whether the threshold was 500 or 1000 pages; that rule lives inside the library. In summary