Fork me on GitHub
#untangled
<
2016-12-15
>
keatondunsford04:12:34

I think I know the answer(s), but it’s been a while since I’ve touched on CLJS stuff and I’d like to hear it from you guys, since you’ve been committing so much time towards building a framework to make Om Next succeed: What does Om Next buy you that Reagent doesn’t? Performance wise, “simplicity” wise, query wise, etc. As the Reagent guys point out themselves, they’re very “buzzword-compliant”. And it’s certainly better than Redux by default. But I’m still trying to wrap my head around Redux vs. Relay or Reagent vs. Om Next.

keatondunsford05:12:30

@ianchow That was exactly what I was looking for. Thank you!

mitchelkuijpers08:12:14

I will turn that story into a more coherent thing and put it in a blog @keatondunsford @ianchow 😄

tony.kay16:12:50

@keatondunsford In my opinion, I'd sum it up as: Om Next makes applications simpler in-the-large. Any webdev system is easy/simple in the small. Start mixing in all of the complications larger applications run into and you find yourself wanting to put your eyes out every time you look at code. Untangled makes some of the necessary decisions that Om Next leaves open, making the use easier. So, Untangled is aimed at that sweet spot of minimal incidental complexity, maximal ease. There is a learning curve...so don't mistake that part for the ease 😉

tony.kay16:12:09

nothing anyone can do about needing to learn in this profession

tony.kay16:12:30

at least until we have the complete set of software legos 😉

keatondunsford16:12:04

Totally, and I love that. I’m totally sold and have been for months. Just need to come up with a way to convince my new team to embrace Om.

tony.kay16:12:39

sadly I've found the hardest problem is the interest in learning. If you can get them to do the getting started videos and the dev guide exercises, then you have a chance.

tony.kay16:12:21

If you're trying to show examples and convince them, you'll likely fail. They have to get their hands dirty to get it....it is just too different from everything else. FP + co-located queries + rendering as a pure function + graph database on the client + ...

keatondunsford16:12:34

Luckily my startup chose to use React and Flux for their MVP, so they’re at least in the ballpark. Also, our product is pretty unique and literally functional by nature. I’m now working for Urbit. Urbit’s building a “personal server” that’s as easy to use as an iPhone on top of a clean-slate functional operating system running on an combinator interpreter whose spec gzips to 340 bytes.

tony.kay16:12:04

I mean, you should be having discussions about how this-or-that compares in the long-term maintenance, testability. Maybe a discussion on the pros/cons of cljs itself. Instead you end up talking about isolated features in small contexts because no one knows enough to talk about the large.

keatondunsford16:12:10

The entire OS is built in a purely functional language we created, called Hoon, which is like Haskell without category theory.

tony.kay16:12:56

@keatondunsford well, then you at least are in the ballpark 🙂 Way ahead of most, and having done a lot more work than we have, probably. We just assembled the parts.

keatondunsford16:12:02

On the frontend, we’re essentially making the browser the UI, and need a strong API to be able to build frontends that interface with your Urbit. It seems obvious, if we’re going to redo the whole thing, to move in the GraphQL direction. And it makes even more sense to move in the CLJS direction. Hence, Om Next.

keatondunsford16:12:38

Btw if anyone is interested in this, I made an #urbit channel here in the Slack. Urbit is a ridiculously cool project, and we need more frontend contributors. I’m spearheading the frontend initiative.

keatondunsford16:12:48

(shameless plug)

tony.kay16:12:54

So, since your staff already "gets" FP, it should really be a pretty easy sell. What kind of resistance are you getting?

tony.kay16:12:40

some of the key things that raised our eyebrows were: Bruce Hauman's talk/demo on figwheel (showing hot code reload in running apps), his devcards stuff (I need to make a video on how we use it...so cool), the idea of rendering as a pure function (which react + fp + immutable data leads to).

tony.kay16:12:00

Getting a "support VCR viewer" for nearly free.

tony.kay16:12:37

clj/cljs (one language and data format for front, back, and network xmit)

tony.kay16:12:06

elimination of controllers, REST, explicit plumbing, state in the UI (Untangled provides plumbing and some add-ons Om Next leaves unspecified)

tony.kay16:12:14

LISP homoiconic: macros rock when you need them. Other languages suck at this.

