Hacker News new | ask | show | jobs
by tholman 2779 days ago
Google will also happily surface a stackoverflow article from 2010 about how to solve a js problem... frustrating the top 3 answers will be with jquery, when its not the approach someone would take in the last 5 years.

Definitely frustrating, but also showing some need to retire specific pieces of the past away from the top recommendations.

8 comments

You have hit on a major problem there. Stack Overflow was once the fount of all useful genius grade knowledge, but times change and some of the top answers are plain wrong.

Take for example the 'how do I centre a div' type of question. You will get to find an answer with thousands of up-votes that will be some horrendous margin hack type of thing where you set the width of the content and have some counter intuitive CSS.

In 2019 (or even 2017) the answer isn't the same, you do 'display: grid' and use justify/align: center depending on axis. The code makes sense it is not a hack.

Actually you also get rid of the div as the wrapper is not needed if using CSS grid.

Now, if you try to put that as an updated answer you find there are already 95 wrong answers there for 'how do I center a div' and that the question is 'protected' so you need some decent XP to be able to add an answer anyway.

The out-dated answer meanwhile continues to get more up-votes so anyone new to HTML and wanting to perform the simple task of centering their content just learns how to do it wrongly. And it is then hard for them to unlearn the hack to learn the easy, elegant modern way that works in all browsers.

Note that the top answer will have had many moderated edits and there is nothing to indicate that it is wrong.

SO used to be amazing, the greatest website ever. But the more you learn about a topic the more you realise that there is some cargo cult copying and pasting going on that is stopping people actually thinking.

With 'good enough' search results and 'good enough' content most people are okay - the example I cite will work - but we are sort of stuck.

I liken Google search results to a Blockbuster store of old. Sure there are hundreds of videos to choose from but it is an illusion of choice. There is a universe of stuff out there - including the really good stuff - that isn't on the shelves that month.

Google are not really that good. They might have clever AI projects and many wonderful things but they have lost the ball and are not really the true trustees of an accessible web.

>you do 'display: grid' and use justify/align: center depending on axis. The code makes sense it is not a hack.

It also doesn’t work on IE latest or Edge.

The HTML is extremely naive in this question and I wouldn't expect it to work on any computer given the multitude of flaws.

Just because the kid who can't walk on two feet can't ride a bicycle doesn't mean all bicycles are broken.

Have you been reading SO answers?!?

It works fine in Edge. Why don't you try?

IE latest - there is no such thing.

The latest steam engines, the latest CRT screens and the latest buggy whips probably don't do CSS Grid either.

IE exists for compatibility with enterprise apps but isn't 'latest'. It is legacy.

And the content will still work even if CSS Grid is not supported, just the layout won't be perfect.

Checking here: https://netmarketshare.com/browser-market-share.aspx

It looks like IE is still the #3 browser, ahead of both Edge and Safari.

Internet Explorer is a compatibility solution. It is there to run the old stuff. It is still kept secure but it is not getting any new features, there is Edge for that.

The statistics you quote are meaningless. Go to another statistics provider and you will get different stats again. Include mobile and Safari suddenly becomes rather major.

Supporting a depreciated browser is not the way to go. This has to be understood, the methodology of where the stats comes from is also mysterious, given how much of he internet is click fraud bots who knows what is what?

Heavily depends on your target market, neither does it just hurt to say "This browser is unsupported for being too outdated" we do it for <noscript> why not <nopropercss> :/
There are plenty of developers, myself included, that would prefer to approach tasks like this without having to ever lay our fingers on CSS.
You should change fields then. CSS is amazing and not going anywhere.

It's one leg from the tripod letter soup (HTML, CSS and JS) on which the Web stands.

I consider wanting to center something a simple task. Yet the web makes it surprisingly counter-intuitive. So that was why I chose this as an example.

I am intrigued as to how you do this simple centering task without using CSS - it is a web page we are talking about here, not some other application that has sensible layout tools.

So please share what you know - it is a simple task - how do I center something - anything - vertically and or horizontally - in HTML without using CSS?

I'm not sure wether or not to apply Hanlon's razor to the W3C, but regardless, the W3C is to blame for this mess. Took us twenty years to get to Grid based layouts.
And it’s a little ironic that JavaScript’s tongue-in-cheek namesake, Java, had grid based layouts in swing 20 years ago.

OTOH, and to be fair, 20 years ago HTML was for newspaper / magazine like text layout, and grid based layouts are great for single page apps. The thing that’s happened more recently than 20 years is the web changed from text & media content in a static scrolling page layout to all pages are applications.

I agree that it's frustrating (also happens to me all the time) but would argue that it's stackoverflow's fault. They are, after all, supposed to curate the content to make sure it stays relevant, up to and including deleting questions. At the very least it should be easier to get the accepted answer chenged so at least it's at the top of the page (I can't be bothered to spend enough time gaming the system to get the 2000 points necessary to do this).
jQuery is still the right tool for a lot of tasks, HN bouble hype notwithstanding.
I feel this too, the "Tools -> Results within the Last Year" (&tbs=qdr:y) is necessary for searching programming issues these days.
What's wrong with using jQuery in 2019?
When I want do do some small DOM manipulation I can now just use standard Javascript, jQuery went from providing an essential service smoothing over browser differences to just providing better syntax in that space. When I want to do more, often React or similar is a better fit. So I end up barely using jQuery anymore.

That said, I can imagine quite a few scenarios where it would still be the right tool for the job.

It’s a JavaScript tool that existed 5 years ago.
No, it's because modern Javascript has now solved the problems that jQuery originally solved. Chiefly DOM manipulation and AJAX requests. It's still a fine library, but jQuery is just no longer needed.
There are more links to old articles from high quality pages, pagerank algorithm favors those as they are higher quality. Jquery still works and was in use for so long that all people who maintain older sites are still linking to those articles. Eventually as the jquery sites are retired or rewritten pagerank will surface non jquery related articles.
So, what should I use instead of jQuery these days? The task at hand: set up PhotoSwipe for a completely static list of images.
i have no problem with the jquery part, the problem is that the same question has a more recent answer so i constantly have to use date filters