If you had the choice between Ruby & Groovy

N

Noah Cutler

Hey All.

I've been playing around with Groovy for a few months; coming from PHP
it has been a bit of a revelation.

However, one particular issue has me now looking at Ruby:

When creating a web app. in Groovy, it runs on the JVM in a servlet
container like Tomcat. All is well in terms of having a truly dynamic
application (i.e. make a code change and no need to restart) with the
exception that mixin and parent class code changes are NOT picked up,
which requires a restart.

This is a show stopper for me.

Does Ruby have this same limitation, or can one make a change to any
ruby file in an application and have that changed picked up by the
server??

As far as the languages themselves, I'm sure most will vote for Ruby (or
I hope so, this is the Ruby forum after all ;--)). I have only spent a
few days running through Ruby docs and tutorials, so a total beginner.
Coming from PHP (and its Java/C inspired syntax), it has been pretty
easy to pickup Groovy (with exception of meta object programming that
does not exist for the most part in PHP). Ruby will be a bit of an
adjustment (camel casing in particular), but the job trends, general
hype, etc. exist for a reason.

Give me the good word on Ruby!
 
M

Mark Kremer

Hi there :)

It depends on what you're using. Ruby on Rails per example can run in
various environments (you can even add your own if you want), including
a development environment where it automatically picks up most changed
code when you try to use it (there are still a few cases where you'll
have to restart Rails after you make changes, per example when you add
new routes or when you make changes to code in the lib folder).

I have programmed a considerable amount of PHP 5 in the past, currently
I develop actively with both Ruby (and Ruby on Rails) and Java. I can't
say much about Groovy, because I haven't really tried it. Of all the
languages I've programmed in Ruby is definitely my favorite.

Regards,
Mark
 
N

Noah Cutler

Changed subject to indicate more clearly what I am missing with Groovy
web app. i.e. is Ruby truly live in the sense that one can change any
file regardless of mixin, dynamically added methods and the like without
having to restart the server?

The rest, sure, please chime in on benefits of Ruby vs. Groovy if you
know any.

Thanks
 
R

Robert Klemme

However, one particular issue has me now looking at Ruby:

When creating a web app. in Groovy, it runs on the JVM in a servlet
container like Tomcat. All is well in terms of having a truly dynamic
application (i.e. make a code change and no need to restart) with the
exception that mixin and parent class code changes are NOT picked up,
which requires a restart.

This is a show stopper for me.

Does Ruby have this same limitation, or can one make a change to any
ruby file in an application and have that changed picked up by the
server??

Not out of the box. As Mark has explained there are environments that
do this but it's definitively not a feature of the language. You
wouldn't want that as default behavior in a language because
implicitly changing code makes for hard to track bugs - and it's slow
because you need to compare file modification times always or at least
on a regular basis.
Give me the good word on Ruby!

Ruby is great! ;-)

Cheers

robert
 
P

Pinit Asavanuchit

I have move from Perl around 2 years ago. My team working hard with
Groovy 14 months ago. I myself focus on Ruby.

In dev mode I need to restart when I make change to config folder and
plugin in vendor. Other files are not need restart. But sometime Strange
behavior make me restart. Not offense just a few time a month. Groovy
almost the same.

I prefer ruby because it no need JVM. I can deploy it on most platform.
If Java ecosystem is target I can deploy it in JAR/WAR
 
K

Kirk Haines

When creating a web app. in Groovy, it runs on the JVM in a servlet
container like Tomcat. All is well in terms of having a truly dynamic
application (i.e. make a code change and no need to restart) with the
exception that mixin and parent class code changes are NOT picked up,
which requires a restart.

This is a show stopper for me.

Don't conflate Ruby with any particular web framework written using Ruby.

Ruby itself doesn't reload anything automatically if a file used in a
program changes while the program is running. That would be terrible
behavior.

However, a Ruby program can be written to do exactly that, if that
behavior is desired.

I did web development with Ruby starting in 2002 with a web framework
that would reload code changes.

Rails does not do this in production mode, but it does do this in
development mode. Other ruby web development frameworks have their own
paradigms for when and how they will reload (or not).

So, the actual answer to your question will depend on what web
development framework you are using.


Kirk Haines
Developer
Engine Yard
 
N

Noah Cutler

OK, interesting, this is another reason testing is strongly encouraged
in *rails frameworks (since you'll need to restart the server at times
to integrate code changes); i.e. get it exactly as you want it before
you launch.

PHP, while slow, messy, awful, etc., does have the real-time benefit of
making a change to any file in the application, and have that change
integrated without ever having to restart.

I guess that dynamic languages such as Ruby & Groovy give you the
benefits of speed, crystal clear syntax (PHP makes me sick) and MOP
capabilities, but at a certain cost in web applications.

It's an adjustment coming from LAMP stack, but the alternative
(continuing with PHP) is pushing me toward Ruby or Groovy.

Now the question, why is Ruby so good compared to Groovy, Python et al?
So far the main criticism of Groovy is that MOP is an add-on to the
language vs built-in, as in Ruby where everything is truly an object,
and as a result, much more concise MOP implementations. Python looked
appealing, but the explicit self method signature in every def just
annoyed me, already have to deal with $this-> everywhere in PHP.

Best way to learn might be to create a simple MVC web app in Ruby using
Sequel for persistence layer and maybe Haml + Sass for templates (if
even available outside of Rails).
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

If you're looking for simpler web frameworks, check out Sinatra or camping.
They're much smaller and simpler than rails.
 
N

Noah Cutler

