SlideShare a Scribd company logo
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
Building GUI App with Electron and Lisp
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
Building GUI App with Electron and 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.

More Related Content

What's hot (20)

PDF
PHP、おまえだったのか。 いつもHTTPメッセージを 運んでくれたのは。
sasezaki
 
PPTX
Basic HTML
coachhahn
 
PDF
Xeon PhiとN体計算コーディング x86/x64最適化勉強会6(@k_nitadoriさんの代理アップ)
MITSUNARI Shigeo
 
PDF
Firebase Authを Nuxt + Railsの自前サービス に導入してみた
Tomoe Sawai
 
PPT
A Deeper look into Javascript Basics
Mindfire Solutions
 
PDF
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
PPT
Span and Div tags in HTML
Biswadip Goswami
 
PDF
決済サービスのSpring Bootのバージョンを2系に上げた話
Ryosuke Uchitate
 
PDF
Laravel echo + vue.js + axiosで簡単チャットアプリ開発
宜浩 香月
 
PDF
FlutterをRenderObjectまで理解する
KeisukeKiriyama
 
PDF
Laravel の paginate は一体何をやっているのか
Shohei Okada
 
PPTX
Node.jsで使えるファイルDB"NeDB"のススメ
Isamu Suzuki
 
PDF
BigQuery의 모든 것(기획자, 마케터, 신입 데이터 분석가를 위한) 입문편
Seongyun Byeon
 
PDF
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
PDF
JavaScript Fetch API
Xcat Liu
 
PDF
関数プログラミング入門
Hideyuki Tanaka
 
PPTX
Javascript Prototype Visualized
军 沈
 
PDF
バイトコードって言葉をよく目にするけど一体何なんだろう?(JJUG CCC 2022 Spring 発表資料)
NTT DATA Technology & Innovation
 
PDF
ワタシはSingletonがキライだ
Tetsuya Kaneuchi
 
PDF
Introduction httpClient on Java11 / Java11時代のHTTPアクセス再入門
tamtam180
 
PHP、おまえだったのか。 いつもHTTPメッセージを 運んでくれたのは。
sasezaki
 
Basic HTML
coachhahn
 
Xeon PhiとN体計算コーディング x86/x64最適化勉強会6(@k_nitadoriさんの代理アップ)
MITSUNARI Shigeo
 
Firebase Authを Nuxt + Railsの自前サービス に導入してみた
Tomoe Sawai
 
A Deeper look into Javascript Basics
Mindfire Solutions
 
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
Span and Div tags in HTML
Biswadip Goswami
 
決済サービスのSpring Bootのバージョンを2系に上げた話
Ryosuke Uchitate
 
Laravel echo + vue.js + axiosで簡単チャットアプリ開発
宜浩 香月
 
FlutterをRenderObjectまで理解する
KeisukeKiriyama
 
Laravel の paginate は一体何をやっているのか
Shohei Okada
 
Node.jsで使えるファイルDB"NeDB"のススメ
Isamu Suzuki
 
BigQuery의 모든 것(기획자, 마케터, 신입 데이터 분석가를 위한) 입문편
Seongyun Byeon
 
JavaScript - Chapter 7 - Advanced Functions
WebStackAcademy
 
JavaScript Fetch API
Xcat Liu
 
関数プログラミング入門
Hideyuki Tanaka
 
Javascript Prototype Visualized
军 沈
 
バイトコードって言葉をよく目にするけど一体何なんだろう?(JJUG CCC 2022 Spring 発表資料)
NTT DATA Technology & Innovation
 
ワタシはSingletonがキライだ
Tetsuya Kaneuchi
 
Introduction httpClient on Java11 / Java11時代のHTTPアクセス再入門
tamtam180
 

Viewers also liked (8)

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

Similar to Building GUI App with Electron and Lisp (20)

PDF
Electron Firenze 2020: Linux, Windows o MacOS?
Denny Biasiolli
 
PDF
Electron: Linux, Windows or Macos?
Commit University
 
PPTX
Learn Electron for Web Developers
Kyle Cearley
 
PPTX
Electron - cross platform desktop applications made easy
Ulrich Krause
 
PDF
Developing Desktop Apps with Electron & Ember.js - FITC WebU2017
Aidan Nulman
 
PPTX
Lisp in the Cloud
Mike Travers
 
PDF
Developing Desktop Apps with Electron & Ember.js
FITC
 
PDF
Building a Desktop Streaming console with Node.js and WebKit
Emanuele Rampichini
 
PDF
Power-up services with gRPC
The Software House
 
KEY
Dcjq node.js presentation
async_io
 
PPTX
Bringing Javascript to the Desktop with Electron
Nir Noy
 
PDF
gRPC or Rest, why not both?
Mohammad Murad
 
PDF
What do you need to know about g rpc on .net
Moon Technolabs Pvt. Ltd.
 
PDF
Electron
ITCP Community
 
PDF
Node.js, toy or power tool?
Ovidiu Dimulescu
 
PDF
Node js javascript no lado do servidor
Mauricio Vieira
 
PDF
Electron
Mark Lechtermann
 
PDF
Nodejsexplained 101116115055-phpapp02
Sunny Gupta
 
PDF
Nodejs Explained with Examples
Gabriele Lana
 
PDF
Writing Rust Command Line Applications
All Things Open
 
Electron Firenze 2020: Linux, Windows o MacOS?
Denny Biasiolli
 
Electron: Linux, Windows or Macos?
Commit University
 
Learn Electron for Web Developers
Kyle Cearley
 
Electron - cross platform desktop applications made easy
Ulrich Krause
 
Developing Desktop Apps with Electron & Ember.js - FITC WebU2017
Aidan Nulman
 
Lisp in the Cloud
Mike Travers
 
Developing Desktop Apps with Electron & Ember.js
FITC
 
Building a Desktop Streaming console with Node.js and WebKit
Emanuele Rampichini
 
Power-up services with gRPC
The Software House
 
Dcjq node.js presentation
async_io
 
Bringing Javascript to the Desktop with Electron
Nir Noy
 
gRPC or Rest, why not both?
Mohammad Murad
 
What do you need to know about g rpc on .net
Moon Technolabs Pvt. Ltd.
 
Electron
ITCP Community
 
Node.js, toy or power tool?
Ovidiu Dimulescu
 
Node js javascript no lado do servidor
Mauricio Vieira
 
Nodejsexplained 101116115055-phpapp02
Sunny Gupta
 
Nodejs Explained with Examples
Gabriele Lana
 
Writing Rust Command Line Applications
All Things Open
 
Ad

More from fukamachi (20)

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

Recently uploaded (20)

PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 

Building GUI App with Electron and Lisp