We refactored our example client, searsiaclient! Yay! Ok, this will be our nerdiest post in a while. In software design, code refactoring refers to restructuring the code without changing its external behaviour. So, what’s the big deal, if the clients behaviour is still the same? Previously, searsiaclient not only depended on external libraries, such as JQuery and Bootstrap, but those dependencies were used everywhere in the searsia.js Javascript file. Organisations that adopt Searsia therefore, had to include those external libraries in their websites as well, even though they may not further need them. For that reason, the comments in the file contained the terrible software swear “Spaghetti code“… Until today, that is.
With the release of searsiaclient version 1.2.0, we removed those dependencies completely from searsia.js, and we fixed the very first issue: We implemented the searsia.js library following the closure pattern, which provides a sort of encapsulation for the variables and functions inside the library. Long story short: You can savely include the searsia.js library in your website, and its contents will not clash or overwrite variables and functions that your site already uses (that may have the same names). Also, as stated above, the library no longer depends on JQuery and Bootstrap, so there is not need to include those.
The release still contains a full blown example client however, that uses JQuery and Bootstrap for its example implementation, but all the presentation stuff is moved to exampleclient.js. Hurray!