curriculum icon indicating copy to clipboard operation
curriculum copied to clipboard

Ruby/Javascript: Linked Lists -- Make clear the structure of the Node class

Open SumonGFC opened this issue 1 year ago • 1 comments

Checks

Describe your suggestion

I have seen people in discord (ruby-help channel) express some confusion over the structure of the Node class in the Linked List project. For reference, the node class is described as:

(Ruby) "Node class, containing a #value method and a link to the #next_node, set both as nil by default."

(Javascript) "Node class / factory, containing a value property and a link to the nextNode, set both as null by default."

I propose we change the descriptions to this:

(Ruby) "Node class, conatining two instance variables, value and next_node, set both as nil by default."

(Javascript) "Node class / factory, containing a value property and a nextNode property, set both as null by default."

Admittedly, the Ruby description is more confusing than the JS description: it specifies #value and #next_node as instance methods, with #next_node somehow "linking" to the next node in the list. But what is really to be inferred from this is something like "The node class should have 2 instance variable, @value and @next_node, with getters and setters for both of them. The @next_node variable will store a reference to the next node in the list".

My intention with my proposed changes is to make explicit the structure of the class without explicitly explaining exactly how the nodes of the LL will be linked to each other.

Path

Ruby / Rails, Node / JS

Lesson Url

https://www.theodinproject.com/lessons/ruby-linked-lists#assignment

(Optional) Discord Name

No response

(Optional) Additional Comments

No response

SumonGFC avatar Aug 28 '24 17:08 SumonGFC

Seems like mostly a good idea to me. I think the Ruby one would be clearer if learners were exposed to more interface behavior type instructions, but that's not the case with the current OOP lessons and other projects.

Anyways, since your descriptions seem good to me. I'll assign you.

JoshDevHub avatar Aug 28 '24 21:08 JoshDevHub