Live data from Hacker News

Existential crisis at Railsconf

railsbird.tumblr.com

101–110 of 168 posts

Re: Existential crisis at Railsconf

#101
post #92

Earlier quoted context omitted.

> Now I say "strong typing is a wonderful test suite you get for free and automatically stays up to date". Not that it replaces tests; but it literally a wonder how Haskell's HM-typesystem it rejects broken code at compile time. Ruby is strongly typed.

That's true. But in practice I've come to the idea it's a meaningless distinction if you're not going to bother to declare the types on your methods/functions. Instances may be Strongly typed in Ruby. Methods are not. So you get almost none of the benefit. It's like Types only exist in Ruby to support Mixins and inheritance chains. Prefer Composition over Inheritance right? But what if through Composition you effecti…

> Instances may be Strongly typed in Ruby. Methods are not.

Sure they are, just not all of them:

    [].first('wat') # => TypeError: no implicit conversion of String into Integer
What Ruby lacks is _static typing_ and compile time checks of these types. Instead we have runtime checks in a few places.

> Prefer Composition over Inheritance right? But what if through Composition you > effectively lost all your Type information? That's the issue Ruby presents.

This is mainly advocated because subclassing core classes (e.g. Array) can lead to weird behaviour. For example:

    class MyArray  Array
Here one would probably expect an instance of MyArray to be returned, but instead we get a vanilla Array.

Re: Existential crisis at Railsconf

#102
post #97
post #77

As someone who's done the bulk of the work for Action Cable, I wanted to clear the confusion re: cable and eventmachine. Cable is currently using EventMachine because it uses faye-websocket for dealing with websockets. And Faye is one of the very few well maintained ruby library dealing with websockets. And in fact, Action Cable uses Celluloid threadpool to run all the application code in threads. So the model is a c…

As someone who's tried to use Faye and EventMachine (separately) back in the Ruby 1.9.3 days: Have they stabilized enough to be used for anything? My memory of them is rather horrible. Memory leaks, segmentation faults(!) and obscure deadlocks eventually made me scratch EventMachine from the list of things I'd ever want to touch again. And Faye, well, I don't think I even got it fully running at the time. I still re-…

I've been using Faye quite happily for the last month or so and have been very pleased with it.

Re: Existential crisis at Railsconf

#103
post #36

Is this just a really polite, introspective take on (Rails|Ruby) is a Ghetto? I can't point out one really valid critique in this entire rant. While I imagine that you've had enough kool-aid to actually believe the things you said, I think you should probably do a few google searches to find out how many shops are hiring Rails devs versus Clojure or Elixir. You can do more experimenting by seeing who else is actually…

> Startups and other more established companies still choose Rails as their platform As far as I can tell, this process has come to a grinding halt in the past few years. I certainly see established companies ditching Ruby, not so much because of the language or framework itself, but because of the community that only seems to be able to solve problems "the Rails way", even if that's far from the most appropriate arc…

> It's shocking how many Ruby developers are architecturally ignorant about anything not applied by Rails, and it's biting many companies in the ass.

On the contrary, I started in web development by learning Rails, and it's simple, streamlined way of responding to an HTTP request has allowed me to pick up other architectures quite quickly. By being so simple, it gives me an easy point of comparison, and then I can appreciate other architectures differences.

Re: Existential crisis at Railsconf

#104
post #97
post #77

As someone who's done the bulk of the work for Action Cable, I wanted to clear the confusion re: cable and eventmachine. Cable is currently using EventMachine because it uses faye-websocket for dealing with websockets. And Faye is one of the very few well maintained ruby library dealing with websockets. And in fact, Action Cable uses Celluloid threadpool to run all the application code in threads. So the model is a c…

As someone who's tried to use Faye and EventMachine (separately) back in the Ruby 1.9.3 days: Have they stabilized enough to be used for anything? My memory of them is rather horrible. Memory leaks, segmentation faults(!) and obscure deadlocks eventually made me scratch EventMachine from the list of things I'd ever want to touch again. And Faye, well, I don't think I even got it fully running at the time. I still re-…

I wrote http://firehose.io/ that runs on a separate fleet of servers to handle pub/sub that uses Faye. For the most part it runs without putting up a fuss.

Lost messages aren't a concern because it's assumed the protocol won't handle lost or dropped messages, so Firehose messages have a sequence that counts up per channel that the client keeps track of.

Re: Existential crisis at Railsconf

#105
post #63

For those wondering what the alternatives to Rails are these days, I highly recommend checking out Elixir and the Phoenix framework. http://elixir-lang.org/ http://www.phoenixframework.org/

I used Phoenix for a small project last September, not much more than a toy but anyway... Pros: websocket support is good, the developers are friendly and answer questions, the app is faster than what I'm used to with Rails. Neutral: Elixir looks like Ruby but it's very different. Be prepared to learn everything from scratch. You need also to know a little Erlang and the OTP framework to be able to use some useful li…

We've come a long way since September, so please check again. I am outlining our 1.0 remaining milestones Friday at ElixirConfEU. We should see 1.0 in a few months

Re: Existential crisis at Railsconf

#106

Earlier quoted context omitted.

Rails programmer switching to Clojure/Elixir here. And my workplace is switching to Scala.

