SlideShare a Scribd company logo
How to build a JavaScript
framework toolkit
About Me
Mike Nelson
Head of Rich User Interface Development at HeathWallace
Creator of ArmatureJS - an in-house JavaScript Toolkit
@accordionpeas
Library, framework or toolkit?
typeof jQuery === ‘library’
typeof Angular === ‘framework’
typeof Dojo === ‘toolkit’
ArmatureJS
A JS Toolkit
40,000+ lines of code
Aims to provide everything you need to build a web app:
• module loading
• language utilities
• UI components
• lots more
Only 3rd party code is a custom build of jQuery - and not for long
A brief history of ArmatureJS
• Mostly widget-based JS requirements - jQuery plugins
• Some SPA work - Backbone and Underscore
• A client insisted we use Dojo for all their projects
• Created an initial in-house framework - rewrite of jQuery plugins and some
basic concepts borrowed from Dojo
• Toolkit was added to and improved
• Documentation site was produced
• Toolkit named ArmatureJS
Why bother?
There are LOTS of JavaScript frameworks out there - http://js-
drinking.projects.frank.petril.li/
Isn’t re-inventing the wheel a bad thing?
Doesn’t it cost the business money?
Because...
Our clients won’t accept a lot of third party code
We’ve gained a really deep understanding of JS
It’s raised the level of competency within the team
It saves money
It’s fun
So, how do I do it?
• Be modular
• Be consistent
• Borrow ideas
• Write tests
• Create documentation
• Manage releases
Be modular
Be modular
There are many module patterns and loaders available
We use our own AMD implementation:
• Many modular, terse files during development
• One compiled and compressed file for production
AMD
define([
‘some/folder/module1’,
‘some/folder/module2’
], function(mod1, mod2){
//do some stuff with modules 1 and 2
return {
get: function(){ … }
}
});
Be consistent
Define your API characteristics
Providing a useful and intuitive API is not easy.
Some things to consider:
• Chaining
• Implicit iteration
• Getters and Setters
• Private properties / methods
Be consistent
Reliability & consistency are key to winning over users
Doesn’t mean you can’t change/update your API - can be handled with
versioning
Borrow ideas
Borrow ideas
It’s ok to borrow ideas from other libraries:
• API characteristics
• Names
• Functionality
But write the code yourself without looking at how they implemented it. Why?
• Avoids any potential licensing issues
• Great learning experience
Write tests
Define your supported platforms
Browser / device support
Other JS environments - e.g. Node.js
Make it “just work” across platforms - abstract platform concerns away from
your users
Unit tests
Choose a unit testing framework and use it from the start
Achieve as much coverage as you can
Don’t commit a module without an accompanying test suite
Ensure tests are run regularly
- Run tests via a task runner e.g. Grunt / Gulp
- Automatically run tests on CI server
Create documentation
Create a docs site
Auto-generate as much content as possible
Write tutorials
Include plenty of examples
Javadoc-style comments
/**
Determine if a value is an array.
@method isArray
@param val {*} The value to test.
@return {Boolean} Returns true or false.
@example
lang.isArray([]);
// => true
*/
How to build a JavaScript toolkit
Manage releases
Releasing
Choose a versioning system e.g. semver - major.minor.patch
Use it to appropriately inform your users of what to expect in a given release
For every release:
Ensure all tests pass
Make sure docs are up to date
Inform users
Thank you

More Related Content

PDF
You don’t know js about share point – hugh wood
PPTX
Advanced AngularJS Tips and Tricks
PPTX
Test Automation Framework with BDD and Cucumber
ODP
Jbossworld Presentation
PPTX
What's new in Visual Studio 2013 & TFS 2013
PPTX
Pp js conf_2015
PPTX
WordPress for Applications
PPTX
How to be an awesome test automation professional
You don’t know js about share point – hugh wood
Advanced AngularJS Tips and Tricks
Test Automation Framework with BDD and Cucumber
Jbossworld Presentation
What's new in Visual Studio 2013 & TFS 2013
Pp js conf_2015
WordPress for Applications
How to be an awesome test automation professional

