SlideShare uma empresa Scribd logo
1 de 62
Baixar para ler offline
How Building GUI App with Lisp
The Case of Pocket Change, Inc.
LISP MEETUP #50 Mar 27, 2017
I’m Eitaro Fukamachi
@nitro_idiot fukamachi
Joined Pocket Change in Feb 1
Pocket Change
http://www.pocket-change.jp
Available at Haneda Airport
Today’s topic
What I want to tell today
What I don’t tell
How we use Common Lisp in our work
How you can use Common Lisp in your work
Touch Screen
Coins Bills
IC Card Reader
Receipt Printer
API Server
Touch Screen
Coins Bills
IC Card Reader
Receipt Printer
API Server
Building the next version of this software
is my work.
How to build
Pocket Change
• Windows OS (Rich!)
• Fullscreen GUI application
We decided to use Electron
https://electron.atom.io
by
Web Server
(Express)
Main Process
(Node.js)
Open
Web Server
(Express)
Main Process
(Node.js)
Open
Web Server
(Express)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Open
Web Server
(Express)
Main Process
(Node.js)
Bidirectional Communication
Renderer Process
(Chromium)
React.js
Why Electron?
• Easy to deploy
• Can package into a single EXE installer
• Can build GUI with Web technologies
• Embedded Chromium
However
The language is JavaScript. 👎
Why can’t we use Common Lisp?
None
(just a launcher)
Main Process
(Node.js)
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Spawn
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Common Lisp Process
(SBCL)
Spawn
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Common Lisp Process
(SBCL)
Spawn
Bidirectional Communication
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Common Lisp Process
(SBCL)
Spawn
Bidirectional Communication
+ Common Lisp
Make an SBCL executable and bundle it
Looks a quite easy trick, huh? :)
How communicating
between CL and Browser
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Common Lisp Process
(SBCL)
Spawn
Bidirectional Communication
+ Common Lisp
Open
None
(just a launcher)
Main Process
(Node.js)
Renderer Process
(Chromium)
React.js
Common Lisp Process
(SBCL)
Spawn
Bidirectional Communication
+ Common Lisp
Communication between CL and Browser
• MUST be bidirectional
• MUST be asynchronous
• MUST be easy to handle with JavaScript
• SHOULD be real-time
We decided to use JSON-RPC
• Small specification
• Not depends on a specific transport layer
• We use WebSocket
• http://jsonrpc.org
• https://github.com/fukamachi/jsonrpc
JSON-RPC
--> {"jsonrpc": “2.0",
"method": “subtract",
"params": [42, 23],
"id": 1}
Request
JSON-RPC
--> {"jsonrpc": “2.0",
"method": “subtract",
"params": [42, 23],
"id": 1}
Request
<-- {"jsonrpc": “2.0",
"result": 19,
"id": 1}
Response
JSON-RPC
--> {"jsonrpc": “2.0",
"method": “subtract",
"params": [42, 23],
"id": 1}
Request
<-- {"jsonrpc": “2.0",
"result": 19,
"id": 1}
Response
--> {"jsonrpc": “2.0",
"method": “update",
"params": [1,2,3,4,5]}
Notification
(Request without “id”)
How to structure
GUI Application with Electron
No best practices (yet)
to build an Electron app.
In our case
Renderer Process
Store
View
ActionReducer
Flux Architecture
functionfunctionfunctionfunction
functionfunctionfunctionfunctionfunctionfunctionfunction
Renderer Process
Store
View
ActionReducer
Flux Architecture
Common Lisp
JSON-RPC server
functionfunctionfunction
functionfunctionfunction
← JSON-RPC over WebSocket →
Not only
Browser Common Lisp
Coin Counter IC Card Reader Printer
API Server
Benefits of Flux + JRPC Architecture
• JavaScript part is just a UI renderer
• Business logics are all in Common Lisp
• Common Lisp functions are easy to test
• Other components are also easy to test
• Because they all talk in JSON-RPC
How to develop the app
Development
• You can use your machine (Mac, Linux, etc)
• Virtual devices are used while development
• Easy to make a mock of components
Development
1. Run a Electron process (npm run dev)
2. Open REPL of the Common Lisp process

from Emacs with Swank
3. Enjoy
Packaging
1. Run Windows in Virtual Environment
2. npm run package
3. Wait
Experiments
Coin Counter IC Card Reader Printer
API Server
Coin Counter IC Card Reader Printer
API Server
Hard to share data.
“brain”, the central storage
• All data(state) are in Common Lisp part
• What service the user chose?
• How much money is in the user’s IC card?
• How many coins are in?
• etc.
• It’s just a hash-table (with thread-lock).
“Propagation Class”
Metaclass for synchronize data between components
“Propagation Class”
(defclass user ()
((balance :initarg :balance
:accessor user-balance)
(coins :initarg :coins
:accessor user-coins))
(:metaclass propagation-class))
“Propagation Class”
(defclass user ()
((balance :initarg :balance
:accessor user-balance)
(coins :initarg :coins
:accessor user-coins))
(:metaclass propagation-class))
(defmethod on-update ((user user)
slot-name)
(declare (ignore slot-name))
(notify “browser”
“user/update-state” user))
“Propagation Class”
(defvar *user*
(make-instance ‘user …)))
;; Notify this modification
;; to the browser implicitly.
(setf (user-balance *user*) 1730)
Bless the Meta Object Protocol.
So,
Why Common Lisp?
Why Common Lisp?
• We ♥ Common Lisp :)
• Good for writing unknown/complicated
applications.
• Interactive development with REPL.
Thanks.

Mais conteúdo relacionado

Mais procurados

超簡単!TELNETの話
超簡単!TELNETの話超簡単!TELNETの話
超簡単!TELNETの話
ogatay
 
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVMState: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
Jonas Bonér
 

Mais procurados (20)

Node.jsで使えるファイルDB"NeDB"のススメ
Node.jsで使えるファイルDB"NeDB"のススメNode.jsで使えるファイルDB"NeDB"のススメ
Node.jsで使えるファイルDB"NeDB"のススメ
 
モバイルアプリの高速で安定したビルドを支えるJenkins運用術
モバイルアプリの高速で安定したビルドを支えるJenkins運用術モバイルアプリの高速で安定したビルドを支えるJenkins運用術
モバイルアプリの高速で安定したビルドを支えるJenkins運用術
 
Openlink Virtuoso v01
Openlink Virtuoso v01Openlink Virtuoso v01
Openlink Virtuoso v01
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
 
レシピの作り方入門
レシピの作り方入門レシピの作り方入門
レシピの作り方入門
 
超簡単!TELNETの話
超簡単!TELNETの話超簡単!TELNETの話
超簡単!TELNETの話
 
IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本IoT向けプラットフォーム「SORACOM」とは? 他2本
IoT向けプラットフォーム「SORACOM」とは? 他2本
 
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
PHP初心者セッション2023 〜ChatGPT時代の簡単な始め方〜
 
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVMState: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM
 
Mac から Python で BLE ペリフェラルを操作する
Mac から Python で BLE ペリフェラルを操作するMac から Python で BLE ペリフェラルを操作する
Mac から Python で BLE ペリフェラルを操作する
 
ペアプロするならgit-duetを使おう
ペアプロするならgit-duetを使おうペアプロするならgit-duetを使おう
ペアプロするならgit-duetを使おう
 
ROS.js の紹介
ROS.js の紹介ROS.js の紹介
ROS.js の紹介
 
Skywayのビデオチャットを録画しよう。そう、ブラウザでね
Skywayのビデオチャットを録画しよう。そう、ブラウザでねSkywayのビデオチャットを録画しよう。そう、ブラウザでね
Skywayのビデオチャットを録画しよう。そう、ブラウザでね
 
HTTP/2 入門
HTTP/2 入門HTTP/2 入門
HTTP/2 入門
 
MySQLアンチパターン
MySQLアンチパターンMySQLアンチパターン
MySQLアンチパターン
 
SQL Server 資料庫版本控管
SQL Server 資料庫版本控管SQL Server 資料庫版本控管
SQL Server 資料庫版本控管
 
Apache Hadoopの未来 3系になって何が変わるのか?
Apache Hadoopの未来 3系になって何が変わるのか?Apache Hadoopの未来 3系になって何が変わるのか?
Apache Hadoopの未来 3系になって何が変わるのか?
 
NGINXをBFF (Backend for Frontend)として利用した話
NGINXをBFF (Backend for Frontend)として利用した話NGINXをBFF (Backend for Frontend)として利用した話
NGINXをBFF (Backend for Frontend)として利用した話
 
PHPの今とこれから2023
PHPの今とこれから2023PHPの今とこれから2023
PHPの今とこれから2023
 
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
 

Destaque

Destaque (8)

こまった時のOpenJump(デジタイジング編)
こまった時のOpenJump(デジタイジング編)こまった時のOpenJump(デジタイジング編)
こまった時のOpenJump(デジタイジング編)
 
FOSS4Gで地理院タイルを使ってみよう!
FOSS4Gで地理院タイルを使ってみよう!FOSS4Gで地理院タイルを使ってみよう!
FOSS4Gで地理院タイルを使ってみよう!
 
CVPR2017 参加報告 速報版 本会議 1日目
CVPR2017 参加報告 速報版 本会議 1日目CVPR2017 参加報告 速報版 本会議 1日目
CVPR2017 参加報告 速報版 本会議 1日目
 
Cvpr2017事前読み会
Cvpr2017事前読み会Cvpr2017事前読み会
Cvpr2017事前読み会
 
