An engineer is only as good as his or her resources

By | September 29, 2013

Early on in my aerospace engineering career I was once told this, (the title of this post) by a more seasoned engineer. Since then I have taken this to heart. I tend to buy books often and I am a firm believer in preparing for a new project before hand. I also don’t think you can fully commit everything to memory but I often find myself remembering a topic I read and then going back to a resource to refresh my memory.

I recently inherited an internal, large scale, JavaScript application at work after one of our front end web developers left for another company. He was a very decent developer but unfortunately the application, or suite of applications had various developers maintaining it over a period of years and the applications had been refactored a few times with no real direction or encompassing architecture in place.

I had previously been predominately a Java developer but I had some limited experience with JavaScript and recently with jQuery. Upon inheriting a large code base in JavaScript and coming to understand the larger design goals from the project manager and stakeholders, I realized I needed to be able to provide the structure and architecture this suite of applications had been missing.

The code base suffered from poorly formatted code to poorly implemented or misused design patterns. There were a lot of opportunities for code reuse and a need for consistency in the user interface as a whole. Also the project build processes needed to be recreated from scratch since significant parts of it did not work and what did work couldn’t be easily automated. The code base did use the Model, View, Controller pattern, but not very well. The view objects contained most of the code for the application logic and the controllers did very little.

Each application in the suite is launched from an encompassing application via an iframe. This gave the applications a lot of flexibility but each application also had its own copy of dependent libraries. Also the iframes would make communication between the applications more difficult.

So in preparation for this task I have read through the following resources and I highly recommend them to anyone who is working on a large scale JavaScript project.

To say the least these reference have provided the tools required to build an architecture for these applications and described the necessary design patterns as they are implemented in JavaScript. I am thoroughly impressed with each of these books. Around 200 pages or less for each, they are a great reference and a quick read to get up to speed on a JavaScript project.

So my first task was to identify parts of the applications that were reused throughout the code base and using the Module Pattern, create reusable modules that could easily be used by any of the applications in the suite. previously these components had been copied and pasted in the code where they were used. They were also inconsistent from place to place and bug fixes had to be applied to multiple locations in the code base.

I have also been decoupling the JavaScript, CSS, HTML, and configuration data. Configuration data for UI components were mixed in with the UI code. Large segments of static HTML were also buried with the JavaScript and CSS styles were applied inconsistently in JavaScript as well. I also created a factory object for creating consistent dialogs. I will do the same for other frequently used UI components.

With these basic reusable pieces in place, any new application in the suite can easily utilize them and the existing applications will be refactored over time to begin using them. Each application will also use the module pattern so that eventually, when all the applications have been refactored they can be included in a new encompassing application using the Sandbox Pattern.

In my previous Java projects we had used CruiseControl and ANT build scripts for continuos integration and automated testing. I really appreciate the peace of mind and constant feedback that CI provides so I plan on using Jenkins CI for continuos integration and create new ANT build scripts for each application.

Coming up next in my reading list are the following. I hope they are as impressive as the previous.

Anyway, I thought I’d share this list of resources in case anyone finds themselves in a similar situation.

Leave a Reply