Ruby Basics: Symbols vs Strings

  Рет қаралды 10,570

GoRails

GoRails

Күн бұрын

Пікірлер: 40
@joey2545
@joey2545 5 жыл бұрын
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!
@ayuthmang
@ayuthmang Жыл бұрын
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.
@GorailsTV
@GorailsTV Жыл бұрын
Glad we can help! Anything else you've been struggling on with Ruby?
@ayuthmang
@ayuthmang Жыл бұрын
For me ruby itself is straightforward unless you step into rails world. Things get weird and confusing.
@RR-et6zp
@RR-et6zp Жыл бұрын
Great explanation. You're single handedly carrying the Rails community on your back I swear
@GorailsTV
@GorailsTV Жыл бұрын
That makes my day!
@ondrejsvoboda6207
@ondrejsvoboda6207 2 жыл бұрын
Underrated content, finally an easily understandable explanation
@jacinyan3893
@jacinyan3893 4 жыл бұрын
Good gracious, I've been confused about the use of symbols in Rails since started learning it. Thank you so much!!
@jackriminton7959
@jackriminton7959 4 жыл бұрын
Really great explanation, please do more of these!
@yp5387
@yp5387 Жыл бұрын
It suddenly started to make sense when you did a demo with an object id property.
@jakewoodruff13
@jakewoodruff13 Жыл бұрын
Awesome tips! Thanks!
@sherriffs2554
@sherriffs2554 5 жыл бұрын
Also worth noting with symbol comparison ruby only needs to compare object_id's. With strings ruby has to compare the actual data.
@faizan2006
@faizan2006 4 жыл бұрын
Nice explanation and easy to understand.. Thanks Chris..
@kaysong3800
@kaysong3800 Жыл бұрын
awesome explaination, thank you so much!
@ClaudineyPerbony
@ClaudineyPerbony 5 жыл бұрын
Very clear explanation. Best ROR channel
@aurontz
@aurontz 2 жыл бұрын
Amazing tutorial. Thank you very much!
@Ranterd
@Ranterd 2 жыл бұрын
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)
@Rod_Tolledo
@Rod_Tolledo 4 жыл бұрын
Great explanation, thank you!
@Lyrik-Klinge
@Lyrik-Klinge 3 жыл бұрын
Very nice explanations! May I ask you what editor you use?
@GorailsTV
@GorailsTV 3 жыл бұрын
MacVim + github.com/excid3/dotfiles
@Lyrik-Klinge
@Lyrik-Klinge 3 жыл бұрын
@@GorailsTV Thank you:-)
@karoskibinska4059
@karoskibinska4059 5 жыл бұрын
Very clear explanation, thank you!
@pavlo-vasylkivskyi
@pavlo-vasylkivskyi 4 жыл бұрын
Thank you Chris. Is it still relevant to learn ROR in 2021?
@GorailsTV
@GorailsTV 4 жыл бұрын
Absolutely. In fact some really amazing new stuff just came out and the community is growing a lot latrly
@cutliss
@cutliss 5 жыл бұрын
what's that intro soundtrack? I heard it once in a game but struggled to find it
@GorailsTV
@GorailsTV 5 жыл бұрын
It's a track I bought on audiojungle. Forget the name.
@RsZ789
@RsZ789 5 жыл бұрын
Thank you, I now understand symbols. Great job!
@davidlytikainen5815
@davidlytikainen5815 2 жыл бұрын
super helpful. thanks man
@GorailsTV
@GorailsTV 2 жыл бұрын
Let me know if there are other concepts you'd like a video on!
@默-c1r
@默-c1r Жыл бұрын
thank you! very helpful
@lorieldesamito3998
@lorieldesamito3998 2 жыл бұрын
thanks
@dc366
@dc366 5 жыл бұрын
Hard to see this video on mobile
@paulryan6269
@paulryan6269 4 жыл бұрын
Awesome
@elisson357
@elisson357 5 жыл бұрын
Thanks for Sharing This.
@AlexanderShelestov
@AlexanderShelestov 4 жыл бұрын
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
@GorailsTV
@GorailsTV 4 жыл бұрын
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.
@AlexanderShelestov
@AlexanderShelestov 4 жыл бұрын
@@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 :)
@AlexanderShelestov
@AlexanderShelestov 4 жыл бұрын
But of course, it's still handier to use ruby symbols for this.
@GorailsTV
@GorailsTV 4 жыл бұрын
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.
@Randych
@Randych Жыл бұрын
You tried but it didn't help.
The Rails Params Hash Explained
15:52
GoRails
Рет қаралды 26 М.
Ruby on Rails Application Structure Explained
14:04
GoRails
Рет қаралды 22 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 116 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 6 МЛН
Rails Concerns vs. Modules and when to use each
13:18
webcrunch
Рет қаралды 2 М.
Ruby's Symbols Explained
24:47
Peter Cooper
Рет қаралды 81 М.
How To Use Import Maps with Rails
18:12
GoRails
Рет қаралды 1,9 М.
Ruby Blocks, Procs, and Lambdas 🦁🐅🐻
25:42
CJ Avilla (cjav_dev)
Рет қаралды 17 М.
A Look into Routes and Routing in Ruby on Rails
9:57
GoRails
Рет қаралды 14 М.
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 188 М.
Performance with Database Indexes
15:31
GoRails
Рет қаралды 3,9 М.
Sandy Metz - SOLID Design Principle in Ruby
47:12
Imran Ismail
Рет қаралды 13 М.
Hash in Ruby
22:53
APPSIMPACT Academy
Рет қаралды 5 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 116 МЛН