SlideShare a Scribd company logo
1 of 44
Download to read offline
Ustream vs Legacy 
@matenadasdi
Ustream basics 
80.000.000 visitors / month 
5.000.000+ viewer hours on tough days
Legacy is not bad code, it’s just old or over-iterated
Everyone starts in the dark… 
but there is always light in the end of the tunnel
Our goal was to achieve 
more stability and scalability 
in our frontend codebase
Our situation was 
(like every frontend codebase some years ago) 
no tests 
no modules 
all-in-one feature based class system 
poor abstraction 
JSLint as “code quality tools”
It’s a new ERA 
it’s a heaven of tools and new solutions 
for frontend developers nowadays
we had 5 stages in our long journey 
it may help or inspire you too
Structure
There are some must-have things for testing… 
separate business logic from its representation 
easy isolation 
dependency injection 
we had to create / use a new structure
not the framework, the way of thinking matters
always think in layers with separated responsibilities
DOM 
manipulates events 
Views 
control notify 
Controllers 
get data set data 
Logics Models 
get data set data 
Async Sync Socket (full-duplex) 
AJAX WebStorage Cookies Socket Longpoll Ustream Flash API Embeds
our new small framework is under 10kb 
but we had millions of lines written in an old style
don’t be afraid to start the hardcore continuous integration
Testing
framework: 
Mocha + Chai 
Node and Browser support 
Separated assert libraries 
Tons of reporters 
mocking: 
SinonJS 
Spies, Stubs, Mocks 
Assertions for invocations 
wide framework support 
Faking AJAX, server 
module dependency mocking: 
SquireJS 
Dependency injector for 
RequireJS 
mock / store 
Unit testing
Unit testing is a must in every architecture 
but it’s not enough for client side code!
Testing real browser functionality with mocking 
and simulating the DOM can be a pain in the …
Solution: CasperJS 
Node.js based navigation scripting 
PhantomJS / SlimerJS support 
screenshot capture 
you can skip or use your own testing framework
It’s really flexible and easy to customize! 
Right now we have: 
parallel execution thanks to an own grunt task solution 
Tools based on Casper: Screenshot comparison tool, regression testing (PhantomCSS) 
own testing wrapper layer with different presets and transparent modules. User.login(), etc.
Automation
Manual processes simply won’t work… 
but there is an easy cure!
GRUNT || GULP 
we use Grunt! 
Why not gulp? 
Bad question, both are awesome, move on, and pick one!:)
Thanks to Grunt 
we could migrate our old PHP / Ruby / etc. based frontend jobs to Node 
there is a transparent layer for every frontend related task 
thanks to our dynamic GruntFile.js solution, adding new tasks is fast
CI integration is important! 
with an automation layer, it’s easy to do
Rules & standards 
insurance for the future
Follow your rules, because if you break them, 
they are not rules anymore…
Code style!
JSHint 
! 
! 
pros: 
.jshintrc 
huge community 
wide IDE / Text editor integration 
grunt / gulp plugins 
! 
cons: 
still regexp based (JSLint fork) 
not pluginable 
nearly impossible to write semantic rules
ESLint 
! 
pros: 
pluginable 
tons of new rules 
rapidly growing community 
semantics 
ESPRIMA 
growing IDE / Text editor integration 
! 
cons: 
you can tell maybe!
We’ve created our own rules
Complexity? 
Lines of code (LOC) 
Halstead indexes 
Maintainability index 
Cyclomatic complexity 
linearly independent paths in the method
JSComplexity & Plato 
We run complexity report in Jenkins nightly build for our whole JS codebase 
https://www.npmjs.org/package/complexity-report 
Plato is a great tool for manual examinations 
https://github.com/es-analysis/plato
Use your CI or Git hooks to force your rules & standards
Modules, modules!
Why we’ve started our modularisation marathon 
async module loading 
dependency injection 
project based SOA workflow, we have to avoid code duplication in 
several repos/projects
Do not worry! Code modifications can be automated! 
http://esprima.org/ 
{ 
"type": "Program", 
"body": [ 
{ 
"type": "VariableDeclaration", 
"declarations": [ 
{ 
"type": "VariableDeclarator", 
"id": { 
"type": "Identifier", 
"name": "city" 
}, 
"init": { 
"type": "Literal", 
"value": "istanbul", 
"raw": "'istanbul'" 
} 
} 
], 
"kind": "var" 
}, 
{ 
"type": "IfStatement", 
"test": { 
"type": "BinaryExpression", 
"operator": "===", 
"left": { 
"type": "Identifier", 
"name": "city" 
}, 
"right": { 
"type": "Literal", 
"value": "istanbul", 
"raw": "'istanbul'" 
} 
}, 
"consequent": { 
var city = ‘istanbul’; 
! 
if (city === ‘istanbul’) { 
conf = 'jsist'; 
}
more! 
NPM modules? Maybe private ones?
NPM in private 
private repo server: Sinopia 
internal GitLab repos for each package 
grunt release task for NPM module release 
https://github.com/geddski/grunt-release 
https://github.com/boennemann/grunt-semantic-release
Why? 
we can manage our dependencies in different projects / services 
separated tests & documentation for each module 
we also use NPM for non-node package management 
Yeoman for automated project configuration
This is where we are right now! 
That’s not dark anymore!:)
What we’ve achieved so far 
600+ modules created 
hundreds of unit tests and Casper tests, and growing rapidly 
new and important core features are moved to the new structure 
we started to create our private NPM modules like hell! 
ready for Async module loading
Remember: It’s never too late! 
@matenadasdi

More Related Content

What's hot

Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScriptOffirmo
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponLaurent Duveau
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!Alessandro Giorgetti
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins Udaya Kumar
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersLaurent Duveau
 
Typescript overview
Typescript overviewTypescript overview
Typescript overviewThanvilahari
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersLaurent Duveau
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript FundamentalsSunny Sharma
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviWinston Levi
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming languageMarco Cedaro
 
Lets talk-about-js
Lets talk-about-jsLets talk-about-js
Lets talk-about-jssrnftw
 
SPA, Scalable Application & AngularJS
SPA, Scalable Application & AngularJSSPA, Scalable Application & AngularJS
SPA, Scalable Application & AngularJSMitch Chen
 

What's hot (20)

TypeScript intro
TypeScript introTypeScript intro
TypeScript intro
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
Metaprogramming with javascript
Metaprogramming with javascriptMetaprogramming with javascript
Metaprogramming with javascript
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!TypeScript . the JavaScript developer best friend!
TypeScript . the JavaScript developer best friend!
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Typescript overview
Typescript overviewTypescript overview
Typescript overview
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
Learning typescript
Learning typescriptLearning typescript
Learning typescript
 
Introducing TypeScript
Introducing TypeScriptIntroducing TypeScript
Introducing TypeScript
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston Levi
 
Paris Web - Javascript as a programming language
Paris Web - Javascript as a programming languageParis Web - Javascript as a programming language
Paris Web - Javascript as a programming language
 
Js ppt
Js pptJs ppt
Js ppt
 
Lets talk-about-js
Lets talk-about-jsLets talk-about-js
Lets talk-about-js
 
SPA, Scalable Application & AngularJS
SPA, Scalable Application & AngularJSSPA, Scalable Application & AngularJS
SPA, Scalable Application & AngularJS
 
AngularConf2015
AngularConf2015AngularConf2015
AngularConf2015
 

Similar to Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014

Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stabilityMáté Nádasdi
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceTimur Shemsedinov
 
JSR381 Visual Recognition for Java.pdf
JSR381 Visual Recognition for Java.pdfJSR381 Visual Recognition for Java.pdf
JSR381 Visual Recognition for Java.pdfZoran Sevarac, PhD
 
Teaching old java script new tricks
Teaching old java script new tricksTeaching old java script new tricks
Teaching old java script new tricksSimon Sturmer
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
Use React tools for better Angular apps
Use React tools for better Angular appsUse React tools for better Angular apps
Use React tools for better Angular appsMartin Hochel
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchMats Bryntse
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2Matthew McCullough
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Makmfrancis
 
Implementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCImplementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCjimfuller2009
 
Developer Job in Practice
Developer Job in PracticeDeveloper Job in Practice
Developer Job in Practiceintive
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testingMats Bryntse
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Otávio Santana
 
jChampions JSR381 Visual recognition for java
jChampions   JSR381 Visual recognition for javajChampions   JSR381 Visual recognition for java
jChampions JSR381 Visual recognition for javaZoran Sevarac, PhD
 
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17GreeceJS
 
Node.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationNode.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationSam Frons
 

Similar to Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014 (20)

Frontend automation and stability
Frontend automation and stabilityFrontend automation and stability
Frontend automation and stability
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS Conference
 
JSR381 Visual Recognition for Java.pdf
JSR381 Visual Recognition for Java.pdfJSR381 Visual Recognition for Java.pdf
JSR381 Visual Recognition for Java.pdf
 
Teaching old java script new tricks
Teaching old java script new tricksTeaching old java script new tricks
Teaching old java script new tricks
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Use React tools for better Angular apps
Use React tools for better Angular appsUse React tools for better Angular apps
Use React tools for better Angular apps
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 
Dev381.Pp
Dev381.PpDev381.Pp
Dev381.Pp
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2Google App Engine for Java v0.0.2
Google App Engine for Java v0.0.2
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
 
Implementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoCImplementing the Genetic Algorithm in XSLT: PoC
Implementing the Genetic Algorithm in XSLT: PoC
 
Developer Job in Practice
Developer Job in PracticeDeveloper Job in Practice
Developer Job in Practice
 
Java script unit testing
Java script unit testingJava script unit testing
Java script unit testing
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
 
jChampions JSR381 Visual recognition for java
jChampions   JSR381 Visual recognition for javajChampions   JSR381 Visual recognition for java
jChampions JSR381 Visual recognition for java
 
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
 
Node.JS| Coffeescript Presentation
Node.JS| Coffeescript PresentationNode.JS| Coffeescript Presentation
Node.JS| Coffeescript Presentation
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Ustream vs Legacy, It's never too late to start your fight! #Jsist 2014

  • 1. Ustream vs Legacy @matenadasdi
  • 2. Ustream basics 80.000.000 visitors / month 5.000.000+ viewer hours on tough days
  • 3. Legacy is not bad code, it’s just old or over-iterated
  • 4. Everyone starts in the dark… but there is always light in the end of the tunnel
  • 5. Our goal was to achieve more stability and scalability in our frontend codebase
  • 6. Our situation was (like every frontend codebase some years ago) no tests no modules all-in-one feature based class system poor abstraction JSLint as “code quality tools”
  • 7. It’s a new ERA it’s a heaven of tools and new solutions for frontend developers nowadays
  • 8. we had 5 stages in our long journey it may help or inspire you too
  • 10. There are some must-have things for testing… separate business logic from its representation easy isolation dependency injection we had to create / use a new structure
  • 11. not the framework, the way of thinking matters
  • 12. always think in layers with separated responsibilities
  • 13. DOM manipulates events Views control notify Controllers get data set data Logics Models get data set data Async Sync Socket (full-duplex) AJAX WebStorage Cookies Socket Longpoll Ustream Flash API Embeds
  • 14. our new small framework is under 10kb but we had millions of lines written in an old style
  • 15. don’t be afraid to start the hardcore continuous integration
  • 17. framework: Mocha + Chai Node and Browser support Separated assert libraries Tons of reporters mocking: SinonJS Spies, Stubs, Mocks Assertions for invocations wide framework support Faking AJAX, server module dependency mocking: SquireJS Dependency injector for RequireJS mock / store Unit testing
  • 18. Unit testing is a must in every architecture but it’s not enough for client side code!
  • 19. Testing real browser functionality with mocking and simulating the DOM can be a pain in the …
  • 20. Solution: CasperJS Node.js based navigation scripting PhantomJS / SlimerJS support screenshot capture you can skip or use your own testing framework
  • 21. It’s really flexible and easy to customize! Right now we have: parallel execution thanks to an own grunt task solution Tools based on Casper: Screenshot comparison tool, regression testing (PhantomCSS) own testing wrapper layer with different presets and transparent modules. User.login(), etc.
  • 23. Manual processes simply won’t work… but there is an easy cure!
  • 24. GRUNT || GULP we use Grunt! Why not gulp? Bad question, both are awesome, move on, and pick one!:)
  • 25. Thanks to Grunt we could migrate our old PHP / Ruby / etc. based frontend jobs to Node there is a transparent layer for every frontend related task thanks to our dynamic GruntFile.js solution, adding new tasks is fast
  • 26. CI integration is important! with an automation layer, it’s easy to do
  • 27. Rules & standards insurance for the future
  • 28. Follow your rules, because if you break them, they are not rules anymore…
  • 30. JSHint ! ! pros: .jshintrc huge community wide IDE / Text editor integration grunt / gulp plugins ! cons: still regexp based (JSLint fork) not pluginable nearly impossible to write semantic rules
  • 31. ESLint ! pros: pluginable tons of new rules rapidly growing community semantics ESPRIMA growing IDE / Text editor integration ! cons: you can tell maybe!
  • 32. We’ve created our own rules
  • 33. Complexity? Lines of code (LOC) Halstead indexes Maintainability index Cyclomatic complexity linearly independent paths in the method
  • 34. JSComplexity & Plato We run complexity report in Jenkins nightly build for our whole JS codebase https://www.npmjs.org/package/complexity-report Plato is a great tool for manual examinations https://github.com/es-analysis/plato
  • 35. Use your CI or Git hooks to force your rules & standards
  • 37. Why we’ve started our modularisation marathon async module loading dependency injection project based SOA workflow, we have to avoid code duplication in several repos/projects
  • 38. Do not worry! Code modifications can be automated! http://esprima.org/ { "type": "Program", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "city" }, "init": { "type": "Literal", "value": "istanbul", "raw": "'istanbul'" } } ], "kind": "var" }, { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "city" }, "right": { "type": "Literal", "value": "istanbul", "raw": "'istanbul'" } }, "consequent": { var city = ‘istanbul’; ! if (city === ‘istanbul’) { conf = 'jsist'; }
  • 39. more! NPM modules? Maybe private ones?
  • 40. NPM in private private repo server: Sinopia internal GitLab repos for each package grunt release task for NPM module release https://github.com/geddski/grunt-release https://github.com/boennemann/grunt-semantic-release
  • 41. Why? we can manage our dependencies in different projects / services separated tests & documentation for each module we also use NPM for non-node package management Yeoman for automated project configuration
  • 42. This is where we are right now! That’s not dark anymore!:)
  • 43. What we’ve achieved so far 600+ modules created hundreds of unit tests and Casper tests, and growing rapidly new and important core features are moved to the new structure we started to create our private NPM modules like hell! ready for Async module loading
  • 44. Remember: It’s never too late! @matenadasdi