Platform Update: New Code Dependencies

In complex web application development scenarios, we often need more complex tools than simple boolean or procedural logic. Needs like the creation of auxiliary structures, or centralized calculation logic, are only a few examples where the need for project specific code dependencies exist.

Dependencies are an intrinsic part of web application development. From frameworks to libraries, and simpler development tools, virtually all web applications use dependencies to achieve their multiple purposes. This allows, among other things, for faster, scalable and more secure web applications.

With that in mind, we’re very glad to announce “Code Dependencies” as a new a feature of our OMNIA platform!

Code Dependencies

Until today, dependencies in our platform were exclusively File Dependencies (i.e DLLs). A solution that is very effective in some situations but can, in different scenarios, not be possible. Now, with the addition of our new “Code Dependencies” feature, a new range of development possibilities are available.

Code dependencies, simply put, allow for the addition of code that your behaviours can depend on. In our platform, this feature enables you to add C# code that will be compiled together with the application’s behaviours, and, because they don’t need to respect any contract, allows for the addition of, for example, entire classes:

using System;
using System.Collections.Concurrent;
	
using Interop.ErpBS900;
using Interop.StdBE900;

namespace ERP
{
    public sealed class ErpBSFactory
    {
        private static readonly ConcurrentDictionary<string, Lazy> _erpBSCache = new ConcurrentDictionary<string, Lazy>();

        private ErpBSFactory()
        {
        }

        public static ErpBSFactory Instance { get; } = new ErpBSFactory();

        public ErpBS GetErpBS(string company)
        {
            var resolver = _erpBSCache.GetOrAdd(company,
              new Lazy(() =>
              {
                  ErpBS bsERP = new ErpBS();
                  bsERP.AbreEmpresaTrabalho(EnumTipoPlataforma.tpEmpresarial, company, "Admin", "");

                  return bsERP;
              }));

            return resolver.Value;
        }
    }
}
 
Use Case Example:

Let’s say we want to build a web application that makes use of other external systems data, without the access to its servers, and therefore, no file dependencies. Our new feature deals with this potential limitation by allowing you to create internally compiled code dependencies that can be easily called from anywhere within your application, with one single line of code. 

Some common use cases for code dependencies:

  • custom class creation: create auxiliary processing structures to facilitate the deserialization from external API responses or to compose API request payloads;
  • design patterns: such as the Singleton Pattern, where is useful to have only one connection object to other system between requests or to create a memory cache system and keep values in memory between behaviour executions, for example: store in memory a list of settings to improve the performance preventing the behaviours from retrieving them again from the API;
  • exposing constant variable classes: centralize paths to folders or messages to give feedback to user actions;
  • etc.

For a more technical detailing of this new feature check our documentation page about it. We hope you’ll enjoy developing with this new feature, don’t forget to follow us on Twitter and LinkedIn, and subscribe to our newsletter so you don’t miss any future updates.