That’s why I said “in the style of”: not the programming style, but
the web diffusion style (like a wiki).
Yes, I agree. Sorry, I wasn’t objecting to what you said directly, as
such, but just generally flagging up some of the website’s contents so
that other readers (hopefully) don’t start writing camelCase.
This site seems to have a few stylistic problems, as far as common
idiomatic Ruby goes. For instance there’s a lot of ignoring #each
Might not be the best introduction to Ruby for someone.
I agree!
That’s why I said “in the style of”: not the programming style, but
the web diffusion style (like a wiki).
A web page which has a stable and simple URL,
A web page which one can link to for several years.
– Maurice
I’m about to introduce Ruby to a group of people that is not familiar to the
language, and the approach i’d like to take is simply by distilling out a few
sample codes. I’ve been collecting some from around the internet, but i’d
appreciate your suggestions as well.
So am I, I will give a lightning talk about Ruby in a week.
Do you have any objection if I use some of the examples of this thread ?
It is not easy to find awesome examples when you are used to them, I
got a hard time finding some.
If you’re on OSX, I think this makes for a great example, though I
usually
take out the command line args and set the username and password in
another
file that I require.
On Wed, Sep 29, 2010 at 1:40 PM, Adriano F. [email protected]
wrote:
actually, such as:
Simplicity
Expressiveness
Productivity
Flexibility
Dynamism
Freedom
Happiness
I presented about Ruby last night to my school for the ACM at my school,
had
a few examples to show OO and functional paradigms, and an example to
show
that it is dynamic. We also did a rails example, we were giving away a
4gb
thumb drive, and so made a Rails app to select a winner from a list of
contestants, then put it on Heroku and let them go sign up for it
themselves.
Here were my code examples
And video of the presentation
One thing I’ll suggest is to have the code already printed out and
sitting
next to you. Then you can have that organic feel of writing it right
there,
which I think makes it easier to follow. But you can also save yourself
a
lot of headache of forgetting something when coding live. I’ll also
suggest
against a Rails example, because there is a lot of stuff going on in
Rails,
you have to keep lots of different things in your brain all at once,
which
is difficult to do while you are presenting, and I think the Rails
example
was the slowest part of the presentation.
I don’t see this as much of a good use of inject, to be honest.
I’d rather see this:
numbers = [1, 2, 3, 4, 6, 7, 8, 9]
numbers.each_cons(2) { |x, y| break x if x.succ != y }
or to get rid of the need to explain how break works and what succ is,
while allowing more readability, perhaps
numbers = [1, 2, 3, 4, 6, 7, 9, 10] # has a gap after 4 and 7!
gaps = []
numbers.each_cons(2) do |x, y|
gaps << x unless y == x + 1
end
gaps #=> [4, 7]
You’ll possibly have to explain each_cons, but I think it’s easier
than explaining inject to someone who doesn’t know Ruby or
programming. You also get to show off post-statement “unless”!