Yes, when looking at Rails, and how (from outsider's perspective)
unwieldy it seems to be getting, I did notice Sinatra coming up in Rails
alt searches.

To get started, the basics are all I need: MVC + Persistence Layer +
Form Builder (which no *rails framework has to-date from what I've
seen); then, if the lang draws me, check out established frameworks to
see what's possible. Sequel looks very appealing, btw, compared to
active record.

Out of curiosity, most Ruby coders likely had experience in other langs
before coming to Ruby. What makes Ruby your preferred lang compared to
others you have used?
 
S

Steve Klabnik

[Note: parts of this message were removed to make it a legal post.]

Yep, it sounds like you'd be happy with Sinatra. It'd give you MVC, you can
use whatever you want for persistence, and I don't tend to use form builders
when I'm using Sinatra, so I don't have a good recommendation.

Out of curiosity, most Ruby coders likely had experience in other langs
before coming to Ruby. What makes Ruby your preferred lang compared to
others you have used?

I've been programming since I was seven. I've done more than trivial
projects in something like a dozen languages. Ruby is still currently my
favorite. The biggest reason is the flexibility and the culture. Ruby treats
you like an adult, and is incredibly expressive. And there's a large
community that's helpful and constantly trying to improve the state of the
art.
 
M

Matthew K. Williams

Yes, when looking at Rails, and how (from outsider's perspective)
unwieldy it seems to be getting, I did notice Sinatra coming up in Rails
alt searches.

To get started, the basics are all I need: MVC + Persistence Layer +
Form Builder (which no *rails framework has to-date from what I've
seen); then, if the lang draws me, check out established frameworks to
see what's possible. Sequel looks very appealing, btw, compared to
active record.

Depending on what you want in terms of form building, you might take a
gander at ActiveScaffold.

Out of curiosity, most Ruby coders likely had experience in other langs
before coming to Ruby. What makes Ruby your preferred lang compared to
others you have used?

I started with computers in 1980. Since then I've used a lot of
languages, high level and low. I think the main reasons (for me) that I
like Ruby are its:

+ elegance - it's easy to produce readable and pretty code
+ conciseness -- Not too verbose, not too terse. Just right!
+ don't have to keep reinventing the wheel -- traversing an iterator in
Java is *painful* compared to ruby. Ruby is a lot DRY er.
+ Ruby is more *fun* -- you can metaprogram if you want. There are a lot
more options with ruby than many other languages.
+ Coding in Ruby makes me happy!
 
N

Noah Cutler

@MKW, nice, if it makes you happy, then Ruby must be wonderful. PHP does
not make me happy, nor does the JVM (although Groovy has me grinning at
times).

@SK, I will check out Sinatra. Ruby community does seem to be very
active, a living community. Java world is a serious bunch, stern, high
minded (or higher than you) and not all that engaging. Little banter,
lucky if you get a response, and then only if the thread draws; i.e.
asking a basic MOP question will be ignored, while asking how to hook
into Spring's underlying event listener service in Grails will get every
Groovy heavy chiming in on the subject ;-)

Glad to be exploring, thanks for the feedback
 
R

Robert Klemme

Out of curiosity, most Ruby coders likely had experience in other langs
before coming to Ruby. =A0What makes Ruby your preferred lang compared to
others you have used?

I used to use Perl in domains where I now exclusively use Ruby. These
are the main reasons in decreasing order:
- cleaner syntax (actually: orders of magnitude cleaner syntax along
with a non convoluted variable type concept - there is actually only
one and not scalar, array and reference and combinations of those)
- pure OO language
- blocks

Kind regards

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
X

Xavier Noria

Out of curiosity, most Ruby coders likely had experience in other langs
before coming to Ruby. =C2=A0What makes Ruby your preferred lang compared= to
others you have used?

Ruby is a language I love, but I have no preferred language. I have a
bias towards general-purpose scripting languages though, did a good
deal of Perl, and played around with Python for about a year. Reason
is productivity, one flies implementing solutions to problems in
scripting languages, and that's my motivation for doing development.

I am restoring dev.rubyonrails.org munging a backup from the wayback
machine in a mix of shell and Perl. Ruby could serve as well, but I
have Perl ingrained in my brain for text munging :). Contradiction?
Heresy? Not at all, my advice is to be fluent in as many languages as
possible, and to just use them at your will. Don't get too emotional
about your language choices.

I've doing Ruby almost exclusively since 2005. I do love the language
of course, but the reason I am doing Ruby is rather practical, I do
Rails for a living so I better be good at Ruby.
 
N

Noah Cutler

Xavier Noria wrote in post #978629:
Ruby is a language I love, but I have no preferred language. I have a
bias towards general-purpose scripting languages though, did a good
deal of Perl, and played around with Python for about a year. Reason
is productivity, one flies implementing solutions to problems in
scripting languages, and that's my motivation for doing development.

I am restoring dev.rubyonrails.org munging a backup from the wayback
machine in a mix of shell and Perl. Ruby could serve as well, but I
have Perl ingrained in my brain for text munging :). Contradiction?
Heresy? Not at all, my advice is to be fluent in as many languages as
possible, and to just use them at your will. Don't get too emotional
about your language choices.

I've doing Ruby almost exclusively since 2005. I do love the language
of course, but the reason I am doing Ruby is rather practical, I do
Rails for a living so I better be good at Ruby.

Right, this is what I am coming to realize now, having more tools in the =

toolbox makes not only for a broader skillset, but for a more enjoyable =

programming experience.

As for, "Don't get too emotional about your language choices", if your =

day job was in PHP you would not say such things ;--)

-- =

Posted via http://www.ruby-forum.com/.=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top