
How Evan Moran replaced CSS/HTML/JS with OJJS - mikeyanderson
https://www.codefellows.org/blogs/interview-how-evan-moran-invented-ojss
======
doublerebel
This concept of 'JS all the way down' is what hooked me on Titanium Mobile
(crossplatform app framework) as soon as I started using it. It's a much
lighter cognitive load, since I'm not constantly switching between varied
featuresets and syntax of templates/HTML/CSS/JS.

One of my favorite features, is that any piece of the app can instantly become
a reusable, extendable module for another app. Since it's 'just JS' it always
ports. In this way I share UI widgets between web apps and mobile apps.

Generated CSS and HTML should be syntactically perfect, and JS has much better
error handling than either CSS or HTML. With those traits, the resulting code
can be better than a human could write on their own.

The concept of JSON syntax for DOM creation has been around a long time --
HAML, JsonML, jQuery... And although the JS syntax can be verbose,
CoffeeScript object notation is available, and quite similar to HAML and SASS.

I hope we see a lot more of this.

------
CoffeeDregs
I'm a little confused. Didn't ExtJS, Dojo, various jQuery plugins, etc do this
same kind of thing years ago? And didn't we kind of find out that JS + CSS +
HTML was acually a pretty nice separation of markup, formatting and
functionality?

~~~
evanmoran
The separation is definitely still a good thing -- OJ isn't trying to break
it! The only difference is now some of that separation can be done in code.
Think separate functions or js files. One that creates the site and one that
styles it. The separation doesn't have to be a completely separate format, it
turns out functions are quite good at abstraction=)

That said almost every example on the site is just creating HTML and JS (not
CSS), so it would be very easy for you to use OJ to create everything and then
style everything with .css files like you always have. So use it however you
want, but please don't think it is trying to force markup and formatting
together!

------
rojoca
Has anyone made a todomvc implementation using this?

------
ocfx
'Instead of the word ‘replace’ let's use "abstract away"...'

~~~
evanmoran
Ok, good point, I probably could have responded better=).

What I was trying to say was that a lot of people focus on OJ's ability to
create html/css and think that that is what it is for. They think that that
means you can't CSS the way they are use to: with a designer created .css
file. This isn't the case!

Instead OJ is about making reusuable website objects -- check out the plugin
page: [http://ojjs.org/plugins.html](http://ojjs.org/plugins.html). You can
make a YouTubeVideo in one line, but, just as importantly, the OJ plugin lets
you change the video's volume or pause and play. In short, OJ creates web
building blocks that can live edit what they create.

~~~
mikeyanderson
Evan, is it fair to say that it takes it a step toward Object Oriented web
dev?

~~~
evanmoran
That is a good way to think about it. As programmers we are used to objects
that give us methods and properties to change them. A Form object should have
a submit function, a Table object have a addRow, removeRow function. OJ does
this for the web.

