This is a fantastic explanation of symbols in Ruby. I love the detail and technical explanation when it comes to storing objects in memory with Ruby yet the elegant simplicity of how you phrase and explain these concepts step by step. I've been working as a junior RoR developer for a few months and this video cleared up a lot of misconceptions for me. Thank you!
I love you explanination with details and context. I come from other programming languages and stugling syntax in rails for a long time. This video make everything pretty clear.
Excellent explanation of ruby's features. I like your condensed deep dives! i was unaware of the implied optional inclusion of a hash as the last argument of any method call. Also is this more compact representation of hashes good for multi-dimemsional hashes? (Ex: see fortran arrays)
Use symbols actually don't make sense anymore, cause every Ruby string is going to be frozen in memory by default. Today you can do it using .freeze method or add this comment line at the top of any ruby file: # frozen_string_literal
Yeah the goal is to make static strings closer in performance to symbols. I'm not sure if they are quite as performance as symbols, so I'd still recommend using them over strings. Plus symbols convey that it's something reusable like a hash key, which helps differentiate your code better at a glance.
@@GorailsTV I've benchmarked use the different types of keys in a hash. The results: Symbol: 9.550638 0.006868 9.557506 ( 9.571867) String: 15.660584 0.006830 15.667414 ( 15.678722) Frozen String: 10.984252 0.004975 10.989227 ( 10.993361) So the frozen string is performance enough to be used in hashes :)
That doesn't take into account garbage collection and things right? I can't remember if it handled them differently. Either way, I'd still recommend symbols for keys that never change and strings only when you need dynamic keys.
This is a fantastic explanation of symbols in Ruby. I love the detail and technical explanation when it comes to storing objects in memory with Ruby yet the elegant simplicity of how you phrase and explain these concepts step by step. I've been working as a junior RoR developer for a few months and this video cleared up a lot of misconceptions for me. Thank you!
Underrated content, finally an easily understandable explanation
I love you explanination with details and context. I come from other programming languages and stugling syntax in rails for a long time. This video make everything pretty clear.
Glad we can help! Anything else you've been struggling on with Ruby?
For me ruby itself is straightforward unless you step into rails world. Things get weird and confusing.
Great explanation. You're single handedly carrying the Rails community on your back I swear
That makes my day!
Good gracious, I've been confused about the use of symbols in Rails since started learning it. Thank you so much!!
It suddenly started to make sense when you did a demo with an object id property.
Really great explanation, please do more of these!
Awesome tips! Thanks!
Very clear explanation. Best ROR channel
Nice explanation and easy to understand.. Thanks Chris..
Also worth noting with symbol comparison ruby only needs to compare object_id's. With strings ruby has to compare the actual data.
awesome explaination, thank you so much!
Amazing tutorial. Thank you very much!
Great explanation, thank you!
Excellent explanation of ruby's features. I like your condensed deep dives! i was unaware of the implied optional inclusion of a hash as the last argument of any method call. Also is this more compact representation of hashes good for multi-dimemsional hashes? (Ex: see fortran arrays)
super helpful. thanks man
Let me know if there are other concepts you'd like a video on!
thanks
Very clear explanation, thank you!
thank you! very helpful
Very nice explanations!
May I ask you what editor you use?
MacVim + github.com/excid3/dotfiles
@@GorailsTV Thank you:-)
Thank you, I now understand symbols. Great job!
what's that intro soundtrack? I heard it once in a game but struggled to find it
It's a track I bought on audiojungle. Forget the name.
Thank you Chris. Is it still relevant to learn ROR in 2021?
Absolutely. In fact some really amazing new stuff just came out and the community is growing a lot latrly
Awesome
Hard to see this video on mobile
Thanks for Sharing This.
Use symbols actually don't make sense anymore, cause every Ruby string is going to be frozen in memory by default.
Today you can do it using .freeze method or add this comment line at the top of any ruby file:
# frozen_string_literal
Yeah the goal is to make static strings closer in performance to symbols. I'm not sure if they are quite as performance as symbols, so I'd still recommend using them over strings. Plus symbols convey that it's something reusable like a hash key, which helps differentiate your code better at a glance.
@@GorailsTV I've benchmarked use the different types of keys in a hash. The results:
Symbol: 9.550638 0.006868 9.557506 ( 9.571867)
String: 15.660584 0.006830 15.667414 ( 15.678722)
Frozen String: 10.984252 0.004975 10.989227 ( 10.993361)
So the frozen string is performance enough to be used in hashes :)
But of course, it's still handier to use ruby symbols for this.
That doesn't take into account garbage collection and things right? I can't remember if it handled them differently. Either way, I'd still recommend symbols for keys that never change and strings only when you need dynamic keys.
You tried but it didn't help.