Clearing the Clutter: Tackling Unused Dependencies in OutSystems


While migrating one of our UI components, I discovered a dependency on an outdated version within one of our modules. This realization highlighted an important aspect of software development: unused dependencies, or "dead code."
Why Handling Unused Dependencies Matter
Dead code refers to sections that are no longer executed or used. These remnants can stem from outdated features, experimental code, or debugging utilities. Over time, they bloat software, reduce efficiency, complicate maintenance, and increase the size of OutSystems modules—ultimately prolonging 1-Click Publish durations.
A Common Oversight
Often, developers leave behind temporary or "just-in-case" code, believing it may be useful later. In reality, these assumptions create unnecessary complexities, violating the YAGNI principle ("You Aren’t Gonna Need It"):
Key takeaway:
Only include what’s needed now, not what might be needed in the future.
Best Practices for Dependencies Avoid:
Avoid : Large, bloated dependencies.
Prefer : Smaller, specific modules with only the elements you actually use.
This aligns with the Interface Segregation Principle, where code depends only on relevant, smaller interfaces rather than massive, unwieldy packages.
Removing Unused Dependencies in OutSystems
OutSystems offers two key tools to address unused dependencies:
AI Mentor
Detects unused aggregates, SQL queries, and module actions. However, it doesn’t detect referenced elements without usage, so manual checks may still be required.
Service Studio’s "Remove Unused Dependencies" Feature
Automatically identifies and removes unused dependencies from your module.
Steps to Remove Unused Dependencies
Open Service Studio and navigate to each application layer (Interface, Logic, Data, Process).
Right-click the module name.
Select Remove Unused Dependencies.
Repeat for all layers.
By following these practices, you can simplify your modules, improve performance, and ensure clean, maintainable code. Don’t let unused dependencies weigh your application down!
Subscribe to my newsletter
Read articles from Tegar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Tegar
Tegar
Web Creator.