You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/best-practices/dev-best-practices/app-setup.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,35 +7,35 @@ no_list: false
7
7
description_list: true
8
8
---
9
9
10
-
###Introduction
10
+
## Introduction
11
11
12
12
There are a few key things to consider when setting up your app. The subsections below will flag these considerations for your attention, as well as provide you with some examples and best practices to steer your app in the right direction.
13
13
14
-
###App Development Language
14
+
## App Development Language
15
15
16
16
You first decision will be choosing your application development language. The language that will be used to develop the app should be determined upfront. This way you have one language for modules, entities, microflows, pages, and any other elements. The typically preferred language for development is English.
17
17
18
18
There are some reasons, however, why certain parts of an application may use another language. The main reason to make an exception would be within the domain model of an integration module. For example, when the source data model is in another language already.
19
19
20
20
For more information, see [Translating Your App Content](/refguide/translate-your-app-content/).
21
21
22
-
###App Name
22
+
## App Name
23
23
24
24
Every app is named when created. Make sure you use a logical name that allows you to easily identify the application. You will probably create more apps in the future, and will want to be able to recognize this app.
25
25
26
26
We recommend omitting dates and Mendix version numbers from app names, since that information can be captured and extracted in a different way.
27
27
28
-
###Configurations
28
+
## Configurations
29
29
30
30
Every app has at least one configuration, but it may have many. Every app starts with a single configuration called **default**. When you work with multiple people on an application it is beneficial to create multiple configurations. When doing so, Mendix recommends using relevant names for those configurations, like the name of the developer or the app's purpose, like **Test** or **Acceptance**. Beware that the database passwords defined in the configuration will be visible to other team members, so be careful with using personal passwords you'd like to keep secret.
31
31
32
-
###User Roles
32
+
## User Roles
33
33
34
34
The [user roles](/refguide/user-roles/) should have logical names that reflect the different types of users that will use the application. The user roles are singular and use an UpperCamelCase notation, like **FunctionalAdministrator**. User roles are mostly defined in English, but there is an option to name these in a different language, since the user role is visible in the front end.
35
35
36
36
Each user role should correspond to only one module role per module. In other words, a user role should not map to multiple module roles within the same module. This helps to keep the number of applicable module roles for a user to a minimum, which reduces complexity in understanding the security model and reduces the performance impact of complex security rules.
37
37
38
-
###Passwords and Other Secrets
38
+
## Passwords and Other Secrets
39
39
40
40
Always store secret information in a safe place. A safe place is the database. Use the [Encryption](https://marketplace.mendix.com/link/component/1011) module to encrypt, store, retrieve, and decrypt the information.
Copy file name to clipboardExpand all lines: content/en/docs/refguide/modeling/best-practices/dev-best-practices/general-guidelines.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,11 @@ no_list: false
7
7
description_list: true
8
8
---
9
9
10
-
## General Guidelines and Best Practices
10
+
## Introduction
11
11
12
-
### Application
12
+
This document provides general miscellaneous best practices for setting up microflows, warnings, and other commonly used elements in Mendix apps. If you know the basics of Mendix, try implementing these bits of advice to raise your app to the next level.
13
13
14
-
#### Project Size
14
+
##App Size
15
15
16
16
Mendix apps are best built in a way that they are easily scalable through a microservice architecture. They are ideally designed for a single purpose, focusing each app on a distinct business domain to keep functionality clear and manageable.
17
17
@@ -24,61 +24,61 @@ To ensure maintainability and performance, it is recommended to keep your app wi
24
24
25
25
Staying within these limits helps maintain optimal performance in Studio Pro, while ensuring your app remains manageable and scalable over time. If your app exceeds these limits, consider breaking your app into smaller services to improve maintainability and performance.
26
26
27
-
Applications exceeding these guidelines may still function, depending on your system. However, Mendix cannot provide support for performance issues in oversized projects.
27
+
Applications exceeding these guidelines may still function, depending on your system. However, Mendix cannot provide support for performance issues in oversized apps.
28
28
29
29
{{% alert color="info" %}}
30
-
Project size impacts IDE performance. Choose a development strategy that aligns with your system's capabilities and Mendix's recommended guidelines.
30
+
App size impacts IDE performance. Choose a development strategy that aligns with your system's capabilities and Mendix's recommended guidelines.
31
31
{{% /alert %}}
32
32
33
-
###Model SDK
33
+
## Model SDK
34
34
35
35
The Mendix Model SDK enforces a strict limit of 20,000 units per working copy.
36
36
37
37
A unit represents a single document or element found in the app explorer. This limit helps ensure stable performance and efficient resource handling when working with large Mendix applications and models through the SDK. When building solutions or automation using the Model SDK, ensure that working copies do not exceed the 20,000-unit threshold to avoid errors or incomplete processing.
38
38
39
-
###Domain Models
39
+
## Domain Models
40
40
41
-
####Attributes {#attributes}
41
+
### Attributes {#attributes}
42
42
43
43
Using calculated (virtual) attributes is discouraged. These introduce a performance risk since they need to be calculated every time the object is used, regardless of whether the attribute itself is used.
44
44
45
-
####Inheritance {#inheritance}
45
+
### Inheritance {#inheritance}
46
46
47
47
When using inheritance (specialization/generalization), it is recommended to use no more than two levels for performance reasons.
48
48
49
-
####Delete Behavior
49
+
### Delete Behavior
50
50
51
51
[Delete behavior](/refguide/configuring-a-domain-model/#delete-behavior) must be specified where possible. Delete behavior must, however, never be relied upon when deleting large amounts of data. For performance reasons it is better to explicitly delete dependent objects when doing batch deletes.
52
52
53
-
####Event Handlers
53
+
### Event Handlers
54
54
55
55
[Event handlers](/refguide/event-handlers/) on domain entities must be used with a lot of caution. They can quickly result in complex and possibly unexpected behavior when several of them are applied to a single entity. It is often best to make the execution of microflows more explicit by using sub-microflows that are called manually, for example, just before committing an object.
56
56
57
-
###Microflows {#microflow-dev-best-practices}
57
+
## Microflows {#microflow-dev-best-practices}
58
58
59
-
####Size {#size}
59
+
### Size {#size}
60
60
61
61
The size of a microflow should not exceed 25 elements. An element is any block that Studio Pro allows in a microflow (loops, action activities, decisions, etc.). In some cases exceeding this limit is acceptable; this can occur, for instance, for validation or data copying flows.
62
62
63
63
Split microflows up into logical, functional elements. If a microflow has more than twenty-five elements, split the microflow up by creating a sub-microflow for a part of it. For example, by separating presentation logic from business logic.
64
64
65
65
Certain cases (such as validation checks) may require this rule to be ignored to produce an understandable result.
66
66
67
-
####Documentation and Annotations {#documentation-and-annotations}
67
+
### Documentation and Annotations {#documentation-and-annotations}
68
68
69
69
All complex microflows (more than ten activities or more than two decisions) should have an [annotation](/refguide/annotations/) describing the purpose of the microflow, expected parameters, and return values. This annotation should be placed at the start, so it is visible when the microflow is opened. This will assist other developers in quickly understanding the general purpose of a microflow, without having to read through it entirely.
70
70
71
71
Complex, non-standard or integration-related sections in microflows should also have an accompanying annotation. Examples of these are web service calls, custom loops, and Java calls.
72
72
73
-
####Readability
73
+
### Readability
74
74
75
75
The normal flow in a microflow should be aligned from left to right to ensure readability. Exceptions to the normal flow may branch out vertically: downwards is preferred, upwards if the downwards direction is already used.
76
76
77
77
Avoid crossing of lines of the links between the microflow elements.
78
78
79
79
If you decide to color code the different activities in your app, be sure to align within your team on their meaning.
80
80
81
-
####Complexity
81
+
### Complexity
82
82
83
83
Nested `if` statements in a single microflow expression are not recommended. If multiple checks depend on one another, this should be represented by multiple decisions in the microflow, so that the complexity is not hidden away in the expressions. You can use `and` and `or` operators to produce complex expressions if necessary.
84
84
@@ -94,21 +94,21 @@ Event triggers on input fields must be kept as simple as possible, since they ar
94
94
95
95
The number of parameters for a microflow should be kept to a minimum to facilitate reusability. The more parameters a microflow has, the more difficult it is to determine what should be put into the parameters to make the microflow run correctly.
96
96
97
-
####Error Handling and Logging
97
+
### Error Handling and Logging
98
98
99
99
Use microflow [error handling](/refguide/error-handling-in-microflows/) for all integration and Java calls. Make sure to determine the correct rollback behavior. Always log the error that occurred, even if the process can continue, this is essential for later analysis of the error.
100
100
101
101
Complex processes and important business logic (like workflow processing or validations) must include debug and trace [logging](/refguide/logging/). Logging actions must write the current state and progress of the process and must include a request ID or other identifying information. The log node should be the name of the module. This will greatly assist error analysis.
102
102
103
-
####Validating Inputs in Microflows
103
+
### Validating Inputs in Microflows
104
104
105
105
When microflows are invoked from the client side, it is important to validate the inputs. By having validations, you prevent incorrect, inappropriate, or potentially harmful data from being used in your microflows. This protects your application against security vulnerabilities. The following presents the best practices regarding the integrity and validation of inputs in your microflows.
106
106
107
-
#####Implementing Validation Checks
107
+
#### Implementing Validation Checks
108
108
109
109
Adding validation checks is vital for ensuring that input data conforms to the expected data type, format, range, or other application-specific constraints. For instance, if a numeric input is expected within a defined range, validation checks should confirm that the input is indeed numeric and falls within the specified range.
110
110
111
-
#####Managing Unexpected Values
111
+
#### Managing Unexpected Values
112
112
113
113
When building microflows, it is important to account for the potential occurrence of unexpected values. These could be empty values, or values outside the expected range or format. It is also important to ensure that read-only attributes only contain expected values.
114
114
@@ -120,39 +120,39 @@ We also recommend avoiding storing intermediary values in attributes (such as, *
120
120
121
121
Microflows should incorporate mechanisms to detect unexpected values and respond suitably – this might involve returning an error message to the end-user or executing a fallback operation.
122
122
123
-
#####Updating Validation Logic Regularly
123
+
#### Updating Validation Logic Regularly
124
124
125
125
As the application evolves, the validation logic within microflows should be updated accordingly to reflect changes in business logic or data models. This regular review and update of validation checks ensures that microflows remain secure and function correctly over time.
126
126
127
127
By prioritizing the validation of inputs in microflows, you not only enhance the security of your application, but also ensure a more predictable and stable user experience. This practice underscores the development of reliable and robust applications.
128
128
129
-
###Warnings
129
+
## Warnings
130
130
131
131
No warnings should be visible in Studio Pro, unless explicitly documented with a reason. Warnings can indicate many issues, including maintainability and security risks, which must be resolved.
132
132
133
-
###Excluded and Unused Documents
133
+
## Excluded and Unused Documents
134
134
135
135
Excluded documents are documents that are in a project but excluded from deployment. These documents can be kept in your app for reference, but Studio Pro will act as if they do not exist.
136
136
137
137
Unused documents are documents that are still being considered while being deployed that can be used if you want to replace a document with another document.
138
138
139
139
Unused and excluded documents should be removed from the model when they are no longer needed. When a version of the application is prepared for a release, all these items should be cleaned up. Make sure to check whether items that appear unused are not actually called from a Java action before removing them. Studio Pro provides the possibility to mark such items as used to override warnings about this.
140
140
141
-
###XPath
141
+
## XPath
142
142
143
143
[XPath](/refguide/xpath/) constraints in any part of the model should be kept as simple as possible. As a general rule, XPaths must not appear when the **Find advanced > XPath** option in Studio Pro is used with all options enabled.
144
144
145
-
###Security
145
+
## Security
146
146
147
147
The [security](/howto/security/) overview in Studio Pro must not show any incomplete (yellow) parts. All entity, microflow, and page access must be configured completely.
148
148
149
149
Assigning default rights to new members when defining entity access is NOT recommended. This will ensure that access is only granted after a conscious decision.
150
150
151
-
###Mendix Version
151
+
## Mendix Version
152
152
153
153
Apps should keep up with new Mendix releases as much as possible.
154
154
155
-
###Marketplace Content
155
+
## Marketplace Content
156
156
157
157
When introducing a new [Mendix Marketplace](https://marketplace.mendix.com/) component to an app, carefully consider the support level of the component. Using components that are community supported introduces a maintainability and upgrade risk.
0 commit comments