Attr_reader, attr_writer lesson very poorly thought out


#1

Hi Folks,

Computer Science Graduate checking out codecademy to quickly learn Ruby.

The attr_reader, attr_writer lesson will leave people confused.

You bring in way to quickly the idea, and show something new (name= ) and then have them remove it...

Also you need to show that PersonInstance.name = 'Chris' won't work without using name= or attr_writer :name

Also you should explain why attr_writer takes a symbol instead of a string

Thanks,
Mike


#2

Yes. Exactly. I've been having trouble with the core concept behind this particular subject. I understand when to use them and what they do, it's the reasons for everything involving reading and writing etc...

I'm aware that this is a hazy question, but that's because my grasp of attr_reader is hazy. I guess I'd love a clearer picture of how and why they are used. AND yes, as you wrote, I didn't realise that PersonInstance.name = 'Chris' wouldn't work without them.

Thanks.


#3

I am thoroughly confused by attr_reader and attr_writer. I wish the lesson was much clearer and/or used some better, real-world examples.


#4

My exact sentiment too. Real easy lesson to pass but in trying to 'understand it' on my own, Im at a loss...starting with how to even call the variables value, let alone rewrite it. If someone could just copy n paste an example of their syntax (IE, calling out the variable as well as changing it, that would be helpful!). I can kind of guess the putting it into Symbol significance ('a more 'absolute' value to the computer and easier for it to trace or track down'??) but further explanation on that would also be appreciated