What's hot (20)

PPTX
DeveloperDeveloperDeveloper! Sydney 2012
PDF
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
PPTX
Test Driven Development in CQ5/AEM
PPTX
Hands on BDD with cucumber - Agile Goa Sept 2013
PPTX
End to end test automation with cypress
PPTX
Introduction to Bdd and cucumber
PDF
The Evolution of WordPress Software Development
PDF
Getting Started with React Native (and should I use it at all?)
PPTX
Keeping Pace with Product Evolution - UI Automation Framework Guidelines
PPTX
SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...
PDF
NSTC2019: Choosing CI Friendly Mobile Automation Framework
PDF
O365Con18 - SharePoint Framework for Administrators - Waldek Mastykarz
PDF
Test Driven Development in AEM/CQ5
PDF
Introduction to ASP.NET MVC
PPTX
Web automation with Selenium for software engineers
PPTX
Develop a Basic REST API from Scratch Using TDD with Val Karpov
PPTX
ASP.NET 5 Overview for Apex Systems
PDF
Building better WordPress applications
PPTX
Valentine with Angular js - Introduction
DeveloperDeveloperDeveloper! Sydney 2012
O365Con18 - Implementing Automated UI Testing for SharePoint Solutions - Elio...
Test Driven Development in CQ5/AEM
Hands on BDD with cucumber - Agile Goa Sept 2013
End to end test automation with cypress
Introduction to Bdd and cucumber
The Evolution of WordPress Software Development
Getting Started with React Native (and should I use it at all?)
Keeping Pace with Product Evolution - UI Automation Framework Guidelines
SenchaCon 2016: Cross-Platform Mobile App Development with Cordova and Visual...
NSTC2019: Choosing CI Friendly Mobile Automation Framework
O365Con18 - SharePoint Framework for Administrators - Waldek Mastykarz
Test Driven Development in AEM/CQ5
Introduction to ASP.NET MVC
Web automation with Selenium for software engineers
Develop a Basic REST API from Scratch Using TDD with Val Karpov
ASP.NET 5 Overview for Apex Systems
Building better WordPress applications
Valentine with Angular js - Introduction
Ad

Similar to How to build a JavaScript toolkit (20)

PDF
Patterns and practices for building enterprise-scale HTML5 apps
PDF
Introduction to Protractor
PDF
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
PPTX
API workshop: Introduction to APIs (TC Camp)
PDF
Optimus XPages: An Explosion of Techniques and Best Practices
PPTX
Delivering Developer Tools at Scale
PPTX
Test automation proposal
PPTX
Swagger - Making REST APIs friendlier
PPT
In Act Developers Platform
PDF
How to Build Front-End Web Apps that Scale - FutureJS
KEY
Single Page Applications - Desert Code Camp 2012
PDF
13 providing an ide for creating, simulating and assessing accessible applica...
PPTX
Mobile and IBM Worklight Best Practices
PPTX
Azure Functions Real World Examples
PDF
Fed London - January 2015
PDF
DEV117 - Unleash the Power of the AppDev Pack and Node.js in Domino
PDF
Practices and tools for building better API (JFall 2013)
PDF
Practices and tools for building better APIs
PDF
Angular - Chapter 1 - Introduction
PPTX
Structured Functional Automated Web Service Testing
Patterns and practices for building enterprise-scale HTML5 apps
Introduction to Protractor
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
API workshop: Introduction to APIs (TC Camp)
Optimus XPages: An Explosion of Techniques and Best Practices
Delivering Developer Tools at Scale
Test automation proposal
Swagger - Making REST APIs friendlier
In Act Developers Platform
How to Build Front-End Web Apps that Scale - FutureJS
Single Page Applications - Desert Code Camp 2012
13 providing an ide for creating, simulating and assessing accessible applica...
Mobile and IBM Worklight Best Practices
Azure Functions Real World Examples
Fed London - January 2015
DEV117 - Unleash the Power of the AppDev Pack and Node.js in Domino
Practices and tools for building better API (JFall 2013)
Practices and tools for building better APIs
Angular - Chapter 1 - Introduction
Structured Functional Automated Web Service Testing
Ad

Recently uploaded (20)

PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Modernizing your data center with Dell and AMD
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
KodekX | Application Modernization Development
PDF
Chapter 2 Digital Image Fundamentals.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Transforming Manufacturing operations through Intelligent Integrations
Spectral efficient network and resource selection model in 5G networks
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Modernizing your data center with Dell and AMD
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
KodekX | Application Modernization Development
Chapter 2 Digital Image Fundamentals.pdf
Big Data Technologies - Introduction.pptx
madgavkar20181017ppt McKinsey Presentation.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
“AI and Expert System Decision Support & Business Intelligence Systems”
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

How to build a JavaScript toolkit

  • 1. How to build a JavaScript framework toolkit
  • 2. About Me Mike Nelson Head of Rich User Interface Development at HeathWallace Creator of ArmatureJS - an in-house JavaScript Toolkit @accordionpeas
  • 3. Library, framework or toolkit? typeof jQuery === ‘library’ typeof Angular === ‘framework’ typeof Dojo === ‘toolkit’
  • 4. ArmatureJS A JS Toolkit 40,000+ lines of code Aims to provide everything you need to build a web app: • module loading • language utilities • UI components • lots more Only 3rd party code is a custom build of jQuery - and not for long
  • 5. A brief history of ArmatureJS • Mostly widget-based JS requirements - jQuery plugins • Some SPA work - Backbone and Underscore • A client insisted we use Dojo for all their projects • Created an initial in-house framework - rewrite of jQuery plugins and some basic concepts borrowed from Dojo • Toolkit was added to and improved • Documentation site was produced • Toolkit named ArmatureJS
  • 6. Why bother? There are LOTS of JavaScript frameworks out there - http://js- drinking.projects.frank.petril.li/ Isn’t re-inventing the wheel a bad thing? Doesn’t it cost the business money?
  • 7. Because... Our clients won’t accept a lot of third party code We’ve gained a really deep understanding of JS It’s raised the level of competency within the team It saves money It’s fun
  • 8. So, how do I do it? • Be modular • Be consistent • Borrow ideas • Write tests • Create documentation • Manage releases
  • 10. Be modular There are many module patterns and loaders available We use our own AMD implementation: • Many modular, terse files during development • One compiled and compressed file for production
  • 11. AMD define([ ‘some/folder/module1’, ‘some/folder/module2’ ], function(mod1, mod2){ //do some stuff with modules 1 and 2 return { get: function(){ … } } });
  • 13. Define your API characteristics Providing a useful and intuitive API is not easy. Some things to consider: • Chaining • Implicit iteration • Getters and Setters • Private properties / methods
  • 14. Be consistent Reliability & consistency are key to winning over users Doesn’t mean you can’t change/update your API - can be handled with versioning
  • 16. Borrow ideas It’s ok to borrow ideas from other libraries: • API characteristics • Names • Functionality But write the code yourself without looking at how they implemented it. Why? • Avoids any potential licensing issues • Great learning experience
  • 18. Define your supported platforms Browser / device support Other JS environments - e.g. Node.js Make it “just work” across platforms - abstract platform concerns away from your users
  • 19. Unit tests Choose a unit testing framework and use it from the start Achieve as much coverage as you can Don’t commit a module without an accompanying test suite Ensure tests are run regularly - Run tests via a task runner e.g. Grunt / Gulp - Automatically run tests on CI server
  • 21. Create a docs site Auto-generate as much content as possible Write tutorials Include plenty of examples
  • 22. Javadoc-style comments /** Determine if a value is an array. @method isArray @param val {*} The value to test. @return {Boolean} Returns true or false. @example lang.isArray([]); // => true */
  • 25. Releasing Choose a versioning system e.g. semver - major.minor.patch Use it to appropriately inform your users of what to expect in a given release For every release: Ensure all tests pass Make sure docs are up to date Inform users