Native Mobile Apps with Clojure(Script) Chris Vermilion [email protected] Boston Clojure Meetup 9/10/15

Why Clojure for mobile? •

Maybe you like Clojure!



Maybe you have a smartphone and want to use it!



Something something functional something immutability



Code as data is an interesting model for a cloudupdatable app!

Possible approaches

Pure Clojure/ ClojureScript = mobile web

ClojureScript + JS-native bridge = hybrid app

Clojure + (some kind of dark magic) = native app

Possible approaches Decreasing obviousness

Pure Clojure/ ClojureScript = mobile web

Increasing difficulty

ClojureScript + JS-native bridge = hybrid app

Clojure + (some kind of dark magic) = native app

Possible approaches

Pure Clojure/ ClojureScript = mobile web

Not going to cover this one

ClojureScript + JS-native bridge = hybrid app

Clojure + (some kind of dark magic) = native app

Possible approaches

Pure Clojure/ ClojureScript = mobile web

ClojureScript + X = hybrid app Lots of choices for “X”: PhoneGap, Cordova, etc. New hotness: React Native

Clojure + (some kind of dark magic) = native app

Possible approaches

Pure Clojure/ ClojureScript = mobile web

ClojureScript + X = hybrid app

Clojure + RoboVM (iOS)/ various (Android) = native app

Android’s already Java. On iOS, compile Java bytecode to clang somehow?

More on Clojure+Android http://clojure-android.info/

Things I know about Clojure on Android: 1) It can be done.

RoboVM “Create truly native iOS apps in Java”

Two things make this possible:



Java bytecode to x86/ARM compiler



Objective-C -> Java bindings for Cocoa libraries

Cool story, Bro.

Bro: Java bindings to C/Objective-C code http://docs.robovm.com/advanced-topics/bro.html

Gets hairy quickly…



Whole NSArray wrapper is ~400 LOC (and only covers the basic methods)

https://github.com/robovm/robovm/blob/master/cocoatouch/src/main/java/org/robovm/apple/foundation/NSArray.java

RoboPods should make this easier… — just drop a dependency in Gradle/Maven and you’re good to go

So what?

Bottom line: RoboVM lets you treat Android and iOS as two (different!) JVM platforms.

This is a double-edged sword!

Great power: •

At the end of the day, you have a compiled app.



Real native access to anything you want.



100% (in principle) native feature coverage, pretty good JVM (and Clojure) feature coverage.

Great responsibility: •

Bindings are ugly and you might have to write some.



UI code is all platform specific!

Parting thoughts 1. RoboVM is a really interesting way to get totally native access with a JVM language. 2. It’s more about language portability that app portability. RoboVM gives you Java access to iOS libraries, not an abstraction on top of iOS/Android. 3. Dev cycle of edit/compile/test/simulate is pretty slow and painful. May improve? 4. RoboVM as a product is young, immature. Maybe growing?

“Hybrid”: web-like portability, native bindings when you need them

“Hybrid”: web-like portability, native bindings when you need them

Why React? Why React Native?

Why React? Why React Native?

Honest answer: This is my talk and that’s what I’ve used!

Why React? Why React Native?



Virtual DOM, performance, Facebook backing, etc.



Good Clojure uptake (Om/Reagent/Quiescent) [Why? Immutability maps well to React model!]



React Native then gives access to native bindings when needed



May or may not be a good tradeoff, depending on what you want native for!

Why hybrid instead of compiled?



Maybe you just like JavaScript! •





Use JS, webby language for describing UI •

=> UI code is actually portable



=> Flipside: UI code doesn’t nec. “feel native”

Only need to go native when you need/want to •



Threads are overrated anyway.

=> BUT “lowest common denominator” UI abstractions

Way faster dev cycle: simple autorefresh, etc.

OK, shut up and show me something.

https://github.com/dmotz/natal

Final thoughts The right tool for native development depends on why you want native in the first place. Reasons you might want compiled/Clojure •

Lots of complicated native functionality, in lots of places in your code



Non-UI code dominates, want it to be performant (games, eg)



Native controls/look-and-feel is a priority

Reasons you might want hybrid/ClojureScript •

UI is the most important/frequently changing code, want portability



Web-like UI is what you want (maybe also you want a web client!)



Dev speed/tooling is a priority



Vendor-dependency makes you nervous

Resources RoboVM: http://robovm.com/ Clojure+Android links: http://clojure-android.info/ React Native: https://facebook.github.io/react-native/ ClojureScript+React Native bootstrapper: https://github.com/dmotz/natal ClojureScript + iOS REPL: https://github.com/omcljs/ambly ClojureScript + RN + Reagent example project: https://github.com/mfikes/reagent-react-native

Boston Clojure Meetup -

“Create truly native iOS apps in Java”. Two things ... http://docs.robovm.com/advanced-topics/bro.html ... libraries, not an abstraction on top of iOS/Android. 3. ... The right tool for native development depends on why you want native in the first.

1MB Sizes 2 Downloads 287 Views

Recommend Documents

