Skip to content

Instantly share code, notes, and snippets.

@adambeynon
Last active August 29, 2015 14:19
Show Gist options
  • Save adambeynon/baa9d6a34d16b2f12ea8 to your computer and use it in GitHub Desktop.
Save adambeynon/baa9d6a34d16b2f12ea8 to your computer and use it in GitHub Desktop.
Keeping Code DRY With Opal

** Draft **

I develop and maintain several apps written using Opal. These vary in their size, and vary in their usage. Each of these apps use rails as a backend. Some use html rendered through rails, and some use json rendered by rails. But in each case, these apps are tied in logic to the backend, and indeed share model logic between client and server.

  • Don't Repeat Yourself.
  • Shared modules - code once, use client & server
  • RSpec - write tests once, run client & server
  • Maintainability - Opal, questions about maintenance. Offset against maintaining ruby + coffeescript versions of same code
  • Overhead - filesize vs. context of code, is a little filesize worse than maintaing 2 code bases
  • Opal -> js, no different from coffeescript/es6 -> js
  • sourcemaps!
  • DRY - not just rails + Opal. What about rails + rubymotion. Webapp is just 1 target. native apps can also share code. Why make the webapp the maintenance nightmare, use ruby there as well
  • Performance? Doubters are the ones who have not tried it. Just avoid fib calculations - you wouldn't do it in ruby anyway ;)
  • etc..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment