Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Your Code Sucks: Best Practices for Enterprise ...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Arthur Kay
August 15, 2012
Programming
8
2.7k
Your Code Sucks: Best Practices for Enterprise JavaScript Development
From ThatConference 2012
Arthur Kay
August 15, 2012
Tweet
Share
More Decks by Arthur Kay
See All by Arthur Kay
Analyzing the ROI of JavaScript in Enterprise Software Development
arthurakay
0
160
Debugging your Apps with Google Chrome and Sencha
arthurakay
1
290
Announcing Ext JS 5
arthurakay
0
150
Conquering the Command Line
arthurakay
0
360
The Future of Enterprise App Development
arthurakay
0
140
Best Practices for Enterprise JavaScript Applications
arthurakay
7
2.6k
Bringing the Mobile Web to the Cloud
arthurakay
2
580
Building Native Windows 8 Apps with Sencha
arthurakay
0
260
Creating Windows 8 Apps with Ext JS
arthurakay
1
290
Other Decks in Programming
See All in Programming
How to stabilize UI tests using XCTest
akkeylab
0
130
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.5k
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
130
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.2k
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8.1k
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
160
Ruby x Terminal
a_matsuda
7
600
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
120
Ruby and LLM Ecosystem 2nd
koic
1
810
Unity6.3 AudioUpdate
cova8bitdots
0
130
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
320
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
180
How GitHub (no longer) Works
holman
316
140k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
160
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Producing Creativity
orderedlist
PRO
348
40k
A Modern Web Designer's Workflow
chriscoyier
698
190k
エンジニアに許された特別な時間の終わり
watany
106
240k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
A Tale of Four Properties
chriscoyier
163
24k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Transcript
Best Practices for Enterprise JavaScript Applications YOUR CODE SUCKS
WHO AM I? • Arthur Kay • Solutions Engineer @
Sencha, Inc. • Web Development ~15 years • www.akawebdesign.com • @arthurakay
AGENDA • Improving application performance • Increasing code stability •
Scaling applications for enterprise • Tools • Advice
None
IMPROVING APPLICATION PERFORMANCE Part 1
CACHING
THIS CODE SUCKS
DO THIS INSTEAD • Cache values (references) • Avoid using
document.getElementById() and other global queries
DO THIS INSTEAD
OVER NESTING
THIS CODE SUCKS
DO THIS INSTEAD • Use lightweight containers (reduce DOM) •
Lazy Rendering
DO THIS INSTEAD
MEMORY LEAKS
THIS CODE SUCKS
DO THIS INSTEAD
INCREASING CODE STABILITY Part 2
SYNTAX ERRORS
THIS CODE SUCKS
DO THIS INSTEAD • Use JSLint (or something else) •
AUTOMATE SYNTAX CHECKING
ONE CLASS PER FILE
THIS CODE SUCKS
DO THIS INSTEAD • Organize your file system • Files
and folders should match namespacing • MVC (or something) • Development loader / Production builder
NAMES HAVE MEANING
THIS CODE SUCKS
DO THIS INSTEAD • Descriptive names on everything (except iterators)
• Common naming conventions (camelCase vs TitleCase vs nocase) • Exceptions for • constants ( SOME_CONSTANT ) • constructors ( MyClass ) • sub-namespaces ( Foo.bar.Class )_
COMMENTS / DOCUMENTATION
THIS CODE SUCKS
DO THIS INSTEAD • Comment top-level structures • Add notes
whenever logic is not obvious • Build your docs into a searchable tool
SCALING APPLICATIONS FOR ENTERPRISE Part 3
AVOID DUPLICATION
THIS CODE SUCKS
DO THIS INSTEAD • Abstraction! • Use mixins when possible
• Apply stuff to prototypes • Have similar classes/methods? • call() and apply()
DO THIS INSTEAD
SMALLER FILES. WHITE SPACE.
THIS CODE SUCKS
DO THIS INSTEAD • Keep methods under 50 lines •
Keep files under 500 lines • Use as much whitespace as possible.
UNIT TESTS
THIS CODE SUCKS
DO THIS INSTEAD • Write “testable” code • Focus on
important / trouble areas • AUTOMATE UNIT TESTING • Don’t insist on UI (integration/iteraction) tests * Test Driven JavaScript Development by Christian Johansen
TOOLS Stuff You Should Know About
IDE
INSPECT ELEMENT
YSLOW
JS DUCK
PHANTOM.JS
ADVICE Things I’ve Learned
SPECIFICATION – NOT TDD
NEVER STOP LEARNING
BREAK (SOME) RULES
None
ADDITIONAL RESOURCES • “Maintainable JavaScript” by Nicholas Zakas • http://www.slideshare.net/nzakas/maintainable-javascript-2012
• “Code Conventions for JS” by Douglass Crockford • http://javascript.crockford.com/code.html • “JavaScript Performance Tips & Tricks” by Grgur Grisogono • http://moduscreate.com/javascript-performance-tips-tricks/
THANKS! Arthur Kay | @arthurakay
SPEAKERDECK.COM/U/ARTHURAKAY Share this presentation: