When should I use the term "url" or "link"?

6

These days I started a "little debate" here at IT on this subject. I noticed that several functions, where we returned the path of the image (for the browser), was named getImageLink .

For example:

public function getImageLink() {

      return $this->base_url . '/imagens/' . $this->id . '.jpg';
}

The return of this would be:

'http://meusite/imagens/1.jpg'

Then I started to think that maybe "link" referred to an "url" used with the tag <a> . I do not know if my statement is correct, but in the end I decided to change the name of the methods, which are now called getImageUrl .

I picked up the custom by hearing people say "link" and "url" when it comes to the address of a website we type in the browser's navigation bar, for example.

Questions

  • From the programming point of view, should I call this "image path" (for the browser), "url" or "link"?

  • What is "link" and what is "url"? What's the difference between one and another?

  • To be "link", does it have to be clickable?

asked by anonymous 30.08.2016 / 17:12

1 answer

11

The "path" of an image, or any feature, is always a URL.

The acronym URL stands for "Uniform Resource Locator" and describes the naming pattern of the address of anything that might accessed on a network.

The term " Hyperlink " is derived from the concept of Hypertext and strongly associated with Web .

Because of the ubiquity of the Web, the 2 terms have become almost interchangeable since every link will point to a URL, and almost every URL you access comes from a link. Informally there will be no distinction or problem in using the 2 terms at will.

In the case of a function such as your example, what is being returned is a URL, not a hyperlink. This will be the case for most functions of this type, unless they exist to mount a hyperlink within a hypertext page.

I find it difficult for anyone reading your code to get confused if you use getImageLink instead of getImageURL , but the correct one would be getImageURL .

    
30.08.2016 / 17:24