Difference between revisions of "HowTo:Design a Customizing"
Line 11: | Line 11: | ||
= Architecture = | = Architecture = | ||
The architecture is something to consider on a rather abstract level, in the beginning of a project, but also on the level of a single task. | The architecture is something to consider on a rather abstract level, in the beginning of a project, but also on the level of a single task. | ||
− | In the context of a whole project, architecture means defining whether there are multiple {{UBIK}} installations on different sites, what products will be involved and how they are connected topologically. | + | In the context of a whole project, architecture means defining whether there are multiple {{UBIK}} installations on different sites, what products will be involved and how they are connected topologically and semantically. |
On task level, architecture means defining which modules are taking care of what responsibility, and how they play together. | On task level, architecture means defining which modules are taking care of what responsibility, and how they play together. | ||
Line 22: | Line 22: | ||
* Custom code should be arranged so heavy-duty processes (involving much data and complex calculations) are performed on powerful machines (and not on the mobile client). | * Custom code should be arranged so heavy-duty processes (involving much data and complex calculations) are performed on powerful machines (and not on the mobile client). | ||
* Actually, all of the effort should be done on the server if possible, with the client just using out-of-the-box features. This won't be feasible in all cases, though. | * Actually, all of the effort should be done on the server if possible, with the client just using out-of-the-box features. This won't be feasible in all cases, though. | ||
− | |||
− | |||
− | |||
= Data Model = | = Data Model = | ||
Line 58: | Line 55: | ||
= Algorithm = | = Algorithm = | ||
− | + | Most {{UBIK}} projects have custom code performing more or less complex data processing tasks. | |
− | Most {{UBIK}} | + | |
The algorithm resulting from custom code can be highly distributed because of the way the life cycle of {{UBIK}} objects can be customized. | The algorithm resulting from custom code can be highly distributed because of the way the life cycle of {{UBIK}} objects can be customized. | ||
But it can also be a single interface with a third party system that has to crawl through a lot of data and perform many operations on them. | But it can also be a single interface with a third party system that has to crawl through a lot of data and perform many operations on them. | ||
Line 71: | Line 67: | ||
* Scale well with respect to more input | * Scale well with respect to more input | ||
− | There are also some quick hints we can drop for you to avoid many problems: | + | There are also some quick hints we can drop for you to avoid many problems. |
+ | |||
+ | Custom code for MetaClasses: | ||
* Don't use the "OnSaved" event if you want to modify any object as a result of another object being saved. Use "OnPrepareForSave" instead, to avoid complex saving recursions. | * Don't use the "OnSaved" event if you want to modify any object as a result of another object being saved. Use "OnPrepareForSave" instead, to avoid complex saving recursions. | ||
* Use a custom plugin to create a nice architecture for your code, using the life cycle events only to call it. | * Use a custom plugin to create a nice architecture for your code, using the life cycle events only to call it. | ||
− | + | ||
+ | Parallelism: | ||
* Avoid multi-threading, but if you have to implement parallel tasks, use locking wisely to avoid dead-locks. | * Avoid multi-threading, but if you have to implement parallel tasks, use locking wisely to avoid dead-locks. | ||
+ | * Keep in mind that multiple users could work on the same objects, i.e., your customizing can be executed in parallel, on different processes. This means you have to make sure your code doesn't interfere with itself. Mostly this is relevant for updating and reading from the database, where one process can update a value while another one is assuming a different value. | ||
+ | |||
+ | Performance: | ||
+ | * Apply caching to reuse previously processed data and to avoid doing the same thing more than once, but clean up your cache if it becomes invalid. | ||
+ | Avoiding crashes: | ||
* Check every variable for being null before you use it. | * Check every variable for being null before you use it. | ||
+ | |||
+ | Well-formed code: | ||
+ | * Apply the principles of object-oriented programming (OOP) and the C# coding conventions. | ||
+ | * For every responsibility in the code, there should be a dedicated software module. An optimal distribution of responsibility will often make your code perform better and easier to understand and maintain. | ||
+ | * Give all variables, methods and classes really good and human readable names. Good naming and well-structured source code is better than any kind of comments. | ||
= {{UBIK}} Features = | = {{UBIK}} Features = |
Revision as of 11:55, 26 July 2023
Customizing UBIK® is a complex endeavor. In this article, we aim to provide a guide and best practices making this task as straight-forward as possible.