tag:blogger.com,1999:blog-6793817269158736634.post1548126962022424340..comments2023-07-11T06:44:05.157-07:00Comments on Code It Like You Stole It: Using class_eval to add methods to a classTylerhttp://www.blogger.com/profile/02372203985854517525noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6793817269158736634.post-61793153305299751612011-03-02T16:05:05.922-08:002011-03-02T16:05:05.922-08:00RE: threads vs forking, you are absolutely correct...RE: threads vs forking, you are absolutely correct. Forking is about duplicating processes, threading is about splitting a single process.<br /><br />RE: very little to Ruby, yes that is exactly what I did. Everything else in Ruby is just more of the same, layered on to let you handle more complex things.<br /><br />So which is it, are you excited to learn more or will it be a while before you're ready for something new? Those were to conflicting statements!Elijah Millerhttps://www.blogger.com/profile/11416221333112662701noreply@blogger.comtag:blogger.com,1999:blog-6793817269158736634.post-54835577922381199462011-03-02T15:58:51.588-08:002011-03-02T15:58:51.588-08:00I just did some work with threads while finishing ...I just did some work with threads while finishing up that chapter. So threads work similarly to fork and exec? That's the feeling I got, but it seems more like forking splits the program into two programs that run concurrently, whereas threads divides a process into smaller processes that run at the same time. <br /><br />I've bookmarked that site, but it'll probably be a while before I'm ready for something new. The next chapter in Beginning Ruby is about tying everything together into a larger project and the chapter after that is about Ruby on Rails. <br /><br />I get the feeling you showed me how little there was to Ruby so I wouldn't feel intimidated, but I'm really enjoying what I've been learning and I'm hungry for more!Tylerhttps://www.blogger.com/profile/02372203985854517525noreply@blogger.comtag:blogger.com,1999:blog-6793817269158736634.post-17145967994299752302011-03-02T05:58:34.836-08:002011-03-02T05:58:34.836-08:00You're right about class_eval and friends, it&...You're right about class_eval and friends, it's a permanent definition, and it is seemingly easier to do it without class_eval. Occasionally though, you have no idea where a bit of code will be used, so you need to make the class it can reside in dynamic, similar to modules. These *_eval methods are usually used when the maximum amount of metaprogramming magic needs to be used to achieve a goal.<br /><br />To be honest, fork and exec are rarely used, but they are quite useful. Mainly they are used as an easy way to avoid threaded programming, and to spread normally single-processor Ruby code across more than one cpu. It's good that you're trying to get a grasp on these, but be aware that it is a rarely used feature for most Ruby programmers.<br /><br />As far as next resources, if you feel like jumping straight into Rails, the Rails Guides [1] are an excellent resource. You could also do some of the Ruby programming challenges, but while mind-bending and fun, these are often not very useful and can lead you down roads that lead to very little that is productive.<br /><br />[1] http://guides.rubyonrails.org/Elijah Millerhttps://www.blogger.com/profile/11416221333112662701noreply@blogger.com