You search on google. You click links. Links lead yo pages that have Facebook like buttons. Facebook learned that you visited the page. Facebook has already prescraped the page and classified its content. Facebook now can show it in your feed.
You search on google. You click a link. That page has google ads. Google knows that you visited it. Google bids on facebooks ad exchange and sometimes wins the auction. Ads show up in the news feed. [Also works for any other advertising platform other than doubleclick(Google)]
You search on google. You click a link. The page has third party trackers that generate user lists that they sell. Facebook buys said user list. Facebook matches you in the list, and shows you a related ad.
Most likely its the first one.
What is certainly not happening:
You search on google. Click no links. You go to Facebook and see a related ad in the news feed.
Because to be really good at programming takes an almost obsessive devotion to honing your craft at a young age, and girls are far too social to spend their summers in front of a computer in the basement.
I would argue that that isn't the case at all. While I was one of those little boys who spent way too much time in front of a computer and video games as a kid, that is mostly NOT the case amongst my coworkers (I'm a software engineer at Google). Most seemed to pick it up in college when they chose it as a major, and didn't have much or any experience with computer science before then. I would argue the main difference between those who succeed here and those who don't is intelligence, a hunger to learn (rather than just tinker), and a good work ethic.
I don't mean to say that being locked away in your room as a child programming, etc, would hurt in any way. Again, that was mostly me as a child. I just mean that what matters most is an understanding of computer science and software engineering principles (Data Structures, Machine Learning, etc) not can you bang out a few thousand lines of code in a few hours. I never do that at work. I think it's more important to develop as a child the ability to learn, process, and make connections between ideas, and that can happen via learning in any field.
Just my 2 cents for what they are worth.
1. You can click on the domain and see the full url. It's not hidden completely, just have to click to see it.
2. URLs other than the domain name are an implementation detail. They mean nothing on their own, but only what the webserver behind that domain decides they mean. There's no url standard to adhere to. It's just chrome hiding unnecessary information and providing an easy to click search/url bar. While my initial reaction to seeing it was "WHAT?" after thinking about it a second I realized that I mostly ignore the url bar and just care about the domain most of the time. If I want to copy the link I can click on the domain and the whole url appears and is highlighted, or I do what I actually do and hit ctrl+L ctrl+C.
When I watch a tv show, I don't see all the details about what information is being passed to/from the cable provider and my box. Just the channel name. On the web, we don't see all the urls that are flying by with ajax, or iframes. We just see the main url which is usually not that helpful. This seems like a cleaner approach long term.