
Introducing hexagonal.js - yashke
http://blog.arkency.com/2013/02/introducing-hexagonal-dot-js/
======
btipling
Why not call it hexagonal.coffee? Why do CoffeeScript libraries get a .js
extension? Yes I realize it works for JavaScript too, but it's weird to go see
a library with *.js in the name and then to find only CoffeeScript in the
documentation.

~~~
yashke
We'll try to deliver new examples in pure JS.

~~~
btipling
That was an honest question more than a complaint. Why do CoffeeScript
libraries not use the coffee extension? For broader appeal? Even if you had
JavaScript documentation, I would see the source was written in CoffeeScript
and realize I can't easily evaluate the quality of the source. Choosing
CoffeeScript must mean you prefer it over JavaScript, so why use the extension
of a language you do not prefer over one you do?

~~~
ricardobeat
You can look at the source just like any other js project. It might not look
totally clean as a hand-written project, but there are absolutely worse things
than looking at compiled coffeescript ( _cough_ lodash
[https://github.com/bestiejs/lodash/blob/master/lodash.js#L38...](https://github.com/bestiejs/lodash/blob/master/lodash.js#L383-L442))

~~~
k3n
To be fair, that's a template you linked...

Also, why go out-of-your-way to bash another project? Why didn't you link the
hexagonal source you mentioned, which would have been productive, instead of
lodash?

~~~
ricardobeat
That template is source code for a function, it becomes the body of many
lodash methods using eval. It's not out of my way, it sits right on top of my
personal "ugly code" list; couldn't think of a better (worse?) example.

As I understand it there is no hexagonal source, it's just an architecture.

------
irickt
Hexagonal uses Raganwald's metaprogramming ideas. Follow the links from the
dependency at <https://github.com/gameboxed/YouAreDaBomb>.

This shows the beauty of Coffeescript syntax for functional programming. For a
deep understanding read Raganwald's new book <http://ristrettolo.gy>.

~~~
andrzejkrzywda
This.

I'm one of the people behind hexagonal.js. Raganwald's work enabled us to
implement one of the main components - the glue code.

------
ricardobeat
Isn't that glue going to fall apart when you start working with asynchronous
methods? I might be suffering from tunnel vision, but IMO this is asking for
an evented model:

    
    
        class Glue
          constructor: (@useCase, @gui, @storage)->
            @useCase.on
                askForName   : @gui.showAskForName
                nameProvided : @gui.hideAskForName
                greetUser    : @gui.showGreetMessage
                restart      : @gui.hideGreetMessage
            @gui.on
                restartClicked : @useCase.restart
                confirmName    : @useCase.nameProvided

~~~
yashke
We use Around in such cases - it can put original method call to callback of
asynchronous method.

------
tinco
This looks very cool, I've recently finished a Javascript application that
used AOP for connecting the View to the Model and it rocked. I think I
implemented up more or less this framework, but less generic.

The name is an issue though, hexagonal.js doesn't seem to have to do anything
with what this framework does. If it is a framework that applies AOP to MVC,
why not pick a name that relates to that? There isn't even a mention of AOP
anywhere in the introduction.

------
robotmay
This looks quite neat and the Rails example
(<https://github.com/hexagonaljs/rails-example>) is interesting. I'll
definitely have a play around with it later in my never-ending quest to find
JS libraries that don't make me want to snap my computer in half.

------
seivan
Woaah, it's a cool idea, but I wonder how productive one would be in it. Will
have to give it a shot later.

~~~
yashke
So the switching your mindset to hexagonal.js is quite hard at the beginning
and I think it's the most time consuming part. Then you are very productive -
gameboxed.com developed > 20 small and large apps using hexagonal.js last
year.

------
Rocky_Outcrop
How can it be a good thing to follow the MVC framework on both the client side
and the server side, as it says in it's philosophy, when the client side is
the V in MVC?

~~~
yashke
Good question. In hexagonal.js approach client side is full app - so there's
model part (use case is part of model), glue ~ controller and views are GUI
and other adapters.

~~~
Rocky_Outcrop
Thanks for letting me know. I'll not be rushing out to add hexagonal.js to my
Rails app, but if one of my friends who likes js wants to try building their
own full app I'll mention this as a possibility.

~~~
yashke
To be honest most of project I developed with hexagonal.js have Rails as a
backend and it's really powerful with sprockets on board. So give it a try,
maybe in toy project.

~~~
Rocky_Outcrop
Cool, I'll give it a shot, buddy. Thanks for the advice.

------
x1024
There's far too many typos for me to have any amount of confidence in the code
itself.

Sorry, but I can't trust my business with people who cannot even be bothered
to write proper English for their introduction.

~~~
yashke
Sorry for my poor english, I'm still learning :(

~~~
vidarh
While there are some errors on your page, don't worry too much about it. It is
fully possibly to understand and make sense of it.

As someone else said, he was being a dick about it, and the implication that
English skills are somehow related to coding skills is obviously nonsense.
(And he still managed to make mistakes of his own while criticising your
language)

To be a bit more constructive, here's a slightly rewritten introductory
paragraph that I believe reads more natural (though English isn't my native
language either):

"There's an idea we have been working on for more than one year so far. As
backend developers we were thrown into the mysterious world of frontend
(client-side) apps without any good pattern for creating Single Page Apps. So
we (GameBoxed + Arkency) invented one - hexagonal.js."

But the most frequently occurring English mistake on your page appears to be
missing "the"'s. This error is very common with speakers of slavic languages.
Based on the admittedly limited example of your English on the linked page, I
think one of the biggest improvements you can get with relatively little
effort would be if you spend some time reading up on how to identify where/how
to use "the".

