<zacts>
let me explain kind of what initial idea was
<havenwood>
zacts: I'd recommend starting there! Then bougyman's recommendations are great.
<zacts>
what my initial idea was*
<zacts>
oh I'll check it out havenwood
<havenwood>
zacts: yeah, what are you thinking?
<havenwood>
what's your initial idea?
<zacts>
ok, I was looking for something to learn oop with just a bit. so I stumbled on this list of books from pharo smalltalk: http://books.pharo.org/. the first one: Learning Object-Oriented Programming, Design and TDD with Pharo sparked my interest.
<zacts>
the issue I have with a bunch of ruby resources is that they seem to teach syntax, but not practical examples on how to actually design something in a practical sense.
<zacts>
I was thinking of starting with the smalltalk kind of idea to understand OOP just a bit, and then read something like eloquent ruby / well grounded rubyist to begin ruby
<zacts>
the above resource on Common Lisp does look interesting as well to me.
<apotheon>
zacts: Given a bit of technical knowledge and familiarity with things like shell scripting, and assuming you have knowledge *of* programming even if you're pretty new to *doing* it, I think Eloquent Ruby is a fantastic introduction.
<apotheon>
zacts: It'll give you a grounding in concepts of good software development that are rarely (if ever) presented together in other books, and I recall it being extremely well written to get its points across quickly and easily.
alexherbo2 has quit [Ping timeout: 258 seconds]
<apotheon>
zacts: Often, when you go looking for stuff about concepts of good software development, you end up either disappointed in the lack thereof or a book about some particular team-oriented software development methodology, neither of which is probably what you'd want as a lone beginner programmer. Eloquent Ruby fills that gap nicely.
<apotheon>
zacts: Everyday Scripting With Ruby was pretty good for something along those lines, too, but then Eloquent Ruby got published and it was, I think, at least twice as good for that purpose.
<havenwood>
zacts: While reading you might also like starting some exercises. You can get feedback on https://exercism.io/tracks/ruby problems here too.
<apotheon>
The only problem with Eloquent Ruby as far as I'm aware right now is that some bits of it might be slightly obsolete. It was written at a time when the current Ruby version was . . . not what we have now.
<apotheon>
It should be "close enough" to muddle through, though, and the focus on practical tools and basic methodology is difficult to find elsewhere.
mozzarella has quit [Quit: WeeChat 2.8]
bvdw has joined #ruby
<apotheon>
The closest I've seen to that (other than Everyday Scripting, which is evenolder than Eloquent Ruby) is Head First C, except that Head First C is a much more flawed book in general, and is slightly less useful for the practical tools and methodology stuff than Everyday Scripting.
<apotheon>
(and that's ignoring the additional flaws that basically all beginning C books share, with focus lying heavily on the wrong things a lot of the time, stuff being taught in a poor order for really making sense of the language, and so on)
oneeggeach has joined #ruby
<zacts>
havenwood: cool, thanks
<zacts>
apotheon: thanks =)
alexherbo2 has joined #ruby
<apotheon>
welcome
DTZUZU_ has joined #ruby
greengriminal has quit [Quit: Leaving]
DTZUZU has quit [Ping timeout: 258 seconds]
mozzarella has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
alfiemax has quit []
alfiemax has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
zacts has quit [Quit: leaving]
oneeggea_ has joined #ruby
oneeggeach has quit [Ping timeout: 260 seconds]
freshmaker666 has quit [Quit: ZNC 1.8.2 - https://znc.in]
freshmaker666 has joined #ruby
freshmaker666 has joined #ruby
freshmaker666 has quit [Changing host]
alfiemax_ has joined #ruby
lxsameer has quit [Quit: WeeChat 2.9]
alfiemax has quit [Ping timeout: 246 seconds]
Fort has joined #ruby
oneeggeach has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
oneeggea_ has quit [Ping timeout: 240 seconds]
<phaul>
&renick
rubydoc_ is now known as rubydoc
<rubydoc>
okay
xall has quit [Remote host closed the connection]
cnsvc has joined #ruby
Fort has quit [Remote host closed the connection]
imode has joined #ruby
freshmaker666 has quit [Quit: ZNC 1.8.2 - https://znc.in]
freshmaker666 has joined #ruby
freshmaker666 has quit [Changing host]
freshmaker666 has joined #ruby
cnsvc has quit [Remote host closed the connection]
jinie has joined #ruby
cnsvc has joined #ruby
Garb0 has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
zacts has joined #ruby
ellcs1 has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
cnsvc has quit [Quit: WeeChat 2.9]
ramfjord has quit [Ping timeout: 240 seconds]
GankMove has quit [Read error: Connection reset by peer]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
ramfjord has joined #ruby
oneeggeach has quit [Quit: Leaving...]
zacts has quit [Quit: leaving]
GankMove has joined #ruby
Garb0_ has joined #ruby
Garb0 has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 264 seconds]
dionysus69 has joined #ruby
Garb0__ has joined #ruby
Garb0_ has quit [Ping timeout: 256 seconds]
ellcs1 has joined #ruby
akem has quit [Quit: Leaving]
akem has joined #ruby
roshanavand has joined #ruby
orbyt99 has joined #ruby
<orbyt99>
e
<orbyt99>
Hey all
<orbyt99>
I've got a basic loop with an inner variable which does not appear to reset on the next iteration
<ruby[bot]>
orbyt99: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<orbyt99>
Basically I've got an array of "template" strings in an array called templates
<orbyt99>
In each loop, i'm grabbing a random template and using basic string substitution to to substitute placeholders with values
<orbyt99>
I added that puts statement on line 5 for debugging. I expect it to always print a non-modified template string from the templates array
<orbyt99>
However, sometimes it prints a string that looks like it's already had values substituted, which doesn't make any sense
<orbyt99>
My understanding is that ruby resets local variables each iteration, so i don't know why this is occuring
lxsameer has joined #ruby
<phaul>
prly you are manipulating the String object in place with sub!...
<orbyt99>
Ah I think I know what's happening
<orbyt99>
Someone check me on this
<orbyt99>
But i think it's modifying the selected value in the `templates` array itself
<orbyt99>
Does ruby not copy the object when assigning a variable?
<phaul>
it does not
<phaul>
usually it's not a problem if you use methods like sub instead that do copy and work on the copy
Garb0_ has joined #ruby
<phaul>
it's up to the programmer, and how the code needs to be optized. You could also copy with dup
<orbyt99>
Wait, isn't the problem higher up before the sub?
<orbyt99>
I thought the problem was `randomTemplate = templates[rand(0..templates.size - 1)]`
<orbyt99>
Yea, .dup i guess
<phaul>
yeah but if you don't modify the object in place there is no confusion
<phaul>
sub! does modify in place
<orbyt99>
Ok, so how would I do it without modifying in place? Would I just use `.sub`, without the exclamation, and then assign it to a new var?
Garb0__ has quit [Ping timeout: 240 seconds]
<phaul>
using sub instead of sub! is a more common way I think to avoid these problems in the ruby world. But again, it's up to the programmer how the code needs to be, just be aware why this is happening