tony.kay16:12:28

Ability to write a specification framework that can render on any number of browsers at once (untangled-spec). The combo of cljs.test, clojure.test, figwheel, and a little bit of glue code led to a very nice result for testing. Works on server same way.

tony.kay17:12:04

Possible to write all nearly everything as pure functions, which are much easier to test (when written well)

tony.kay17:12:13

open source language and libraries all on JVM and JSVM.

tony.kay17:12:35

clj/cljs popular enough to not be too risky

tony.kay17:12:13

Full interop with React, though you want to be careful what you import, because...you know...state 🙂

tony.kay17:12:23

Tends to encourage job applicants that are excited about learning and FP...which is a big plus IMHO

tony.kay17:12:23

Really good developer tooling for an alternative language: (Cursive or NREPL + vim/emacs)

tony.kay17:12:55

Dynamic language with great interactive dev support: REPL, figwheel, devcards, live updates of specs, IDE features like refactoring, navigation, structural editing.

tony.kay17:12:39

Google closure compiler integration/optimization/minification/modules

tony.kay17:12:31

And that's just a list of features....like I said, there are also a lot of real benefits in-the-large.

currentoor18:12:59

@keatondunsford all of these points are great (especially for people that already believe them) but it’s so hard to convince people with rhetoric alone IMO

tony.kay18:12:16

yep...that's why I said get your hands dirty

currentoor18:12:29

at my company i just went ahead and made a prototype of the product we were going to build in my own time

currentoor18:12:34

using om next

currentoor18:12:37

then after showing off a prototype that had promise, it was easy to ask for a one week spike to see how far we could get and how the team would feel about it, most of that week was spent with me doing hands on teaching

currentoor18:12:23

maybe you could try building a prototype first also?

currentoor18:12:42

i think that was main catalyst for us

tony.kay18:12:15

I'd highly recommend using Untangled for the prototyping...otherwise you'll get bogged down in the weeds

currentoor18:12:28

^ this is so true

currentoor18:12:21

IMO it’s best to fork a working full stack demo project of untangled (TODO list mvc maybe?) and go from there

keatondunsford18:12:08

I can definitely work on a kind of prototype. That sounds fun. I think the question we’re trying to weigh is how effective we can rally a shared component ecosystem for our platform using Om versus JavaScript. To me it seems like the timing is right as a result of JavaScript/React fatigue, functional programming becoming mainstream, way better performance with the Closure compiler, etc.

keatondunsford18:12:55

I’m also kind of interested in the ReasonML/Ocaml approach that Sean Grove (has been involved in the ClojureScript community for a while) has been evangelizing recently.

currentoor18:12:59

what do you mean by shared component system?

keatondunsford18:12:11

Like, if the platform is good enough (which it is), as history’s shown with people writing Emacs extensions or CoffeeScript plugins for Atom, I think people would be able to accept the newness of Om.

currentoor18:12:15

FWIW we don’t use any om next component libraries in our app

currentoor18:12:31

just wrote some om next components to wrap them

tony.kay18:12:35

we've used victory charts

tony.kay18:12:18

there are even demos of that in the devguide advanced UI section

tony.kay18:12:52

and d3, which is also covered some in the UI sections of devguide

tony.kay18:12:31

we're slowly working on an untangled-components library, which will leverage the CSS tools in untangled-stylekit. Neither of those is close to production-ready yet, though.

tony.kay18:12:43

The form support in components is going to rock

gardnervickers18:12:51

Our project uses ~20 other projects from the React ecosystem, from CodeMirror to ReactColor. It was all golden once we figured out how to use Webpack 😉

tony.kay18:12:52

it's really close, actually

tony.kay18:12:07

@gardnervickers Dude! You have to share that knowledge!

tony.kay18:12:23

I have not had time to figure it out, but desperately want to

tony.kay18:12:37

did you get it so you can just require stuff and closure picks it up?

tony.kay18:12:41

and optimizes it?

tony.kay18:12:30

@gardnervickers BTW, I'm pushing an update to 0.6.1-SNAPSHOT that should fix your app state problem

gardnervickers18:12:32

Unfortunately it’s left out of advanced compilation but we generate externs with a plugin, lein extern that just searches for method calls.

keatondunsford18:12:00

