Porting a Rails app to Lift - (Interesting)

Roderick van Domburg wrote:

Mark wrote:

This is worth a read:
http://blog.lostlake.org/index.php?/archives/45-A-real-world-use-of-lift.html

I'm really trying to keep an open mind here, but is there anyone with me that that Scala code is anything but intuitive and idiomatic?

I think some of that comes from the fact that Scala can be written using its functional style so you get things like:

def While (p: => boolean) (s: => unit): unit =
   if (p) { s ; While(p)(s) }

It also supports Erlang-style actors so you get things like:

if (bid >= maxBid + bidIncrement) {
   if (maxBid >= minBid) maxBidder ! BeatenOffer(bid)
   maxBid = bid; maxBidder = client; client ! BestOffer
} else {
   client ! BeatenOffer(maxBid)
}

So yeah, there's a "crypticness" to it to those unfamiliar with the language whereas Ruby seems much more understandable without being verbose to those who aren't familiar with the language as DHH has demonstrated in the past.

Michael Wang wrote:

So yeah, there's a "crypticness" to it to those unfamiliar with the language whereas Ruby seems much more understandable without being verbose to those who aren't familiar with the language as DHH has demonstrated in the past.

I, for one, did NOT find this to be the case... and I sure see a lot of confused people on this list.

Ruby is just a programming language. Yes, it gives you some great syntactic sugar and terseness. But there will still be things that take some figuring out. Hell, I've seen some stuff in rails code that would give Perl a run for its "crypticness".

Sorry, but I just think this "oh it reads just like English" stuff is a bunch of hooey. Reads like stilted, oddball English is more like it... and English that if you get one thing wrong, just doesn't do what you want.

b

I, for one, did NOT find this to be the case… and I sure see a lot of
confused people on this list.

Ruby is just a programming language. Yes, it gives you some great
syntactic sugar and terseness. But there will still be things that take
some figuring out. Hell, I’ve seen some stuff in rails code that would

give Perl a run for its “crypticness”.

Sorry, but I just think this “oh it reads just like English” stuff is a
bunch of hooey. Reads like stilted, oddball English is more like it…
and English that if you get one thing wrong, just doesn’t do what you want.

So, just to get this straight: you’re complaining that a programming language acts like… a programming language. You can’t change the fact that syntax errors are syntax errors… and adding in too many aliases, etc., will just make the language huge and bloated.

It does read more like English than any other programming language I’ve used… but making it read exactly like English would be a horrible idea. Talk to a semanticist or linguist some time and ask them how well structured of a language English is. The point of a programming language is the ability to get your point across and tell the machine exactly what you want it to do. The more general you allow the programmers to be, the slower the language as it has to deal with more and more branching paths while interpreting.

So: Ruby is a great balance. It takes all the stupid, horrible crap that is English, and all the stupid, horrible crap that is programming logic, and walks a damn fine line down the middle of them. No one (or at least, no one who knows what they’re talking about) is trying to say that it reads like the English you speak… just that it’s as close as it can get to that without completely bloating the language to death.

Sorry, had to get that off my chest; I’ve heard a lot of people making the particular statement you did recently, and this seemed like an appropriate place to bite back. Nothing personal at all.

E.G.:

Very much like English:

4.days.ago

Not as much like English, but extremely readable with only the basics of programming logic:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].select {|x| x % 2 == 0}

and you can generate an English sentance from the syntax: “For this array, select objects where that object is even”

This is what we mean when we say “no other language comes as close to English”.

Jason

At first blush, Scala seems to have more punctuators than does Ruby, which is
a bit distracting coming from Ruby. I've just had to do some maintenance
work on a PHP site, and one of the biggest sources of typos was frikken
punctuators. Ack!

The question I would ask is this: Does Scala derive its "goodness" from its
type-safety or its ability to compile to bytecode? If the latter, then JRuby
may be great news. If the former, the question is: How come?

On a different subject, I don't completely buy "the compiler is your friend"
argument with respect to static type-checking. I've programmed in both
statically and dynamically typed languages and the defect rate (at least for
me) is actually lower in dynamically typed languages. I believe the reason
is that static typing *requires* programmers to make assumptions regarding
type and often size of data the language can easily infer. In fact, the
interpreters (Python, Ruby, et. al.) seem to do a better job than I do at
this. YMMV.

The issue for me is not threading, per-se, but rather concurrency and
re-entrance no matter how they is achieved. I'd prefer not to be required to
make assumptions about how many Mongrels I'll need. Any implementation of
re-entrant code could help relieve me of that. To me, that's the most likely
way to put Rails on rocket fuel.

Jason Roelofs wrote:

Luke Ivers wrote:

    I, for one, did NOT find this to be the case... and I sure see a lot of
    confused people on this list.

    Ruby is just a programming language. Yes, it gives you some great
    syntactic sugar and terseness. But there will still be things that take
    some figuring out. Hell, I've seen some stuff in rails code that would
    give Perl a run for its "crypticness".

    Sorry, but I just think this "oh it reads just like English" stuff is a
    bunch of hooey. Reads like stilted, oddball English is more like it...
    and English that if you get one thing wrong, just doesn't do what
    you want.

<rant>

So, just to get this straight: you're complaining that a programming language acts like... a programming language. You can't change the fact that syntax errors are syntax errors... and adding in too many aliases, etc., will just make the language huge and bloated.

It does read more like English than any other programming language I've used... but making it read exactly like English would be a horrible idea. Talk to a semanticist or linguist some time and ask them how well structured of a language English is. The point of a programming language is the ability to get your point across and tell the machine exactly what you want it to do. The more general you allow the programmers to be, the slower the language as it has to deal with more and more branching paths while interpreting.

So: Ruby is a great balance. It takes all the stupid, horrible crap that is English, and all the stupid, horrible crap that is programming logic, and walks a damn fine line down the middle of them. No one (or at least, no one who knows what they're talking about) is trying to say that it reads like the English you speak... just that it's as close as it can get to that without completely bloating the language to death.

</rant>

Sorry, had to get that off my chest; I've heard a lot of people making the particular statement you did recently, and this seemed like an appropriate place to bite back. Nothing personal at all.

Heh. That's funny. I wrote my post because I had seen so many people talk about how Ruby is superior because it's more like English... and I have seen a lot of talk about how Ruby and Rails make it so easy to whip out apps. It is... if (just like any tool) you know what you're doing.

I think Ruby and Rails are great... but there are plenty of difficult concepts in both that take some learning. I think the level of confusion that I've seen on this list for over a year now is ample illustration of that.

No I don't expect a programming language to read like English... that was exactly my point. Why then is reading more like English a supposedly good thing? Making a language read more like English is accomplished through syntactic sugar and magic; magic always comes at the cost of additional cerebral load.

Once again... I love Ruby and Rails... I am simply quibbling with what I see as a common, mindless argument for championing Ruby and Rails. There is plenty of better ammo.

But I'm also falling back into my reflexive posting of my contrary opinions... which doesn't really forward anyone's knowledge... and is really just as lame as saying "oooh, Ruby's great cuz you can say 4.days.from.now"... so it's back into my hole with me. :slight_smile:

b

That way lies madness.

Also, AppleScript.

:wink:

J.