After reading this article you will know:
- What dependencies are
- What the purpose of dependencies are
- The consequences of deleting dependent items
Connecting all the dots
Building an application is always a matter of combining different functionalities and integrating logic with other parts of your application. To have everything working together, you'll need some sort of connection. We call those connections Dependencies. For example, you created an action in which an Order record is created. The model Order is now connected to the action. Congratulations, you got yourself a dependency!
Okay, to be fair, that wasn't that big of an achievement, but it is pretty important.
Whenever you include a part of your application in another part, those dependencies are automatically created by the platform. You do not have to worry about them, they will not be in the way.
"Okay, but why would I want to look into my dependencies?", I hear you say...
Because they come in super handy for keeping track of what you built in your app!
Let's go back to that Order record we just created, that was just one dependency. You'll most likely use that same variable later in a different event, when sending an email for example. You'll probably also want to create a view where all orders can be found. The amount of dependencies will increase pretty fast. Before long, you'll have a ton of dependencies.
Where to find them
Now go to said Order model, click Edit and go all the way down. You'll see a fieldset looking something like this:
This means there are 199 dependent items that are connected with the Order model we are currently viewing. Click on the blue text and an overview will fold open.
This overview has 3 colums;
Name: This column described the exact part which is related to the action. If a dependency points towards a component which can be viewed on its own, click the name to open the component in a new browser window.
Kind: Shows what kind of dependency we're dealing with.
Action when destroyed: Shows the consequences of deleting the current component.
With this overview you can see exactly where and how the current component is being used. In all parts of the platform, dependencies play a big role. For each model, property, action, custom model, webservice, etc. you can find these dependency overviews. Some dependencies are more important than others and removing them can have huge consequences!
Possible consequences when destroyed
For example, destroying a model will also destroy all its properties and the components used for displaying their values in the Backoffice. Those kind of dependencies weigh quite heavy. In other cases, where a property is part of an expression, the property is commented out so it's not included in the expression anymore, but not completely gone either. Below is an overview of all possible consequences of destroying a dependency.
- Adjust deduplicate options
- Adjust log mutation options
- Adjust permissions
- Disable callback action
- Outcomment var from variable
- Remove action from skip action
- Remove default order
- Remove default selected filter
- Remove default value
- Remove label property
- Remove order property
- Remove property from definition
- Remove resource from event
So know you know what dependencies are and what their purpose is. You can use them as a sort of checklist for maintenance or when refactoring your app. When you've built a new module in your app and a model has become superfluous, you don't want to 'just' to delete is. By checking all dependencies and making sure they do not break anything when removed, you can avoid unpleasant situations.
If you're not sure about a dependency what the impact is when destroyed, click on it and a new browser window will open. Try to remove the component that's responsible for the component. This will drive down the amount of dependencies and minimize the risk.
The higher the amount of dependencies on a component, the longer it takes to remove the component. Before the component is removed from the application, the platform will first deal with the dependencies. This may cause a slight delay before the component is actually gone.
That's about everything you need to know about dependencies! If you have further questions about dependencies, let us know through the chat or rate this article below!