About a year back, me and a couple of my colleagues were invited by 99X Technology to present us their internship program. We spent half a day in the office, where they explained the internship program and what’s in store for interns at 99X Technology. After a very promising presentation, we were introduced the employees and we were taken on a tour around the office.

Back then, I didn’t have a clue about where to do my internship, but finally I decided that I should join 99X Technology. I started my internship on 14th May, 2012, and looking back, I realize that this was one of the best decisions that I have taken.

Internship at 99X Technology was not only about learning the corporate behavior and new technologies, but it was about engaging in various activities, having fun, and being a part of a nice family.

At my workstation

I worked in 3 main projects. I love software design and architecture, and I was involved in building reference architecture for large scale JavaScript web applications. This project, named BoilerplateJS is now released as an open source project. It now has a small community of developers and is used in a couple of products at 99X Technology. The next two projects were client projects (and I will not disclose too much information about them) where I was exposed to PHP, ASP .NET, HTML5 and JavaScript.

During the internship we organized two events, Inventors’ Challenge and Interns’ Summit. Both of these events were a huge success, and we received great complements from both 99X Technology and the participants.

The fun I had at 99X Technology cannot be forgotten. There were monthly sports committee events, different CSR projects, trips and numerous outings. At 99X Technology, there was always a reason to celebrate!

Interns 2012

I thank 99X Technology for providing a well-planned and an all rounded internship. It was simply the best internship ever!

During the past weeks I was involved in developing BoilerplateJS, a JavaScript reference architecture for large scale web applications. BoilerplateJS was developed based on RequireJS modules. I was involved in setting up unit testing for BoilerplateJS. One of our main requirements was to mock RequireJS module dependencies. After a lot of searching I came across testr.js. Testr.js can be used with almost any unit testing framework.

Assume that we have the following setup:


Index file contains the links to the scripts. Note that you have to import testr.js after importing RequireJS.

<script type="text/javascript" src="./libs/require.js" data-main="tests"></script><script type="text/javascript" src="./libs/testr.js"></script>

My dependency1.js file contains:

define([], function(){
	var dep = function(){
		this.getText = function(){
			return 'Original Dependancy';
	return dep;

It contains a getText() method which returns a string.
Lets assume that module1.js has used the above dependency as follows:

define(['dependencies/dependancy1'], function(Dependancy1){
	var module = function(){
		this.run = function(){
			var d1 = new Dependancy1();
	return module;

You can see that when the run method of Module1 is called, it calls the getText() method of the dependency. Therefore if you execute the run method of Module1, you should see ‘Original Dependancy’ on the console.
Our aim in this scenario is to replace dependancy1 with a mock object during run time.
Our tests.js file contains:

require(['module1'], function(){

	var fakeDep = function(){
		this.getText = function(){
			return 'Fake Dependancy';

	var Module1 = testr('module1', {

	var m1 = new Module1();

Here, we create a fakeDep object that has the same methods as the original dependency, and then passes it to testr function with the related file path. Now, instead of loading the original dependency, testr.js loads the module with the provided fake dependency. When you run the above index.html, you will see the fake dependency being executed and ‘Fake Dependancy’ being printed on the console.

I joined 99X Technology as an intern and as a technology enthusiast, looking for opportunities to learn new things and to make cutting edge solutions. Soon I was introduced to a new world of JavaScript where it is used not to do small website hacks and data validation, but to build full-fledged software products.

Our clients demand software solutions that are cross platform, and solutions that support all types of devices. Our realization is that web applications that are dynamic and responsive would be the ideal solution for such situations. And we believe that JavaScript has the potential to cater these situations. There are plenty of libraries that are out there to address many individual aspects of JavaScript application development. But what lacked were some kind of architecture and a set of design patterns to address common problems that JS developers are facing.

Inspired by some of the great presentations such as Nicholas Zakas’ “Scalable JavaScript Application Architecture” and with the experience of few large scale JavaScript projects at 99x, development for a reference architecture for single paged web applications with JavaScript was started. Me and two other interns at 99X, Himeshi and Asanka were lead by Hasith (a wonderful guy with a wealth of knowledge and experience), were involved in this project, which is now released as BoilerplateJS.

BoilerplateJS is a reference architecture intended to be used in large scale web applications. It combines a set of industry leading JavaScript libraries and a set of great design patterns. BoilerplateJS would be the starting code for your JavaScript project, where you can add in and remove parts according to your requirements.

Every decision and every line of code that ended up in BoilerplateJS were carefully reviewed and made in the best and the simplest possible manner. Careful thought went into making BoilerplateJS loosely coupled, and flexible.

My intention of this post was to give a sneak peek in to the development of BoilerplateJS. More information about BoilerplateJS is available on http://boilerplatejs.org/. And do have a look at Hasith’s blog post at http://blog.hasith.net/2012/08/boilerplatejs-is-out.html.