Boston Clojure Meetup -
mobile web. ClojureScript. +. X. = hybrid app. Clojure. +. RoboVM (iOS)/ various (Android). = native app. Android's already Java. On. iOS, compile Java bytecode ...

www.FlamesOfWar.com - Meetup
Jul 14, 2012 - Outpost, demolish bridges with an Engineer Combat Company, ..... Support platoons can be of any variant type and do not have to be from the ...

Clojure & JRuby - GitHub
Clojure likes one big process, lots of threads. • Ruby prefers lots of small ... Duplication. • DB connections. • DB models. • Test data. Monday, March 19, 12 ...

Clojure and Android - GitHub
Improving the Clojure/Android experience. Closing thoughts. Page 5. Clojure and. Android. Daniel Solano. Gómez. Android and the. Dalvik VM ... Page 10 ...

Sylabs MeetUp -
Feb 22, 2018 - Dial(for higher quality, dial a number based on your current location):. US: +1 408 638 0968 or +1 646 876 9923 or +1 669 900 6833. Meeting ID: 148 587 480. International numbers available: https://zoom.us/zoomconference?m=kOPw3VPmJXA_

Clojure for Beginners - GitHub
Preview. Language. Overview. Clojure Basics & .... (clojure.java.io/reader file))]. (doseq [line .... Incremental development via REPL ⇒ less unexpected surprises ...

Chef-provisioning-Tokyo-meetup-feb.pdf
Connect more apps... Try one of the apps below to open or edit this item. Chef-provisioning-Tokyo-meetup-feb.pdf. Chef-provisioning-Tokyo-meetup-feb.pdf.

Dan Dietz Greenville Django + Python Meetup - GitHub
Awaken your home: Python and the. Internet of Things. PyCon 2016. • Architecture. • Switch programming. • Automation component. Paulus Schoutsen's talk: ...

Poll "Code4Lib Chicago 2015 Fall Meetup" - Groups
Sep 1, 2015 - November 2015. December 2015. Fri 13. Mon 16. Fri 20. Mon 23. Tue 24. Thu 3. Allan Berry, UIC. OK. OK. OK. OK. OK. OK. Jeremy Prevost ...

Meetup-20160727-SM-Ansible-Rollout.pdf
Loading… Page 1. Whoops! There was a problem loading more pages. Meetup-20160727-SM-Ansible-Rollout.pdf. Meetup-20160727-SM-Ansible-Rollout.pdf.

Meetup-20160727-MK-Ansible-Einfuehrung.pdf
Python 2.6 oder 2.7. •. „managed node“: Unix (auch Windows). – Python 2.5. – Python 2.4 mit python-simplejson. – (libselinux-python). Whoops! There was a ...

Learn Python the Hard Way - Meetup
By going through this book and copying each example exactly, you will be training your brain to ... music theory, ear training, songs, and anything else I can. ...... give to a human. You print them, save them to files, send them to web servers, all

Cloud Security Meetup 30012017.pdf
Loading… Page 1. Whoops! There was a problem loading more pages. Cloud Security Meetup 30012017.pdf. Cloud Security Meetup 30012017.pdf. Open.

20160513-Docker Meetup-uploaded.pdf
Whoops! There was a problem loading more pages. 20160513-Docker Meetup-uploaded.pdf. 20160513-Docker Meetup-uploaded.pdf. Open. Extract. Open with.

VOTO Mobile Director of Programs - Meetup
We also have an API used to power existing mobile service providers. ... University, McKinsey&Company, the Bill & Melinda Gates Foundation, Esoko, Facebook ...

20160513-Docker Meetup-uploaded.pdf
Page 1 of 24. RANCHER & CONTINUOUS DELIVERY. DockerGrunn #6. Johan van der Geest. Edwin Harmsma. Page 1 of 24 ...

VOTO Mobile Director of Programs - Meetup
Bachelors degree required, Master degree preferred. • Experience living and working in your desired country of activity. • Experience of 2+ years in as many of ...

Download Professional Clojure Full eBook
Web Development with Clojure: Build Bulletproof Web Apps with Less Code · The Joy of ... Mastering Clojure Macros: Write Cleaner, Faster, Smarter Code.

Download Programming Clojure Full Books
Mastering Clojure Macros: Write Cleaner, Faster, Smarter Code · Building Microservices · Structure and Interpretation of Computer Programs, 2nd Edition (MIT ...

boston - MOBILPASAR.COM
Oct 17, 2012 - These maps show the dramatic territory changes in North America before and after the French and. Indian War. GREAT. BRITAIN. ATLANTIC ..... hang in effigy the Boston merchant Andrew Oliver, who had been appointed the royal stamp distri

The Boston Globe.pdf
Robin Lane benefits from Pearl Jam's largesse - The Boston Globe.pdf. Robin Lane benefits from Pearl Jam's largesse - The Boston Globe.pdf. Open. Extract.

Boston Consulting Group
Feb 3, 2018 - Programmatic guaranteed brings the power of automation to direct sales. ... realizing big benefits, but full implementation of programmatic guaranteed re- .... vertising, BCG Focus, May 2013; and Improving Engagement and ... from PDF sc

Boston Agenda.pdf
Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Boston Agenda.pdf. Boston Age