SlideShare una empresa de Scribd logo
1 de 35
Descargar para leer sin conexión
ClojureScript in
Magento 2
/me
Freelance Developer & Consultant
Web Developer since 1997
Magento since 2008
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Topic for today:
Frontend Development with
ClojureScript in Magento 2
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
WTF?!
Why?
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Magento 2 has a "sophisticated" frontend architecture.
$ find vendor/magento/*/view/ -name '*.js' | xargs wc -l
.
.
.
43 vendor/magento/module-user/view//adminhtml/web/app-config.js
159 vendor/magento/module-weee/view//base/web/js/price/adjustment.js
240 vendor/magento/module-wishlist/view//frontend/web/js/wishlist.js
110823 total
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Don't fight the framework!
We need to GET STUFF DONE!!
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
I don't want to fight.
But sometimes it feels like
the framework is fighting me.
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
As an eCommerce developer,
I want to build sites with Magento,
without being frustrated
by tangled UI Components,
so I can deliver work on time.
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
I would love to love all UI Components.
But it hasn't happened for me.
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
How do I work with Magento and deliver on time?
Go "headless"?
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Consequences of going headless:
* Need to rebuild every feature.
* Incompatible with all extensions
   containing frontend functionality.
* Fun but f'ing expensive.
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
I need to find a tool that allows me to
* Use Magento as much as possible.
* Selectively rebuild the parts
    that I do not want to work with.
* Make the choice on a case-by-case basis.
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Options:
* JavaScript
* TypeScript
* ScalaJS
* ClojureScript
* Elm
* PureScript
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
What is ClojureScript?
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
LISP
(List + Processor)
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
Hosted Language
  * JVM
  * JavaScript (Browser & Node)
  * CLR
(Clojure, ClojureScript, ClojureCLR)
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
Embraces the host runtime -> interop
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
One thing which seems important at first
turns out to be a non-issue:
Parenthesis
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
PHP
print("Magento")
Clojure
(print "Magento")
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
But JS haz Objects...!
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
JavaScript
"Magento".toLowerCase()
// => "magento"
ClojureScript
(.toLowerCase "Magento")
;; => "magento"
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
JS
console.log("debug");
ClojureScript
(.log js/console "debug")
;; alternative syntactic JS interop sugar
(js/console.log "debug")
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Core Data Structures
PHP JS Clojure
Array [1, 2, 3] [1, 2, 3] [1 2 3]
List [1, 2, 3] [1, 2, 3] (1 2 3)
Map ['foo' => 'bar'] {foo: 'bar'} {:foo "bar"}
Set new
DsSet([2,
42, 5)
new Set([2,
42, 5])
#{2 42 5}
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Why do we need different data structures?
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Language guaranteed characteristics
For example:
Vectors: indexed access O(1),
             cheap to grow at end
(def my-vec [4 5 6 2 12 42 33 4 5 1 5])
(get my-vec 5) => 42
Lists: indexed access O(n),
         cheap to grow at front
(def my-list (range 100))
(nth my-list 34) => 34
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
CLJS in Magento
* In Magento module:
   compiled to view/frontend/web/js/
* In Magento base dir:
   compiled to pub/js/
* The <script src="..."> tag
   needs to precede requirejs
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Demo
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
* Quick feedback loop
* Lovely developer experience
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
* stable
* 10 years of growth
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Clojure
* More Clojure devs than Clojure jobs
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
So many good ideas in ClojureScript...
I want talk about all of them!
That would take days...
But I can't just leave them out!
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Wow, much good, such benefits!
- Immutability by default
- Large consistent core library
- Google Closure Compiler Inlining and Dead Code Elimination
- Dead Code Elimination also for external node modules
- Closure Spec
- Great concurrency story
- React Native
- GCC module splitting and cross module code motion
- Direct access to the giant JavaScript and Java library ecosystem
- Great testing story
- Modern frontend architecture
- Podcasts, YouTube Channels, International Conferences
- User groups and workshops
- Very cool people and projects to be inspired by
- And much more...
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Want to dig in?
Clojure for the Brave and True
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
Thank you!
Questions,
Thoughts,
Ideas?
Demo Source: https://github.com/Vinai/magento-cljs-giftlist
ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22

Más contenido relacionado

Similar a ClojureScript in Magento 2 - PHPUGMRN

Similar a ClojureScript in Magento 2 - PHPUGMRN (20)

GraphQL in Magento 2
GraphQL in Magento 2GraphQL in Magento 2
GraphQL in Magento 2
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 
How to create a Vue Storefront theme
How to create a Vue Storefront themeHow to create a Vue Storefront theme
How to create a Vue Storefront theme
 
Gerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source codeGerrit Analytics applied to Android source code
Gerrit Analytics applied to Android source code
 
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
Palestra "Ionic Framework 2 - O que vem por aí?" TDC 2016
 
Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015Fundamentals of Extending Magento 2 - php[world] 2015
Fundamentals of Extending Magento 2 - php[world] 2015
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 
Elastic network of things with mqtt and micro python
Elastic network of things with mqtt and micro pythonElastic network of things with mqtt and micro python
Elastic network of things with mqtt and micro python
 
Grails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duoGrails & Angular: unleashing the dynamic duo
Grails & Angular: unleashing the dynamic duo
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
 
Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018Becoming Certified - MageTitansMCR 2018
Becoming Certified - MageTitansMCR 2018
 
Magento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata IntroMagento 2 TDD Code Kata Intro
Magento 2 TDD Code Kata Intro
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2MidwestPHP - Getting Started with Magento 2
MidwestPHP - Getting Started with Magento 2
 
Sprint 127
Sprint 127Sprint 127
Sprint 127
 
#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS#2 Hanoi Magento Meetup - Part 2: Knockout JS
#2 Hanoi Magento Meetup - Part 2: Knockout JS
 
markedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVMmarkedj: The best of markdown processor on JVM
markedj: The best of markdown processor on JVM
 
Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020Magento Commerce Global contribution day 2020
Magento Commerce Global contribution day 2020
 
2018 September - The Month in PHP
2018 September - The Month in PHP2018 September - The Month in PHP
2018 September - The Month in PHP
 
Testing Magento 2
Testing Magento 2Testing Magento 2
Testing Magento 2
 

Más de vinaikopp

Más de vinaikopp (15)

Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023Building Mage-OS - MageTitans 2023
Building Mage-OS - MageTitans 2023
 
Hyvä: Compatibility Modules
Hyvä: Compatibility ModulesHyvä: Compatibility Modules
Hyvä: Compatibility Modules
 
Hyvä from a developer perspective
Hyvä from a developer perspectiveHyvä from a developer perspective
Hyvä from a developer perspective
 
Property Based Testing in PHP
Property Based Testing in PHPProperty Based Testing in PHP
Property Based Testing in PHP
 
Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019Property based testing - MageTestFest 2019
Property based testing - MageTestFest 2019
 
SOS UiComponents
SOS UiComponentsSOS UiComponents
SOS UiComponents
 
Magento 2 TDD Code Kata
Magento 2 TDD Code KataMagento 2 TDD Code Kata
Magento 2 TDD Code Kata
 
ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017ClojureScript in Magento 2 - MageTitansMCR 2017
ClojureScript in Magento 2 - MageTitansMCR 2017
 
Lizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17deLizards & Pumpkins Catalog Replacement at mm17de
Lizards & Pumpkins Catalog Replacement at mm17de
 
Stories from the other side
Stories from the other sideStories from the other side
Stories from the other side
 
Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)Writing testable Code (MageTitans Mini 2016)
Writing testable Code (MageTitans Mini 2016)
 
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)Getting your Hands Dirty Testing Magento 2 (at London Meetup)
Getting your Hands Dirty Testing Magento 2 (at London Meetup)
 
Architecture in-the-small-slides
Architecture in-the-small-slidesArchitecture in-the-small-slides
Architecture in-the-small-slides
 
Modern Module Architecture
Modern Module ArchitectureModern Module Architecture
Modern Module Architecture
 
The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014The beautiful Magento module - MageTitans 2014
The beautiful Magento module - MageTitans 2014
 

Último

%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 

ClojureScript in Magento 2 - PHPUGMRN

  • 2. /me Freelance Developer & Consultant Web Developer since 1997 Magento since 2008 ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 3.
  • 4. Topic for today: Frontend Development with ClojureScript in Magento 2 ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 5. WTF?! Why? ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 6. Magento 2 has a "sophisticated" frontend architecture. $ find vendor/magento/*/view/ -name '*.js' | xargs wc -l . . . 43 vendor/magento/module-user/view//adminhtml/web/app-config.js 159 vendor/magento/module-weee/view//base/web/js/price/adjustment.js 240 vendor/magento/module-wishlist/view//frontend/web/js/wishlist.js 110823 total ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 7. Don't fight the framework! We need to GET STUFF DONE!! ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 8. I don't want to fight. But sometimes it feels like the framework is fighting me. ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 9. As an eCommerce developer, I want to build sites with Magento, without being frustrated by tangled UI Components, so I can deliver work on time. ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 10. I would love to love all UI Components. But it hasn't happened for me. ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 11. How do I work with Magento and deliver on time? Go "headless"? ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 12. Consequences of going headless: * Need to rebuild every feature. * Incompatible with all extensions    containing frontend functionality. * Fun but f'ing expensive. ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 13. I need to find a tool that allows me to * Use Magento as much as possible. * Selectively rebuild the parts     that I do not want to work with. * Make the choice on a case-by-case basis. ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 14. Options: * JavaScript * TypeScript * ScalaJS * ClojureScript * Elm * PureScript ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 15. What is ClojureScript? ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 16. LISP (List + Processor) ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 17. Clojure Hosted Language   * JVM   * JavaScript (Browser & Node)   * CLR (Clojure, ClojureScript, ClojureCLR) ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 18. Clojure Embraces the host runtime -> interop ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 19. Clojure One thing which seems important at first turns out to be a non-issue: Parenthesis ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 20. PHP print("Magento") Clojure (print "Magento") ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 21. But JS haz Objects...! ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 22. JavaScript "Magento".toLowerCase() // => "magento" ClojureScript (.toLowerCase "Magento") ;; => "magento" ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 23. JS console.log("debug"); ClojureScript (.log js/console "debug") ;; alternative syntactic JS interop sugar (js/console.log "debug") ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 24. Core Data Structures PHP JS Clojure Array [1, 2, 3] [1, 2, 3] [1 2 3] List [1, 2, 3] [1, 2, 3] (1 2 3) Map ['foo' => 'bar'] {foo: 'bar'} {:foo "bar"} Set new DsSet([2, 42, 5) new Set([2, 42, 5]) #{2 42 5} ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 25. Why do we need different data structures? ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 26. Language guaranteed characteristics For example: Vectors: indexed access O(1),              cheap to grow at end (def my-vec [4 5 6 2 12 42 33 4 5 1 5]) (get my-vec 5) => 42 Lists: indexed access O(n),          cheap to grow at front (def my-list (range 100)) (nth my-list 34) => 34 ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 27. CLJS in Magento * In Magento module:    compiled to view/frontend/web/js/ * In Magento base dir:    compiled to pub/js/ * The <script src="..."> tag    needs to precede requirejs ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 28. Demo ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 29. Clojure * Quick feedback loop * Lovely developer experience ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 30. Clojure * stable * 10 years of growth ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 31. Clojure * More Clojure devs than Clojure jobs ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 32. So many good ideas in ClojureScript... I want talk about all of them! That would take days... But I can't just leave them out! ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 33. Wow, much good, such benefits! - Immutability by default - Large consistent core library - Google Closure Compiler Inlining and Dead Code Elimination - Dead Code Elimination also for external node modules - Closure Spec - Great concurrency story - React Native - GCC module splitting and cross module code motion - Direct access to the giant JavaScript and Java library ecosystem - Great testing story - Modern frontend architecture - Podcasts, YouTube Channels, International Conferences - User groups and workshops - Very cool people and projects to be inspired by - And much more... ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 34. Want to dig in? Clojure for the Brave and True ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22
  • 35. Thank you! Questions, Thoughts, Ideas? Demo Source: https://github.com/Vinai/magento-cljs-giftlist ClojureScript in Magento 2 - (c) @VinaiKopp - #PHPUGMRN - 2018-02-22