I always wondered why Rails programmers prefer Clojure/Elixir over Scala, Scala syntax and concept seems to me much more translatable to Ruby than Clojure. In Scala, just like in Ruby 1 + 1 is 1.+(1), you have a scala version of method_missing, duck typing, pimp my library etc... Is there a reason why Rubists prefer a completely different paradigm such as Clojure?

I got interested in Clojure because I felt I needed to learn something LISPy. Similarly, I got interested in Elixir because I felt I needed to learn Erlang. I have yet to have any kind of similar motivation for Scala.

These are not good reasons, but they are my reasons.

Re: Existential crisis at Railsconf

#107

Earlier quoted context omitted.

Having used both Rails + Clojure here's my take. As a general comparison, when it comes to building server-side web apps Rails is preferable to Clojure. But for the web stacks / ecosystems as a whole Clojure wins by about 10x. The main reason for this is ClojureScript. For those who aren't familiar ClojureScript is a Clojure->Javascript compiler that lets you write your UI code in Clojure and drastically simplifies J…

I'm curious (as someone who's only dabbled in Clojure): could you write an Ember app in ClojureScript (or Angular/React/Knockout)? Is it like Coffeescript---i.e. just a compiler? If you wanted to build a SPA in ClojureScript, how would you approach it?

You can write Ember/Angular/Knockout etc... in ClojureScript (I've done it before) but it comes out feeling weird and unnatural. You always feel like you're trying to fit a square peg into a round hole.

The preferred solution is to use a ClojureScript wrapper around ReactJS and write your own event handling logic. I'm a big fan of the Reagent library which wraps React with a dead simple API. I believe it's the best UI library ever created and I wish more people knew about it.

The big idea is that you store your UI state as one single Clojure data structure. A Reagent component is just a Clojure function that takes the necessary sub-section of the UI state as an argument and returns a Clojure data structure that represents the HTML code that it wants to render. An example of this would be the following component that displays a list of items.

(defn [items] [:ul.items (for [item items] [:li.item (:display-name item)]])])

Then whenever you change the state of 'items', the component will automatically re-render and inject the new DOM as necessary using React's diffing algorithm for high performance. The key thing here is that there is no Javascript framework to learn. All you do is manipulate Clojure data with Clojure functions and use React to render it. There's no 'Ember.component.extend' or 'ng-repeat' to worry about. You spend very little time looking through documentation. The Clojure langauge IS your framework, it's really incredible.

Re: Existential crisis at Railsconf

#108
post #99

Earlier quoted context omitted.

Maybe you're the one who's not good enough at Ruby yet. :)

In Ruby you can't express the concept of an empty List through a Type. When comparing statically typed languages to non, that's generally what "expressiveness" means to me. Any idea can be expressed through expressions in a turing complete language right? That's not a useful metric. In Ruby a method's type-signature expresses almost nothing for example. def f(a,b) Does the method side-effect? What types are a or b? A…

Well now you're getting into statically vs dynamically typed, which doesn't apply to this conversation because both Ruby and Clojure are dynamically typed.

But in a statically typed language like Scala or Haskell, you can use the typechecker to express proofs about program correctness. That is a form of "expressiveness" that doesn't really exist in Ruby or Clojure (unless you use core.typed).

Re: Existential crisis at Railsconf

#109
post #26

Earlier quoted context omitted.

> LOL at the idea that every Rails programmer will be switching to Clojure or Elixir! I meant those as examples based on what I see around me. That's exactly my agony, I don't know what is next and, if I did, I would be learning it already. At this point, I just feel it is not Rails. > Re. EventMachine: As I understood DHH's speech, the idea is that ActionCable abstracts all the messiness around EventMachine, Websock…

Nginx HTTP Push Module seems to much better solution than EventMachine. So Nginx keeps opened sockets and a Rails app sends messages via ordinary HTTP. http://wiki.nginx.org/HttpPushStreamModule

Agree, very much.

I'm also wary of handling websockets from Ruby, which is demonstrably ill suited for any kind of high concurrency networking (been there, got the t-shirt).

Since most people already run nginx in their stack anyway I don't see the advantage of sticking with a Ruby-based solution that is almost guaranteed to be inferior on every metric.

Re: Existential crisis at Railsconf

#110

Earlier quoted context omitted.

I'm curious (as someone who's only dabbled in Clojure): could you write an Ember app in ClojureScript (or Angular/React/Knockout)? Is it like Coffeescript---i.e. just a compiler? If you wanted to build a SPA in ClojureScript, how would you approach it?

You can write Ember/Angular/Knockout etc... in ClojureScript (I've done it before) but it comes out feeling weird and unnatural. You always feel like you're trying to fit a square peg into a round hole. The preferred solution is to use a ClojureScript wrapper around ReactJS and write your own event handling logic. I'm a big fan of the Reagent library which wraps React with a dead simple API. I believe it's the best U…

This is the strongest argument for Clojure in web programming. HTML (and all XML-based UI frameworks) are just tree data structures, so it's trivial to represent them as s-expressions and manipulate them using normal Clojure code, then render them to HTML at the last moment, instead of having to use different syntax to inject code into templates. Lisp/Scheme languages are uniquely well-suited to the problem domain.
Post reply on HN