SlideShare a Scribd company logo
Using FXML on Clojure
(fxml helloworld)
netpyoung@gmail.com
July 2018
#1
Do you have any Questions?
- If you have questions, during presentation.
- message on slack #clojure-sg with page #numer.
- https://clojurians.slack.com/messages/clojure-sg
- ex) #10 - what is blabla?
- I will answer after presentation.(for keep time)
- so, I can polish this slide from your feedbacks.
#2
● EunPyoung Kim
● KOR -> JPN -> SGP-> ???
● Game Client Programmer. (since 2012.04 ~ )
● I like Lisp (not only clojure)
● I’m Lazy
○ because of that I like automatation (code generate also)
○ I like macro (but don't abuse)
● I like Emacs
○ Cursive
○ (Neo)Vim….?
● https://netpyoung.github.io/
#3
What I want & What I did.
● I want editor for future when I making game.
○ Cross platform desktop application
○ GUI designer.
● I didn’t make library.
● I just share other’s approach and my experience.
#4
Wait but why Clojure? (java,scala,kotlin...)
● I'm Game Client Programmer. I prefer typed language rather than dynamic.
● No Clojure? No Problem to me.
● But I just feel fun when I play with REPL.
● I love Lisp not only Clojure.
○ They Also love(?) Lisp.
■ https://www.slideshare.net/naughty_dog/statebased-scripting-in-uncharted-2-among-
thieves
■ https://www.youtube.com/watch?v=Hbexh-Jutvs
● I also like person who love Lisp, they's way of thinking is so flexible and
amazing, like language itself.
● I just choose Clojure compare each other Lisp directs.
#5
Desktop Application
● WPF
○ C#(ClojureCRL)
○ Windows only (but I like XAML. I hope it will be ported on dotnet core)
● JavaFX
○ Java(Clojure)
○ Cross Platform
○ SceneBuilder - GUI Editor
● Electron
○ Javascript(Clojurescript)
○ Cross Platform
○ gui editor??
● qt, wxwidgets, ...
#6
JavaFX
● Sun announces JavaOne 2007
● Open-sourced 2011
○ http://openjdk.java.net/projects/openjfx/
● August 2018
○ JDK 11, Oracle is making JavaFX easier to adopt by making the technology available as a
separate download, decoupled from the JDK.
○ https://blogs.oracle.com/java-platform-group/the-future-of-javafx-and-other-java-client-
roadmap-updates
● I’m not sure JavaFX will be popular or not.
○ If is it possible using WPF on osx - dotnet core, I will choose ClojureCLR.
#7
FXML
fxml
- language
- id
- action
scene builder
controller
#8
FXML
fxml
scene builder
controller
#9
FXML
fxml
scene builder
controller
img: https://www.callicoder.com/javafx-fxml-form-gui-tutorial/
#10
Java - Controller
#11
Java - Controller
#12
I Need Controller
but there are some issue.
● controller - @FXML attribute binding
○ binding Method
○ binding Field
○ binding initialize
● REPL driven developing
○ need to solving AOT problem
#13
#14
I Need Type for Controller
Controller
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
#15
Skip this things
(X) binding
method
(X) binding field
Controller
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
#16
gen-class
#17
binding field(?)
gen-class
● If you want to binding field with gen-class,
○ using .java both…..
● If I incorrect, message to me I will correct that.
#18
Controller
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
#19
#20
deftype
● dirty.. but works….
● I want to check fxml without relaunch application.
#21
● (deftask build []
(comp (aot) (pom) (uber) (jar)))
● aot : Perform AOT compilation of Clojure namespaces
● pom: Create project pom.xml file
● uber: Add jar entries from dependencies to fileset
● jar: Build a jar file for the project
#22
reload
● Okay let’s boost with boot
○ https://github.com/boot-clj/boot
○ https://github.com/boot-clj/boot/pull/692
● danielsz/system
○ https://github.com/danielsz/system
#23
#24
It’s works
● But……. It looks so weird.
● definterface only used one per deftype
● Code structure also Dirty
○ we can avoid this problem using macro… but… Is this really valuable??
#25
What’s the Next
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
#26
FTW! Virtual Dom
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
● Virtual DOM
#27
Virtual DOM
in java
● There is https://github.com/netopyr/reduxfx
#28
in clojure
● fn-fx
○ https://github.com/halgari/fn-fx
○ https://www.youtube.com/watch?v=hJ8GZxhsaVQ
● like redux, single data direction.
● Java 10 Parser and Abstract Syntax Tree for Java – https://javaparser.org
● - https://github.com/javaparser/javaparser : Java source text -> AST
● - https://github.com/forge/roaster : A Java Parser library that allows easy
parsing and formatting of Java source files
● - https://github.com/ronmamo/reflections : Java runtime metadata analysis
#29
#30
Wait…. I want to use FXML
● I’m tired to write UI code……
● I want that take over this task to UI designer.
#31
● regular map
● defrecord
● rerify
● proxy
● gen-class
● deftype
● Virtual DOM
● Custom Type
Controller
#32
Custom Type
How to implement gen-class in Clojure.
https://github.com/clojure/clojure/blob/master/src/clj/clojure/genclass.clj
(defmacro gen-class
(generate-class options-map)
(defn- generate-class [options-map]
(let [cv (clojure.lang.Compiler/classWriter)
#33
How to implement deftype in clojure
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj
(defmacro deftype
(emit-deftype*
(defn- emit-deftype*
`(deftype*
#34
How to implement deftype in clojure
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java
static final Symbol DEFTYPE = Symbol.intern("deftype*");
ClassWriter cw
ClassVisiter cv = cw;
#35
What is ClassWriter?
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/asm/ClassWriter.java
ASM
https://github.com/consulo/objectweb-
asm/blob/master/src/main/java/org/jetbrains/org/objectweb/asm/ClassWriter.java
#36
ASM
● https://asm.ow2.io/
● ASM is an all purpose Java bytecode manipulation and analysis framework. It
can be used to modify existing classes or to dynamically generate classes,
directly in binary form.
● It can be used to modify existing classes or to dynamically generate classes,
directly in binary form
● ref:
○ https://www.infoq.com/presentations/asm-cglib-javassist-2
○ https://www.slideshare.net/ashleypuls/bytecode-manipulation
#37
bytecode
● JVM Bytecode for Dummies (and the Rest of Us Too)
○ https://www.youtube.com/watch?v=rPyqB1l4gko
#38
#39
#40
wait! insn
● Functional JVM bytecode generation for Clojure.
● https://github.com/jgpc42/insn
#41
clojurefx
● I found interesting library.
● https://github.com/zilti/clojurefx
#42
(defn load-fxml-with-controller
[filename init-fn]
(generate-controller filename init-fn)
(load-fxml filename))
#43
FXML -> input-stream -> javafx.fxml.FXMLLoader
FXML -> input-stream
-> xml/parse -> tree-seq (for finding id, handler)
-> Do Something
-> ClassLoader
#44
Do Something
cw =org.objectweb.asm.ClassWriter
.visitCode
.visitMethodInsn
.visitEnd
.visitField
.visitAnnotation
.visitEnd
.visitEnd
bytes = cw.toBytesArray
ClassLoader.getSystemClassLoader() // java.lang.ClassLoader
.defineClass(name, bytes, 0, bytes.length)
#45
How about this? defmacro fxml
(defmacro fxml [fxml-name]
….
)
(def fxml-helloworld (fxml helloworld))
#46
How about this? fxml-controller
(defmacro fxml-controller [...]
….
)
(def controller
(fxml-controller [lbl_count]
(onBtnDown [evt] …)
(onBtnUp [evt] …)))
#47
Resources
● github : https://github.com/netpyoung/pt.using-fxml-on-clojure
#48
Questions
ex) #10 - what is blabla?
#49
Thank you
50

More Related Content

What's hot

DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話
Nakazawa Yuichi
 
인생은 짧아요, 엑셀 대신 파이썬
인생은 짧아요, 엑셀 대신 파이썬인생은 짧아요, 엑셀 대신 파이썬
인생은 짧아요, 엑셀 대신 파이썬
Seung-June Lee
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Jemin Huh
 
PHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったことPHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったこと
ksimoji
 
3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
 3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ- 3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
yoshitaro yoyo
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
Nicky Bloor
 
フラットなPHPからフレームワークへ
フラットなPHPからフレームワークへフラットなPHPからフレームワークへ
フラットなPHPからフレームワークへ
Masao Maeda
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForge
CollabNet
 
EventListener使いこなし術 - Symfony勉強会#10
EventListener使いこなし術 - Symfony勉強会#10EventListener使いこなし術 - Symfony勉強会#10
EventListener使いこなし術 - Symfony勉強会#10
Yuichi Okada
 
Django의 배신(주니어 개발자의 Django 삽질기)
Django의 배신(주니어 개발자의 Django 삽질기)Django의 배신(주니어 개발자의 Django 삽질기)
Django의 배신(주니어 개발자의 Django 삽질기)
Eunhyang Kim
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説
do_aki
 
なかったらINSERTしたいし、あるならロック取りたいやん?
なかったらINSERTしたいし、あるならロック取りたいやん?なかったらINSERTしたいし、あるならロック取りたいやん?
なかったらINSERTしたいし、あるならロック取りたいやん?
ichirin2501
 
Create your React 18 / TS bundle using esbuild
Create your React 18 / TS bundle using esbuildCreate your React 18 / TS bundle using esbuild
Create your React 18 / TS bundle using esbuild
Fabio Biondi
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
Shawn Brito
 
Doxygen 사용법
Doxygen 사용법Doxygen 사용법
Doxygen 사용법
YoungSu Son
 

What's hot (20)

DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話DjangoでさくっとWeb アプリケーション開発をする話
DjangoでさくっとWeb アプリケーション開発をする話
 
인생은 짧아요, 엑셀 대신 파이썬
인생은 짧아요, 엑셀 대신 파이썬인생은 짧아요, 엑셀 대신 파이썬
인생은 짧아요, 엑셀 대신 파이썬
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
 
PHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったことPHPでWebSocketを実装してみてわかったこと
PHPでWebSocketを実装してみてわかったこと
 
3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
 3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ- 3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
3層アーキテクチャとMVCモデル -LaravelにおけるMVCモデルの流れ-
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
Nicky Bloor - BaRMIe - Poking Java's Back Door - 44CON 2017
 
フラットなPHPからフレームワークへ
フラットなPHPからフレームワークへフラットなPHPからフレームワークへ
フラットなPHPからフレームワークへ
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForge
 
EventListener使いこなし術 - Symfony勉強会#10
EventListener使いこなし術 - Symfony勉強会#10EventListener使いこなし術 - Symfony勉強会#10
EventListener使いこなし術 - Symfony勉強会#10
 
Django의 배신(주니어 개발자의 Django 삽질기)
Django의 배신(주니어 개발자의 Django 삽질기)Django의 배신(주니어 개발자의 Django 삽질기)
Django의 배신(주니어 개발자의 Django 삽질기)
 
PHP AST 徹底解説
PHP AST 徹底解説PHP AST 徹底解説
PHP AST 徹底解説
 
なかったらINSERTしたいし、あるならロック取りたいやん?
なかったらINSERTしたいし、あるならロック取りたいやん?なかったらINSERTしたいし、あるならロック取りたいやん?
なかったらINSERTしたいし、あるならロック取りたいやん?
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
Create your React 18 / TS bundle using esbuild
Create your React 18 / TS bundle using esbuildCreate your React 18 / TS bundle using esbuild
Create your React 18 / TS bundle using esbuild
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Doxygen 사용법
Doxygen 사용법Doxygen 사용법
Doxygen 사용법
 

Similar to Using FXML on Clojure

JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
Alive Kuo
 
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Ofer Cohen
 
Java 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeJava 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgrade
Simone Bordet
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
Women in Technology Poland
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
Opersys inc.
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript Developers
Juho Teperi
 
Nightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador MolinaNightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador Molina
Salvador Molina (Slv_)
 
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
Diagnosing HotSpot JVM Memory Leaks with JFR and JMCDiagnosing HotSpot JVM Memory Leaks with JFR and JMC
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
Mushfekur Rahman
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
Jorg Janke
 
Java in flames
Java in flamesJava in flames
Java in flames
Isuru Perera
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
Juho Teperi
 
Jab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedJab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealed
Ofer Cohen
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
UA Mobile
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopTamas K Lengyel
 
Making sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developersMaking sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developers
Lewiz
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
Jorg Janke
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
Ramesh Nair
 
PyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with MingPyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with Ming
Alessandro Molina
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
Linaro
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
Opersys inc.
 

Similar to Using FXML on Clojure (20)

JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
 
Java 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeJava 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgrade
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013Inside Android's UI / ABS 2013
Inside Android's UI / ABS 2013
 
Webbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript DevelopersWebbisauna - ClojureScript for Javascript Developers
Webbisauna - ClojureScript for Javascript Developers
 
Nightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador MolinaNightwatch 101 - Salvador Molina
Nightwatch 101 - Salvador Molina
 
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
Diagnosing HotSpot JVM Memory Leaks with JFR and JMCDiagnosing HotSpot JVM Memory Leaks with JFR and JMC
Diagnosing HotSpot JVM Memory Leaks with JFR and JMC
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Java in flames
Java in flamesJava in flames
Java in flames
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Jab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedJab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealed
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
 
Making sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developersMaking sense of the front-end, for PHP developers
Making sense of the front-end, for PHP developers
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
 
PyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with MingPyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with Ming
 
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation GuideBKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
BKK16-302: Android Optimizing Compiler: New Member Assimilation Guide
 
Inside Android's UI
Inside Android's UIInside Android's UI
Inside Android's UI
 

More from EunPyoung Kim

Clojure with panama
Clojure with panamaClojure with panama
Clojure with panama
EunPyoung Kim
 
On lisp ch18
On lisp ch18On lisp ch18
On lisp ch18
EunPyoung Kim
 
On lisp ch09
On lisp ch09On lisp ch09
On lisp ch09
EunPyoung Kim
 
(Lisp)
(Lisp)(Lisp)
Clojure programming study_00
Clojure programming study_00Clojure programming study_00
Clojure programming study_00
EunPyoung Kim
 
Clojure development environment
Clojure development environmentClojure development environment
Clojure development environment
EunPyoung Kim
 

More from EunPyoung Kim (6)

Clojure with panama
Clojure with panamaClojure with panama
Clojure with panama
 
On lisp ch18
On lisp ch18On lisp ch18
On lisp ch18
 
On lisp ch09
On lisp ch09On lisp ch09
On lisp ch09
 
(Lisp)
(Lisp)(Lisp)
(Lisp)
 
Clojure programming study_00
Clojure programming study_00Clojure programming study_00
Clojure programming study_00
 
Clojure development environment
Clojure development environmentClojure development environment
Clojure development environment
 

Recently uploaded

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

Using FXML on Clojure

  • 1. Using FXML on Clojure (fxml helloworld) netpyoung@gmail.com July 2018 #1
  • 2. Do you have any Questions? - If you have questions, during presentation. - message on slack #clojure-sg with page #numer. - https://clojurians.slack.com/messages/clojure-sg - ex) #10 - what is blabla? - I will answer after presentation.(for keep time) - so, I can polish this slide from your feedbacks. #2
  • 3. ● EunPyoung Kim ● KOR -> JPN -> SGP-> ??? ● Game Client Programmer. (since 2012.04 ~ ) ● I like Lisp (not only clojure) ● I’m Lazy ○ because of that I like automatation (code generate also) ○ I like macro (but don't abuse) ● I like Emacs ○ Cursive ○ (Neo)Vim….? ● https://netpyoung.github.io/ #3
  • 4. What I want & What I did. ● I want editor for future when I making game. ○ Cross platform desktop application ○ GUI designer. ● I didn’t make library. ● I just share other’s approach and my experience. #4
  • 5. Wait but why Clojure? (java,scala,kotlin...) ● I'm Game Client Programmer. I prefer typed language rather than dynamic. ● No Clojure? No Problem to me. ● But I just feel fun when I play with REPL. ● I love Lisp not only Clojure. ○ They Also love(?) Lisp. ■ https://www.slideshare.net/naughty_dog/statebased-scripting-in-uncharted-2-among- thieves ■ https://www.youtube.com/watch?v=Hbexh-Jutvs ● I also like person who love Lisp, they's way of thinking is so flexible and amazing, like language itself. ● I just choose Clojure compare each other Lisp directs. #5
  • 6. Desktop Application ● WPF ○ C#(ClojureCRL) ○ Windows only (but I like XAML. I hope it will be ported on dotnet core) ● JavaFX ○ Java(Clojure) ○ Cross Platform ○ SceneBuilder - GUI Editor ● Electron ○ Javascript(Clojurescript) ○ Cross Platform ○ gui editor?? ● qt, wxwidgets, ... #6
  • 7. JavaFX ● Sun announces JavaOne 2007 ● Open-sourced 2011 ○ http://openjdk.java.net/projects/openjfx/ ● August 2018 ○ JDK 11, Oracle is making JavaFX easier to adopt by making the technology available as a separate download, decoupled from the JDK. ○ https://blogs.oracle.com/java-platform-group/the-future-of-javafx-and-other-java-client- roadmap-updates ● I’m not sure JavaFX will be popular or not. ○ If is it possible using WPF on osx - dotnet core, I will choose ClojureCLR. #7
  • 8. FXML fxml - language - id - action scene builder controller #8
  • 13. I Need Controller but there are some issue. ● controller - @FXML attribute binding ○ binding Method ○ binding Field ○ binding initialize ● REPL driven developing ○ need to solving AOT problem #13
  • 14. #14 I Need Type for Controller
  • 15. Controller ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype #15 Skip this things (X) binding method (X) binding field
  • 16. Controller ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype #16
  • 18. gen-class ● If you want to binding field with gen-class, ○ using .java both….. ● If I incorrect, message to me I will correct that. #18
  • 19. Controller ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype #19
  • 20. #20
  • 21. deftype ● dirty.. but works…. ● I want to check fxml without relaunch application. #21
  • 22. ● (deftask build [] (comp (aot) (pom) (uber) (jar))) ● aot : Perform AOT compilation of Clojure namespaces ● pom: Create project pom.xml file ● uber: Add jar entries from dependencies to fileset ● jar: Build a jar file for the project #22
  • 23. reload ● Okay let’s boost with boot ○ https://github.com/boot-clj/boot ○ https://github.com/boot-clj/boot/pull/692 ● danielsz/system ○ https://github.com/danielsz/system #23
  • 24. #24
  • 25. It’s works ● But……. It looks so weird. ● definterface only used one per deftype ● Code structure also Dirty ○ we can avoid this problem using macro… but… Is this really valuable?? #25
  • 26. What’s the Next ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype #26
  • 27. FTW! Virtual Dom ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype ● Virtual DOM #27 Virtual DOM
  • 28. in java ● There is https://github.com/netopyr/reduxfx #28
  • 29. in clojure ● fn-fx ○ https://github.com/halgari/fn-fx ○ https://www.youtube.com/watch?v=hJ8GZxhsaVQ ● like redux, single data direction. ● Java 10 Parser and Abstract Syntax Tree for Java – https://javaparser.org ● - https://github.com/javaparser/javaparser : Java source text -> AST ● - https://github.com/forge/roaster : A Java Parser library that allows easy parsing and formatting of Java source files ● - https://github.com/ronmamo/reflections : Java runtime metadata analysis #29
  • 30. #30
  • 31. Wait…. I want to use FXML ● I’m tired to write UI code…… ● I want that take over this task to UI designer. #31
  • 32. ● regular map ● defrecord ● rerify ● proxy ● gen-class ● deftype ● Virtual DOM ● Custom Type Controller #32 Custom Type
  • 33. How to implement gen-class in Clojure. https://github.com/clojure/clojure/blob/master/src/clj/clojure/genclass.clj (defmacro gen-class (generate-class options-map) (defn- generate-class [options-map] (let [cv (clojure.lang.Compiler/classWriter) #33
  • 34. How to implement deftype in clojure https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj (defmacro deftype (emit-deftype* (defn- emit-deftype* `(deftype* #34
  • 35. How to implement deftype in clojure https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java static final Symbol DEFTYPE = Symbol.intern("deftype*"); ClassWriter cw ClassVisiter cv = cw; #35
  • 37. ASM ● https://asm.ow2.io/ ● ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or to dynamically generate classes, directly in binary form. ● It can be used to modify existing classes or to dynamically generate classes, directly in binary form ● ref: ○ https://www.infoq.com/presentations/asm-cglib-javassist-2 ○ https://www.slideshare.net/ashleypuls/bytecode-manipulation #37
  • 38. bytecode ● JVM Bytecode for Dummies (and the Rest of Us Too) ○ https://www.youtube.com/watch?v=rPyqB1l4gko #38
  • 39. #39
  • 40. #40
  • 41. wait! insn ● Functional JVM bytecode generation for Clojure. ● https://github.com/jgpc42/insn #41
  • 42. clojurefx ● I found interesting library. ● https://github.com/zilti/clojurefx #42
  • 43. (defn load-fxml-with-controller [filename init-fn] (generate-controller filename init-fn) (load-fxml filename)) #43
  • 44. FXML -> input-stream -> javafx.fxml.FXMLLoader FXML -> input-stream -> xml/parse -> tree-seq (for finding id, handler) -> Do Something -> ClassLoader #44
  • 45. Do Something cw =org.objectweb.asm.ClassWriter .visitCode .visitMethodInsn .visitEnd .visitField .visitAnnotation .visitEnd .visitEnd bytes = cw.toBytesArray ClassLoader.getSystemClassLoader() // java.lang.ClassLoader .defineClass(name, bytes, 0, bytes.length) #45
  • 46. How about this? defmacro fxml (defmacro fxml [fxml-name] …. ) (def fxml-helloworld (fxml helloworld)) #46
  • 47. How about this? fxml-controller (defmacro fxml-controller [...] …. ) (def controller (fxml-controller [lbl_count] (onBtnDown [evt] …) (onBtnUp [evt] …))) #47
  • 48. Resources ● github : https://github.com/netpyoung/pt.using-fxml-on-clojure #48
  • 49. Questions ex) #10 - what is blabla? #49

Editor's Notes

  1. println “helloworld” 출력하는거 표시해주자
  2. for understanding FXML, U need to learn this 3 kind of things
  3. Today is maybe my last day to attend this seminar