JP Chaosmap 2015-2016
JP Chaosmap 2015-2016JP Chaosmap 2015-2016
JP Chaosmap 2015-2016
 
ドライバハッキング。UMPC、Windowsタブレット にLinux、*BSDを入れて遊ぼう  2017年度京都版 #osckyoto
ドライバハッキング。UMPC、Windowsタブレット にLinux、*BSDを入れて遊ぼう  2017年度京都版 #osckyotoドライバハッキング。UMPC、Windowsタブレット にLinux、*BSDを入れて遊ぼう  2017年度京都版 #osckyoto
ドライバハッキング。UMPC、Windowsタブレット にLinux、*BSDを入れて遊ぼう  2017年度京都版 #osckyoto
 
ICCV2017一人読み会
ICCV2017一人読み会ICCV2017一人読み会
ICCV2017一人読み会
 
Hacking with x86 Windows Tablet and mobile devices on openSUSE #opensuseasia17
 Hacking with x86 Windows Tablet and mobile devices on openSUSE #opensuseasia17 Hacking with x86 Windows Tablet and mobile devices on openSUSE #opensuseasia17
Hacking with x86 Windows Tablet and mobile devices on openSUSE #opensuseasia17
 

Semelhante a Building GUI App with Electron and Lisp

Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
nohuhu
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Ruben Tan
 
Concerto conmoto
Concerto conmotoConcerto conmoto
Concerto conmoto
mskmoorthy
 

Semelhante a Building GUI App with Electron and Lisp (20)

Metarhia: Node.js Macht Frei
Metarhia: Node.js Macht FreiMetarhia: Node.js Macht Frei
Metarhia: Node.js Macht Frei
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)Reaktive Programmierung mit den Reactive Extensions (Rx)
Reaktive Programmierung mit den Reactive Extensions (Rx)
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
Surge2012
Surge2012Surge2012
Surge2012
 
Node js
Node jsNode js
Node js
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Node.js
Node.jsNode.js
Node.js
 
Quick look in Reactive Extensions
Quick look in Reactive ExtensionsQuick look in Reactive Extensions
Quick look in Reactive Extensions
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromqDistributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
 
18_Node.js.ppt
18_Node.js.ppt18_Node.js.ppt
18_Node.js.ppt
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015RxJS and Reactive Programming - Modern Web UI - May 2015
RxJS and Reactive Programming - Modern Web UI - May 2015
 
Cytoscape CI Chapter 2
Cytoscape CI Chapter 2Cytoscape CI Chapter 2
Cytoscape CI Chapter 2
 
Concerto conmoto
Concerto conmotoConcerto conmoto
Concerto conmoto
 
What we do with Go
What we do with GoWhat we do with Go
What we do with Go
 
OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012OpenShift with Eclipse Tooling - EclipseCon 2012
OpenShift with Eclipse Tooling - EclipseCon 2012
 

Mais de fukamachi

Clack & Caveman
Clack & CavemanClack & Caveman
Clack & Caveman
fukamachi
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
fukamachi
 

Mais de fukamachi (18)

競プロの話
競プロの話競プロの話
競プロの話
 
Rove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common LispRove / Testing is a pity in Common Lisp
Rove / Testing is a pity in Common Lisp
 
SBLint
SBLintSBLint
SBLint
 
Mito, a successor of Integral
Mito, a successor of IntegralMito, a successor of Integral
Mito, a successor of Integral
 
Clack: glue for web apps
Clack: glue for web appsClack: glue for web apps
Clack: glue for web apps
 
Woo: Writing a fast web server
Woo: Writing a fast web serverWoo: Writing a fast web server
Woo: Writing a fast web server
 
Writing a fast HTTP parser
Writing a fast HTTP parserWriting a fast HTTP parser
Writing a fast HTTP parser
 
Redesigning Common Lisp
Redesigning Common LispRedesigning Common Lisp
Redesigning Common Lisp
 
Integral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common LispIntegral - New O/R Mapper for Common Lisp
Integral - New O/R Mapper for Common Lisp
 
Shelly
ShellyShelly
Shelly
 
第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」第四回関西Emacs「ari.el」
第四回関西Emacs「ari.el」
 
Clack & Caveman
Clack & CavemanClack & Caveman
Clack & Caveman
 
Lispで仕事をするために
Lispで仕事をするためにLispで仕事をするために
Lispで仕事をするために
 
Lisperの見る世界
Lisperの見る世界Lisperの見る世界
Lisperの見る世界
 
Lisp Poetry
Lisp PoetryLisp Poetry
Lisp Poetry
 
JavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へJavaからClojure、そして夢の世界へ
JavaからClojure、そして夢の世界へ
 
自分をClojure化する方法
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
 
Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)Google App Engine for Java (手嶋屋勉強会)
Google App Engine for Java (手嶋屋勉強会)
 

Último

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Building GUI App with Electron and Lisp