News for hackers. Stuff that matters.
Re:Rails is half of your application by programminggeek on Thursday March 13, 2014 @09:27PM (#7396390)
It's been over a year since Obvious Architecture came out and over a year before that when Uncle Bob gave his talk on Ruby Midwest. People seem to just now be catching on.

I've gone really deep down the rabbit hole on these kind of highly decoupled design patterns in Obvious, clean architecture, functional programming, TDD and all of that and I realize now that Ruby is not the optimal language for this style of development and DHH and Rails' purpose is not the same purpose of clean architecture.

I go back and think about the original build a blog in Rails demos, which are great BTW, and I feel like Rails' strength is standing up an application quick and getting stuff done. Yes it can do TDD and clean architecture and all of that fun design stuff, but to be completely honest, it doesn't fit the community or the language as much as it should.

Ruby gives you a lot of amazing tools, but there are a lot of things that make clean architecture way nicer that you end up bolting on to Ruby. Stuff like immutability, type checking, and strong interfaces are not the norm in Rubyland. That is perfectly fine, but by the time you build all those tools, it's hard not to look at a language like Scala or Kotlin and see a lot of those things built in to the language along with a compiler and nice IDE support.

I love Ruby and I use it every day. I live in a Rails app most of the day and I've found ways to make to make the code beautiful, but fundamentally I don't think the Ruby community will ever truly get behind clean architecture. It really flies in the face of the reasons why most people use Ruby in the first place.

Re:Rails is half of your application by clienthunter on Thursday March 13, 2014 @10:24PM (#7396605)
I think what you say about Rails is true. Rails isn't a framework, it's a lifestyle.

I also started to question whether Ruby's type system was just too loose for serious work and was yearning for something as pleasant as Ruby but with at least some type safety. Then yesterday I read this relatively old post https://www.ruby-forum.com/topic/217617 about adding static typing to Ruby. There's a lot of recognisable names in the thread, but the posts from Eleanor McHugh nearer the bottom really helped me understand the power and utility behind the apparent simplicity.

Re:Rails is half of your application by programminggeek on Thursday March 13, 2014 @10:35PM (#7396639)
I would love a compiled, statically typed Ruby, but I don't think the Ruby world wants it. I think Ruby is a fine tool in its current state.

I think there is a need for a different language that makes clean architecture natural, well accepted, normal thing. Ruby is great, but trying to change the community and language doesn't seem to be the right approach.

Re:Rails is half of your application by clienthunter on Friday March 14, 2014 @12:09AM (#7396935)
I've thought the same myself but reading that post made it clear to me that such thing couldn't really have much in common with what we call Ruby today.

The solution for the performant/distributed/concurrent/data-intensive problems of today and the future seems, to me, to be in the functional space. I know it's trendy to say that but it's the smart people - Rich Hickey, Simon Peyton Jones, etc - who are driving this evolution. A language with a GIL and zero immutable primitives just doesn't seem to have much to contribute. The idea that Twitter was at scale as a Rails app once upon a time is just absurd to me now.

Incidentally I creeped on your bio and saw you created obvious. I read about Obvious a while back and, although I must admit I haven't used it directly, it really had a strong influence on how I think about structuring Rails applications.

Re:Rails is half of your application by programminggeek on Friday March 14, 2014 @10:35AM (#7398958)
What I would really want from a language wouldn't have much in common with Ruby. It would look like ruby, but be mostly functional, compiled, with great support for immutable data structures, and named parameters. The closest I've found to this is Scala or Kotlin. I haven't had much time to dig deep into either though.

I'm glad Obvious influenced you, but I'm not surprised you didn't use it directly. To be completely honest a lot of what I built in the obvious gem, other languages give you just as language feature. For example comparing similar entity and contract structures in Ruby/Obvious, Mirah, and Scala: https://gist.github.com/brianknapp/6178930 I made Obvious work in Ruby because Ruby provided a great platform for figuring out how to make this work well. However, most Ruby devs either don't get it or don't like it because it's not very Ruby or very Rails.

The best Rails code I've ever written is basically using ActiveRecord to pull in a big data tree from the database and then using that to populate and do calculations on a bunch of immutable data structures using Hamsterdam::Struct. The code is really clean and beautiful and very easy to test. The final computed data structure is then used to populate an immutable presenter that helps generate the view. It is very much in the vein of a functional core and mutable shell concept that Gary Bernhardt advocates. My Obvious apps tend to follow a similar pattern, tho I haven't updated the Obvious site to mention functional core and mutable shell, but the code's kind of always been that way.

You can write great code in Ruby and Rails, but to me it's always going to feel more like a prototyping tool than something that will feel great to maintain for long periods of time.

Re:Rails is half of your application by clienthunter on Friday March 14, 2014 @08:07PM (#7402815)
Interesting you should choose Kotlin over Go. What's your take on it? I'm a big Jetbrains fanboy but haven't played with Kotlin yet.
Re:Rails is half of your application by programminggeek on Friday March 14, 2014 @11:57PM (#7403435)
I've played with Go and I like it well enough, but it doesn't offer anything interesting in the way of immutability. In fact, it doesn't so much offer it at all from what I've seen. Also, I'd like whatever language I land in to support named parameters.
Re:Rails is half of your application by sheff on Friday March 14, 2014 @04:56AM (#7397565)
One of the great things about Ruby at the moment is the number of Ruby implementations around, including several Ruby like languages which attempt to do things slightly differently.

Crystal is one language with Ruby like syntax and the goal of compiling to efficient native code. ( http://crystal-lang.org )

Mirah is another statically typed Ruby like JVM based language, although its development is a bit slow. (http://www.mirah.org)

Re:Rails is half of your application by infraruby on Friday March 14, 2014 @02:02AM (#7397212)
> I would love a compiled, statically typed Ruby

http://infraruby.com/ is a compiled, statically typed subset of Ruby, compatible with Ruby interpreters.

Re:Rails is half of your application by clienthunter on Friday March 14, 2014 @02:17AM (#7397242)
Is this actually type safe, or type safe up until you include an untyped gem and the whole thing becomes indeterminate? Does the typing actually improve performance over straight jRuby?

Can it handle method_missing and *_eval?

Also why is it closed source?

edit: sorry I didn't mean to sound aggressive. please interpret the stream of questions as extreme curiosity.

Re:Rails is half of your application by infraruby on Friday March 14, 2014 @02:50AM (#7397314)
> Is this actually type safe

The type system is roughly the same as in Java, and, as in Java, there are ways around the type system.

> or type safe up until you include an untyped gem and the whole thing becomes indeterminate?

The compiler requires type annotations; you can't include an untyped gem! InfraRuby syntax is compatible with Ruby interpreters, so you can still use your code while you write type annotations for it.

> Does the typing actually improve performance over straight jRuby?

Yes. The compiler is written in Ruby, and uses JRuby to bootstrap. The performance of the compiled compiler compiling the compiler is about 7x JRuby.

> Can it handle method_missing and *_eval?

No. The subset of Ruby supported by InfraRuby excludes metaprogramming and reflection.

> Also why is it closed source?

Because 1. give away your work 2. ??? 3. profit! is not compelling :-p

Re:Rails is half of your application by sethboyles on Friday March 14, 2014 @03:02AM (#7397329)
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Re:Rails is half of your application by wx196 on Friday March 14, 2014 @05:12AM (#7397613)
Re:Rails is half of your application by programminggeek on Friday March 14, 2014 @10:43AM (#7399012)
I've done Scala in the past and I think I'd be able to handle it better now. Honestly though, there is such a small footprint of the language that I would even care to use that I'm not sure it's worth learning. I'd probably stick to the immutable value objects, functional constructs like ruby's equivalent to map, select, each, etc., and use traits to enforce contracts on jack/plug objects. A lot of the other things in Scala don't appeal to me. This is one reason Kotlin is looking more interesting from where I sit. It has the features I want, IDE support, and a decent syntax.

It is entirely possible that I'll check out Scala again and fall in love with the language. Who knows.