Wednesday 6 February 2019

Where should that code go (Back-end vs Front-end)


Introduction

 

In this post, we will be discussing the advantages and disadvantages of having code on the visualisation tool vs having the hard logic done by the source side or the back-end. The premise being, should all the complicated code such as creating complicated measures be moved to the back-end script or can these be written in the front-end. A simplified example would be if you have a long “if” statement, should this be moved to the back-end script and what is the performance contribution of having this in the front-end.

Front-end

 

For visualisation tools that act as a front-end, it is of the utmost importance that the tool runs smoothly, and performance is high. This is important because the visualisation tool is where the users interact with the data and thus, this needs to be streamed lined. The front-end should deliver data to the user as quickly as possible without lag because chances are, the tool will be used by all sorts of users who might be presenting as various platforms and therefore, it is imperative that this does not get delayed by performance hits.

Back-end

 

The back-end is generally where the data would sit. This could be in the form of databases or in the case of tools such as Qlikview, this would be in the form of QVD files. The front-end reads data from here and then is modelled into what would make the data more sensible. Once modelled, we can then make visuals from the data that would fulfil the business needs of the users. The back-end can be any storage format that makes sense for the tool to use. Storing data on the back-end has some advantages that will be listed below.

Advantages of Front-end

 

Below are the advantages of having complicated code in the frontend:

·        Back-end runs faster

·        Back-end becomes smaller


Disadvantages of Front-end

 

·        Complicated measure or calculated column could cause performance issues

·        Makes maintainability of code harder

·        Visualisation tools usually use the RAM to render visuals and keep queries in memory, therefore, a complicated measure/calculated column uses more memory


Advantages of Back-end

 

·        Is allowed to do the heavy lifting of complicated code

·        Depending on usage of data, is allowed to take time to refresh new data

·        Makes code maintainable

·        Acts as a custodian of data and allows for interchangeable visualisation tools


Disadvantages of Back-end

 

·        Depending on need, could slow down refreshing of data on live reporting

·        Adding extra columns could lead to over bloated tables which could affect performance when those tables are loaded into the visualisation tool

Conclusion

 

In the end, we would say that it depends on the situation that you are in. in many cases, it is not feasible to have the code in the back-end but in the front-end. But a general rule of thumb is to have code in the back-end so that the heavy lifting is done that side and visual tool does what it I supposed to do which is displaying data that can easily be sliced and diced for whatever purpose in a quick manner. Always keep in mind you audience.