So the way web/mobile development works today is you build your "app", which by definition comprises both a backend and a frontend. On Urbit, we want to change this paradigm towards an API-centered development ecosystem, whereby all you have to do to build a new service is construct a new API, or add on to an existing one. For example, you might want to add support for a new cryptocurrency in your wallet app, or emoji type in your messaging app, both of which are just general streams of data to which you can overlay any kind of personalizable UI to run these, since all of this application logic is being run on your personal server which you control, whereby you can do things like integrate your Facebook, Twitter and iMessage feeds into one app, or ls your Gmail from the command line, or drag and drop your Google Docs into Evernote. So on the frontend, ideally Urbit would have a kind of Github-style repository of cross-platform, purely functional Om components that you can just drop into your app without worrying about the details of what they do, and allowing for a uniform design feel across your apps that looks really clean and just works. So a bit like WeChat or Material Design in that sense. React Native comes into play because it ultimately allows you to "write once, run anywhere" with just a few tweaks for each platform. I.e. for web apps, you wouldn't even write pure React.DOM code. you'd just use React Native components, or ClojureScript-ified RN components, and port them to the web using a library like react-native-web by the twitter guys, i.e. <view> becomes <div>, <text> becomes <p>, and so on. https://github.com/necolas/react-native-web CSS styling also becomes ClojureScript-ified, and potentially in the future we could integrate something like Facebook's new Yoga library.

gardnervickers18:12:27

I saw that the clojurescript compiler now can handle different module types and (presumably?) run them through advanced compilation. We’re excited to try that out.

therabidbanana18:12:13

Do you use cljsjs at all, or rely on webpack externally for everything?

currentoor18:12:36

@gardnervickers please share your webpack secrets 😄

gardnervickers18:12:59

Making a gist one sec 🙂

tony.kay18:12:20

0.6.1-SNAPSHOT on clojars. It changes merge-state!, which affect initial-state. It has test coverage, but I've not tried it much with existing apps. Let me know if anyone sees problems. Should clear up litter in app state.

gardnervickers18:12:38

https://gist.github.com/gardnervickers/bb01fff5a3a14406ba2f00042bdae33e We wanted to bring in react.cljsjs and friends so that Untangled and Om wouldn’t complain about it missing. So our webpack has some externals that are kinda like leiningen :provided dependencies from what I can gather. It essentially tells webpack to replace any calls to require(‘react’) with window.React.

gardnervickers18:12:41

Then we have a file under /src/js/main.js which is the top-level file webpack reads from. It’s just a bunch of clauses like

import ReactList from ‘react-list’;
window.ReactList = ReactList;

tony.kay18:12:34

hm. I was hoping for details on the new support for using other module systems with Closure...it's supposed to work at this point, I think...but I don't know how to set it up.

gardnervickers18:12:32

I think I saw a tweet from David Nolen about that but not much else, I was planning on researching it more. I think with that we won’t need Webpack anymore.

tony.kay18:12:46

that's my hope

gardnervickers18:12:48

Cool, looks like that could be a template to work from.

gardnervickers18:12:36

Btw thank you guys for fixing up my issue!

tony.kay18:12:58

looks good...it would be nice to see an example trying to use something where the overall library is spread out across a lot of files...maybe you just point at each file?

gardnervickers18:12:21

It’s usually just in a node_modules/ directory, no?

tony.kay18:12:27

I may try that out this afternoon and write up a devguide bit for it

tony.kay18:12:51

yes, but possibly a whole bunch of small files that is meant to be post-processed into one

tony.kay18:12:06

be nice if we can skip the post-process (webpack/browserify)

tony.kay18:12:21

but curious if we have to point to each individual file in our project.clj

tony.kay18:12:38

and how/if cross-requires work from the externals

tony.kay18:12:01

like I said, I'll just try it out now that I see an example

mitchelkuijpers21:12:29

@tony.kay I think there is a branch in the om repo where they show it off

tony.kay21:12:49

really? That would be nice.

mitchelkuijpers21:12:09

Yeah where they consume react this way

mitchelkuijpers21:12:54

I am on my phone right now, but I think it was done bij @anmonteiro

anmonteiro21:12:18

Not following the conversation but you might be looking for: https://github.com/anmonteiro/om/tree/js-modules

mitchelkuijpers21:12:38

Yes that's the one thnx