TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
9.99k stars 13.37k forks source link

Foundation: Links and Images > Metaphor for Absolute vs Relative links #25194

Closed xandora closed 1 year ago

xandora commented 1 year ago

Describe your suggestion

This was brought up in #25059, but probably needs to be an issue with some discussion put into it before being ready for a pull request. The metaphor (town, movies, shops) is a bit confusing and may need overhauling.

From the comments:

The explanation given by "The Odin project" is correct and my pull request is wrong. We are indeed in /museum/movie_room.html Reading this metaphor after 2 weeks, I now understand what they are saying.

As for your suggestion I think personally both the metaphors (one provided by The Odin Project and the other metaphor provided by you) are confusing. Let me try to explain:

Why The Odin Project metaphor is confusing In the museum example,

  • town is like root directory
  • museum is like a directory
  • movie-room is like a file inside museum directory (but it should be a directory)

So, why changing from one room(/museum/movie_room.html) to another(/museum/shops/coffee_shop.html) is given by ./shops/coffee_shop.html statement.

  • "." represents museum_ room
  • but movie_room.html is not mentioned here. There is no "getting out" of movie-room. No mention that we left movie-room

I think a better solution would be

  • town is like root directory
  • museum is like a directory
  • movie-room is also like a directory inside museum directory
  • movie-room contains old movie reels which are like files. Some files are The Wizard of Oz.reel, Goldfinger.reel etc.
  • shop is a room containing all the shop related rooms (we can remove this shop directory if u want)
  • antique-shop is a directory
  • antique-shop contains vintage.radio file

Now if we are movie-room and we want to go to locate vintage.radio we can go through this path ../shop/antique-shop/vintage.radio

  • .. is saying go to parent directory of current room (movie-room) which is museum (notice here, that movie room is also mentioned here)
  • /shop is saying go to shop
  • ../shop/antique-shop/vintage.radio is relative path to locate vintage.radio from movie.room

Possible visual aid to better understand the issue:

image

Path

Foundations

Lesson Url

https://www.theodinproject.com/lessons/foundations-links-and-images#absolute-and-relative-links

Checks

(Optional) Discord Name

No response

(Optional) Additional Comments

No response

wise-king-sullyman commented 1 year ago

So in our discussion on this issue we're leaning towards trying to just replace the metaphor with a suitable external resource.

PaulooMartin commented 1 year ago

Hey, I want to propose a metaphor for this one.

How about representing a website (eg. https://www.theodinproject.com or a locally hosted one) as a house/home. Then, each house will have individual rooms such as the kitchen, the master's bedroom, and so on. Linking to another house will use an absolute link, however linking to any room inside my house will use a relative link.

I live in my own home - let's say it's TOP's website (https://www.theodinproject.com/).

It's not a complete metaphor, but it's just a proposal of some sorts.

wise-king-sullyman commented 1 year ago

Hmmm yeah, a reframing of the metaphor like that might clear up some of the confusion here. @xandora WDYT?

KevinMulhern commented 1 year ago

It's pretty close to the original version of the metaphor. I may be a little biased lol but I'd like to go back to something like that too. The intention was always to have a simple metaphor to help learners build a mental model of the differences between absolute vs relative.

JoelBejot commented 1 year ago

Hi all! I have a couple thoughts about this as well. Thinking about metaphors, I think of directories as places to be and files as things to do, or objects to use or manipulate. So if the analogy terminates in a room, that's still just a place to be. I'd rather the analogy terminate with an object, such as a couch, frying pan, or computer.

I also think extending the analogy just a bit to protocol and domain would help, like this. Protocol is a way to get somewhere (https or ftp) and domain is just what you think it is - a unique location that one person or entity owns or has some sort of control over.

So, we drive down the road to my friend's house (protocol), arrive at their house (their domain), and set foot on their property (root directory), and enter the living room. The address from anywhere in the world, then, is: highway123.friend's-house.com/living-room. Chances are good I'll run greet.exe and imbibe.beer from the living room, before possibly changing rooms to ./kitchen, where we'll run the program dinner.party.

You can see that once we are in the house, we no longer need to know how to get there (the protocol), or what the address is (the domain). We just need to know what room we are in, and what we are doing in each room. I.e., absolute vs. relative links.

Idk, what do you all think?

github-actions[bot] commented 1 year ago

This issue is stale because it has had no activity for the last 30 days.