More bettah Ruby!

21 views
Skip to first unread message

Pjotr Prins

unread,
May 30, 2014, 11:36:30 AM5/30/14
to sciru...@googlegroups.com
The book to read up on Ruby is the Pickaxe:

http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0

older editions are fine too and are in many libraries (and online). It
covers all aspects of the language and is easy reading too.

Pj.

Magdalen Berns

unread,
May 30, 2014, 12:03:56 PM5/30/14
to sciru...@googlegroups.com
Ah! Thanks! I'm off the the library now, so I will ask them about books! John you mentioned a couple too can you post them and I will ask about those too?

Thanks again.



--
You received this message because you are subscribed to the Google Groups "SciRuby Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sciruby-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John Woods

unread,
May 30, 2014, 12:15:18 PM5/30/14
to sciru...@googlegroups.com
Not books — just examples of gems, which I have already sent in reply to Pjotr's email about biogem.

Pjotr Prins

unread,
May 30, 2014, 12:25:34 PM5/30/14
to sciru...@googlegroups.com
On Fri, May 30, 2014 at 12:15:17PM -0400, John Woods wrote:
> Not books ? just examples of gems, which I have already sent in reply to
> Pjotr's email about biogem.

The only other Ruby book I can recommend is

http://pragprog.com/book/ppmetr2/metaprogramming-ruby

Of the many programming books I have read these are the two Ruby books
I have found to be really valuable for programming Ruby.

You can lock me up in a room with those two books and I'll churn out
code. Code at least useful to me ;)

Pj.

Alpha Chen

unread,
May 30, 2014, 12:33:55 PM5/30/14
to sciru...@googlegroups.com
I'd highly recommend Eloquent Ruby for those who are familiar with programming but not Ruby in particular.



Pj.

Iain Barnett

unread,
May 30, 2014, 3:52:43 PM5/30/14
to sciru...@googlegroups.com
+1 for Eloquent Ruby, and Design Patterns in Ruby. Metaprogramming in Ruby is also invaluable. The pick axe, not so much. YMMV.

Pjotr Prins

unread,
May 30, 2014, 6:08:28 PM5/30/14
to sciru...@googlegroups.com
On Fri, May 30, 2014 at 08:52:42PM +0100, Iain Barnett wrote:
> +1 for Eloquent Ruby, and Design Patterns in Ruby. Metaprogramming in Ruby is
> also invaluable. The pick axe, not so much. YMMV.

Hmmm. Our advice should not lead to confusing our GSoC students. I am
sure every book has something valuable to offer. Eloquent Ruby may be
worth reading. Even so, the Pick Axe is still one of the most used
online resources - especially the documentation of the standard
libraries, and as it was the one I pretty much learnt by heart, I
believe it is a pretty comprehensive guide to Ruby and its libraries
even if it does not teach programming per se.

Design patterns I do not think a good suggestion, but that is because
I don't really think in the patterns set out by the gang of four - in
fact I think most patterns are a code smell and should be avoided
unless you are into J2EE or really buy into OOP, which I don't ;). OK,
I am exaggerating, but I hope you can see my point. Really, how many
patterns do we use in SciRuby or other software projects?

Anyway, let's not feed further suggestions to new comers. I think we
should leave it to the three books, of which I have not read Eloquent
myself. That may be a good idea, maybe our students can confirm what
books works for them?

Pj.

Magdalen Berns

unread,
May 30, 2014, 7:35:23 PM5/30/14
to sciru...@googlegroups.com
Ok thank you everyone. The library does not seem to have any of those but I missed the helpdesk so I am going to see if I can ask them to order it in, tommorrow. 

I am not sure I get your comment about 'buying into OOP' I am used to the concept. I had not realised it was a philosophy but one I have found most useful for navigation through C is C for java programmers as this book basically says 'you know when you do X in java, well, it's Y in C' and I find that kind of useful. Is that what 'patterns' does? If so, I think that can have some value for me based on my C book but if not, maybe I should be careful in case there is something more sinister in the pages of this book?!?

Magdalen



Pj.

Karl Broman

unread,
May 30, 2014, 7:37:22 PM5/30/14
to sciru...@googlegroups.com
I tried reading the pickaxe book but it wasn't for me. Maybe I just didn't connect with the examples, or the order of topics wasn't a good fit.

I liked Peter Cooper's Beginning Ruby, followed by Eloquent Ruby.

karl

Pjotr Prins

unread,
May 31, 2014, 2:50:59 AM5/31/14
to sciru...@googlegroups.com
On Sat, May 31, 2014 at 12:35:22AM +0100, Magdalen Berns wrote:
> I am not sure I get your comment about 'buying into OOP' I am used to the
> concept.

Perhaps I should not have thrown that in. I was merely reacting to
software patterns (see below). Ruby is a language that allows for both
OOP and Functional style programming. My taste runs towards the
latter, mostly because with growing software projects I find OOP gets
in the way. But, it is the way that programmers handle OOP. OOP itself
is not evil.

In fact the Ruby standard libraries are a pretty good example on how
to use OOP. Compared to the JAVA standard libraries, for example,
you'll find that the Ruby libraries are pretty flat (little hierarchy,
thanks to mixins), carry as little state as possible and are used
mostly as a form of name spacing. Unlike with JAVA I never (or very
rarely) have to think about different BufferedStreams types, for
example. That is why programming with Ruby stdlib feels so natural to
most programmers.

Anyway, if you want to know more about FP, I can suggest Joe
Armstrong's Programming Erlang book. It was the one that drove the
usefulness home to me (Erlang has no support for OOP). But also for
functional programming in Ruby there are Internet resources. E.g.,

http://code.google.com/p/tokland/wiki/RubyFunctionalProgramming

Ruby is a mixed paradigm language, so you get a bit of both OOP and
FP. For me it strikes a useful balance (that is why I like Ruby!) and
as I grow as a programmer I still discover more about Ruby that I
like. I miss some things available in true FP languages, in particular
(deep) immutable data and expression matching, but that is about it.

> I had not realised it was a philosophy but one I have found most
> useful for navigation through C is C for java programmers as this
> book basically says 'you know when you do X in java, well, it's Y in
> C' and I find that kind of useful. Is that what 'patterns' does?

No. Patterns describe common 'themes' in software architecture. The
simplest one is the Singleton, a class/object that is guaranteed to
exist once in a program. Another pattern is the adapter, which may be
an object that presents a different interface to another object. Both
these patterns are code smells in my book ;), though using them may be
justified. A useful pattern, meanwhile, is the iterator pattern, which
comes natural to Rubyists. Read up on these if this interests you.

> If so, I think that can have some value for me based on my C book
> but if not, maybe I should be careful in case there is something
> more sinister in the pages of this book?!?

There must be some Internet resources 'Ruby for Javaists' etc. I would
ignore design patterns for now.

Pj.

Iain Barnett

unread,
May 31, 2014, 5:36:22 AM5/31/14
to sciru...@googlegroups.com
Well, I can tell you - since I've read it - that the Design Patterns book (written by Russ Olsen, the bloke who wrote Eloquent Ruby and is, for me, the easiest tech writer to read) actually shows how most of the patterns are baked in to the language already and aren't needed, or that other parts of the language, like code blocks, make some of the patterns incredibly simple to implement. In essence, what the book is really showing is good programming practice.

Overall though, if you program regularly and you don't use patterns, your code will be a mess, your bug count will go up, and your life will be more difficult. As I've said before, your computer and your program code don't care that you're a scientist, it's really got nothing to do with it.

> Really, how many patterns do we use in SciRuby or other software projects?

Maybe they should… ;-)

Anyway, what you read is up to you, it's just my suggestion.



Pj.

Pjotr Prins

unread,
May 31, 2014, 6:29:24 AM5/31/14
to sciru...@googlegroups.com
Just to be clear, I have read and digested the Ruby Design Patterns
book and the original Gang of Four book. In fact both I own and the
latter has been solidly supporting my monitor for years. That makes
for a useful book :)

If you read my mail carefully you can see that I am not against design
patterns, nor against OOP. I am merely wary of programmers applying
them in the wrong places and overengineering - a typical code smell -
and I have been there myself. We all have to go through these learning
stages. For a beginning Rubyist, meanwhile, I don't think Design
Patterns is particularly helpful - but that is my opinion.

We simply raised some suggestions for our Google Summer of Code
students. I don't think it is a great idea to fall over each other in
disagreement here. Eloquent Ruby looks like a great suggestion.

That is the last of it, as far as I am concerned.

Pj.

On Sat, May 31, 2014 at 10:36:21AM +0100, Iain Barnett wrote:
> Well, I can tell you - since I've read it - that the Design Patterns book
> (written by Russ Olsen, the bloke who wrote Eloquent Ruby and is, for me, the
> easiest tech writer to read) actually shows how most of the patterns are baked
> in to the language already and aren't needed, or that other parts of the
> language, like code blocks, make some of the patterns incredibly simple to
> implement. In essence, what the book is really showing is good programming
> practice.
>
> Overall though, if you program regularly and you don't use patterns, your code
> will be a mess, your bug count will go up, and your life will be more
> difficult. As I've said before, your computer and your program code don't care
> that you're a scientist, it's really got nothing to do with it.
>
> > Really, how many patterns do we use in SciRuby or other software projects?
>
> Maybe they should? ;-)

Iain Barnett

unread,
May 31, 2014, 10:18:06 AM5/31/14
to sciru...@googlegroups.com
I read it carefully, did you write it carefully?

but that is because
I don't really think in the patterns set out by the gang of four - in
fact I think most patterns are a code smell and should be avoided
unless you are into J2EE or really buy into OOP, which I don't ;). OK,
I am exaggerating, but I hope you can see my point. Really, how many
patterns do we use in SciRuby or other software projects?

As I said, it's just my suggestion, I'd take Ruby Design Patterns over the Pick Axe for any level of programmer, but YMMV.

Magdalen Berns

unread,
May 31, 2014, 1:08:22 PM5/31/14
to sciru...@googlegroups.com
Gentlemen, please. There are enough books to go around! ;-)

Magdalen Berns

unread,
Jun 9, 2014, 4:05:49 PM6/9/14
to sciru...@googlegroups.com
Just to let you know I managed to get hold of this book now and I agree it's exactly what I needed!!! +++1
Reply all
Reply to author
Forward
0 new messages