Skip to content

Instantly share code, notes, and snippets.

@fkchang
Created August 26, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkchang/df0a568942251ae258e3f2204ed225da to your computer and use it in GitHub Desktop.
Save fkchang/df0a568942251ae258e3f2204ed225da to your computer and use it in GitHub Desktop.

Title

The Web is better in Ruby

Abstract

Look at where web tech has evolved towards.

HTML: HTML is a bad programming language, thus: erb, haml, JSX. Rails introduced partials coz there’s no extract method for HTML.

CSS: SASS, LESS were invented to make CSS a real programming language: inheritance, reuse, variables, etc.

Javascript: Many made their own JS classes, then ES6 made classes official.

All 3 technologies are evolving to be OO programming languages. What if they could all be modeled by a single language. One can do all 3 as JS, but it’s not a great OO language. Did you know you can already do them all as Ruby, & it’s good?

Details

Web technology is a jumble of different languages that somehow manages to work together. It is unlikey that Tim Berners-Lee would have imagined how web technology would’ve evolved from what he initially invented.

As web programming approaches and tools have evolved they are reaching more towards becoming Object Oriented programming languages.

Markup: The web world has re-learned what the Java world learned decades ago, that XML is a bad as programming language (i.e. Ant). Libraries like erb, haml, slim etc, try to add programming to HTML, and a such are popular. Libraries like markaby, paggio, builder bring the full power of Ruby to markup, leveraging on Ruby’s DSL abilities to make Ruby look something like haml or slim.

Rails added partials to solve cut and paste of HTML. If HTML were a real programming language, one could refactor.

Css: SASS and LESS were invented to make Css a real programming language. SASS brings variables, nesting, partials, imports, mixins, inheritance, operators. As such it’s used very widely. It should be no surprise that SASS’s creator was a Rubyist.

Javascript: Many libraries implemented classes, then ES6 made those classes official. Unfortunately the Javascript world is divided classes and Object Oriend, some love ES6 classes, others think it’s the worst addition. As such, Javascript isn’t a particularly good Object Oriented language.

Since the 3 main web technologies are evolving towards being Object Oriented programming languages, it would be nice to have a single language to express them. This trend has been happening in the Javascript world, where esp. the React.js folk are trying to express everything in Javascript.

However, Ruby is both a better Object Oriented language, fulling embracing the Object Oriented paradigm, and a has stronger DSL capabilities than Javascript. JSX was likely invented in part because Javascript cannot provide a DSL that looks like markup, Ruby can.

A Ruby based approach to modeling all 3 could be both more expressive and more beautiful. Similarly, Ruby being a very Object Oriented programming language, perhaps second only to Smalltalk, lends to Object Oriented solutions, not commonly done in Javascript simply because Javascript is not as Object Oriented a language.

This talk will explore how that would look and would be better and then show how the capability already exists and is being used.

Pitch

The web is better in Ruby, which should make Rubyists happier and more productive. Combined with some other technologies, an all Ruby approach could allow Ruby based web developers to stay relevant and employable as server rendered webapps become less relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment