On Oct 2, 2010, at 2:01 , Mike Stephens wrote:

> Often you see that Ruby can be object-oriented, functional or
> procedural.
>=20
> What would you expect to see in a program that made you say "Ah this =
is
> procedural Ruby!"?

Fewer classes, and heavy use of variables.

	mydata =3D File.open('myfile.txt').readlines

	funparts =3D Array.new

	loop mydata.size do |idx|
		funparts << =
mydata[idx][/regex-that-matches-fun-parts/,1]
	end

	for funpart in funparts
		puts funpart
	end


This code assumes that the data is 'dead.' It's just sitting there, =
waiting for me to act upon it.=20

I've really had to pay attention to my coding. I keep reminding myself =
that Ruby will flow much better if I don't think of data as something I =
have to manipulate myself, but rather as entities whom are expecting me =
to tell them to manipulate themselves. "Don't make me search through you =
looking for the fun parts! You should do that work yourself, and just =
tell me what you come up with!"

	puts (funparts =3D File.open('myfile.txt').readlines.collect do =
|line|
		line[/regex-that-matches-fun-parts/,1]
	end.compact).join("\n")

Instead of walking myself through the file contents line by line, =
picking out the good bits, I told the array to do it's own flippin' =
walking.=20


At least that's what I think procedure-oriented Ruby would look like.=20=