Componentizing Applications
- Updated2024-05-31
- 2 minute(s) read
Componentizing Applications
Componentizing an application helps you organize code into logical groups, save time from creating duplicate code, and enhance software stability. Use Application and Library documents to create component-based applications, in which you compose loosely coupled code into modular and cohesive projects.
The following figure demonstrates how to convert a project with loosely coupled code into a component-based project.
When you build the application, each top-level VI is built into a separate HTML page with required support files.
Best Practices for Componentizing Applications
Consider the following guidelines when componentizing an application:
- Keep application components small and self-contained.
- Store code that you might reuse in a separate Library document.
- Create namespaces to organize files into logical groups.
- Avoid creating circular dependencies between libraries, which cause problems such as build failures.
- Analyze your application composition frequently for opportunities to refactor code. Refer to Code Dependency Guidelines when refactoring code.
Code Dependency Guidelines
A VI in an Application or Library document can call only VIs within the same component or in a dependency library.
Related Information
- Organizing Code to Avoid Name Collisions
A namespace is a container used to organize files into logical groups. Items in the same namespace must have a unique name. Namespaces help to prevent name collisions.