Hacker News new | ask | show | jobs
by 10dpd 3645 days ago
Technologies used for a static list (!):

react redux reselect aphrodite material-ui stylz redux-form react-helmet webpack faker lodash moment

7 comments

Do you actually have a problem that any of those are causing?

I mean the site comes in at around 500kb transferred. That's not small, but it's also not obscenely large. A single large-ish image can easily blow that out of the water.

Yeah, it could afford to lose some weight in the javascript (although looking at it now, i'm not sure they can. much of the size of the javascript is string literals for all of the options for each phrase), but for a one-off website that doesn't have any ads or source of income, i think it's great. The author clearly wanted to make something cool, and doesn't want to spend a significant amount of time or effort optimizing it perfectly since he probably won't make a dime from it.

> Do you actually have a problem that any of those are causing?

With JavaScript turned off (an essential security precaution), no text is visible at all, which is a bit of a problem.

> I mean the site comes in at around 500kb transferred. That's not small, but it's also not obscenely large.

The actual content on the page really isn't that large. I got too bored to actually complete this, but you can see an example of what it could have looked like at http://pastebin.com/DBgK4Tv9

It could have progressively enhanced itself, taking the plain-text HTML page, parsing out the choices in the em tags (which could of course have had classes attached to mark them as choices, or even to indicate classes of choices, e.g. 'day-name'). It would have been a perfectly useful tool for people without JavaScript; it would have been perfectly useful printed on a page.

And, frankly, it would almost certainly have been a lot smaller than 500K.

That doesn't take away from how cool it is: the author did a nice, exhaustive job (so exhausted I got exhausted trying to recreate it). He should be commended for it. But we should all reflect on how we got into a situation in which the easiest thing for him to do was the wrong thing, and how we can instead get into a situation where the easy thing is the right thing.

Well, I disagree with you on disabling javascript being an "essential security precaution", but that's another discussion...

As for the rest, there's also the point that the author probably wouldn't have done this that way. That seems like a dumb sentence, but hopefully i can explain it.

This kind of thing isn't going to make any money, even with ads this is an niche thing and would probably end up making him tens of dollars at most (unless he got really lucky). That means that most likely his motivation was to "show off" a bit. Show potential employers that he can use those technologies, show off his professional skill, and at the same time solve a problem that he saw himself. So most likely it wouldn't have been made without those technologies.

But either way, I don't think that this is the wrong way of doing things. I know that many disagree with me, but for most "web apps" progressive enhancement is dead. Yeah, for a simple company website, or something which should be accessed by as many people as possible like government websites, PE is still very alive, but for everything else, it's done. Javascript is part of the platform, and disabling javascript but still expecting a fully useful web is like disabling python and still expecting all of your linux tools to work the same (after all, those same devs could have written their code in C, then progressively enhanced it with python).

It's part of the platform, and it's here to stay. Disabling javascript is not the solution to security issues.

> I know that many disagree with me, but for most "web apps" progressive enhancement is dead … Javascript is part of the platform

It shouldn't be, it really shouldn't be. The web should be about GETing, PUTting, POSTting & DELET(E)ing resources (i.e., documents); it shouldn't about GETting executables.

There's definitely a place in the world for a well-thought out universal executable platform, but HTTP + HTML + CSS + JavaScript ain't it.

Progressive enhancement is a good thing: a document which used JavaScript to become a better, live version of itself would be better than an ASCII list of neat things doable with the Google interface; it'd be better than a static HTML document. And it'd be better than a single-page app.

> It's part of the platform, and it's here to stay.

JavaScript delenda est.

>It shouldn't be, it really shouldn't be.

See, but why shouldn't it be?

Would it be valid for me to say that python shouldn't be a part of linux? That people should stop using python on their linux command line tools because linux is really about C.

The web is an application platform, and I still haven't heard any convincing arguments as why we shouldn't use it as one besides "Because it wasn't one in the past".

I agree that progressive enhancement is a good thing, and in a perfect world every application would start with the bare minimum and work up the "technology tree" to get to the latest and greatest, but in the real world of limited time and money that's almost never possible. Having something that's not perfect is better than not having anything at all.

> Would it be valid for me to say that python shouldn't be a part of linux? That people should stop using python on their linux command line tools because linux is really about C.

Somewhat fair point, but at least it would cut out the number of language runtimes one has to have on a Linux computer. For simple command-line tools, besides C/C++, you end up needing Perl, Python, Ruby, and now probably also Go and Rust.

> Having something that's not perfect is better than not having anything at all.

Arguable. The Internet is a perfect example of having a lot of things that would be better off not existing in the first place. Like, e.g., most of the sites for which ads are the only viable business model. But that's a longer discussion.

I think the important point is that, while the individual choices of a software engineer in a particular time and moment can be excused, the trend as a whole is pushing us towards increasingly batshit insane pseudo-engineering.

A static list like that should not need anything more than plain HTML/CSS and a little bit of JavaScript sprinkled on top to do the click effects. That people end up using shit ton of frameworks and external services for simple sites (this one is far from the only case) suggests that there's something very wrong with the industry as a whole. It's worth identifying it and figuring out how to fix it.

yeah, and whats all this about mobile apps? a phone is for making phone calls, not browsing web pages and playing games. these thibgs would be better off if you called a phone number that would read out the weather to you and so on. If you want to leave a text message or an email, you should call up a phone service and tell them to write the email for you.
> Do you actually have a problem that any of those are causing?

User experience.

- long, unskippable animation on site load

- navigation keys (arrows, page up/down) do not work at all without changing focus first (which takes 4 tabs)

- navigation keys do not work at all in category list (items can't be selected or scrolled)

- mousing over items produces unexpected results (text changing, distracting animation)

These may not be caused by the technologies per say, but more generally by the 'form over function' attitude.

Why does everything on the web have to be so fancy these days?

  > Do you actually have a problem that any of those are causing?
Inability to select the text.
That's because the author set the css property `user-select` to `none`.

Why? I'm not sure, but that has nothing to do with any of the libraries listed, or even javascript at all.

I assume it is because you can click on the commands to cycle through the examples. If you didn't have this css property set you would end up selecting text.
Does it work on screen readers? I mean the site is trying to explain voice control, after all.
yes actually it does!

It needs some work with focusable things, I needed to use the special navigation keys (I tested with ChromeVox on the desktop) to get to the lists on the left and right, and to click on anything i had to use the special "click" keybinding instead of pressing enter, but it's 100% usable.

On android it works great, about the same as any other website or app (i used the android accessibility screen reader to test)

Modern screen readers are just as capable as the rest of the browser, the only place they fall short is in image-heavy sites that don't have alt tags. Obviously you can greatly help by adding things like aria tags, and using markup as much as possible, but it's not like they just don't run javascript.

Note this doesn't work with VoiceOver at all.
When you say it doesn't work at all, what do you mean? There's no reason it won't read at least the "ok google" at the top of the screen, but navigating around probably won't work here.

I don't have a mac on hand right now, but VoiceOver relies heavily on tags, so i'd bet the problem is that he is using divs for everything.

Make each thing on the left render in an <li> and use header elements at the top of each block of commands and it should work fine.

At the time of this comment, looks like the site's been hugged to death.

So without knowing what's on it, maybe a smaller size could have kept it from falling over.

I can't wait until the web becomes decentralized so there is no Slashdot/Hacker News effect anymore. The more popular a site, the more people mirroring is a much more sane setup than the current silos.
You could load static html and have it on google drive without a huge of death. :P
I've done similar with my Django stack - used way more code than needed for something simple. The reason is - if you've got a good boilerplate it's quicker and easier to use it than to start again - even if you don't need half the pieces.
It also features a toggleable sidebar, an inline interactive search/filter bar and a modern UI with good visual feedback. Not as trivial as plain li and ul.
Interactive search/filter bar: Alt+F
... which doesn't hide the uninteresting context around the commands in question, and doesn't cluster the commands with the same text together for convenient viewing.
Why not curl | grep?
Frankly, a lot of websites would be infinitely more useful if they were curl | grep friendly. It's like current generation doesn't realize that it is technically possible to fetch valuable information you need efficiently from the Internet - one just has to not make it insanely difficult on purpose.
It's not a static list, though: mouse over or click on the entries.
I just get another element when I click but the question remains the same. Is there anything more?

Looking at the source, I guess, for example, that the questions "How old is X" are all where X is

"Adam Sandler", "Adele", "Akon", "Alec Baldwin" "Alicia Keys", "Alyssa Milano", "Angelina Jolie", "Ashton Kutcher", "Avril Lavigne", "Barack Obama", "Barbra Streisand", "Ben Stiller", "Beyonce", "Bill Gates", "Bob Marley", "Brad Pitt", "Britney Spears", "Cameron Diaz", "Carmen Electra", "Catherine Zeta Jones", "Charlie Sheen", "Chris Brown", "Christina Aguilera", "Cindy Crawford", "Daniel Radcliffe", "David Beckham", "David Duchovny", "Demi Moore", "Dr House", "Drake", "Drew Barrymore", "Eddie Murphy", "Eminem", "George Clooney", "Gwen Stefani", "Halle Berry", "Hugh Grant", "Jack Nicholson", "James Cameron", "Jason Statham", "Jay Z", "Jennifer Aniston", "Jennifer Lopez", "Jennifer Love Hewitt", "Jessica Alba", "Johnny Depp", "Julia Roberts", "Justin Bieber", "Justin Timberlake", "Katherine Heigl", "Katy Perry", "Kelli Williams", "Kesha", "Kevin Costner", "Kim Kardashian", "Kristen Stewart", "Lady Gaga", "Leonardo DiCaprio", "Lil Wayne", "Lionel Messi", "Madonna", "Marilyn Manson", "Marilyn Monroe", "Megan Fox", "Michael Douglas", "Michael Jackson", "Michael Jordan", "Michelle Obama", "Mike Tyson", "Miley Cyrus", "Muhammad Ali", "Nicki Minaj", "Nicolas Cage", "Nicole Kidman", "Oprah Winfrey", "Paris Hilton", "Pink", "Reese Witherspoon", "Rihanna", "Robert De Niro", "Robert Pattinson", "Roger Federer", "Ronaldo", "Sandra Bullock", "Sarah Jessica Parker", "Scarlett Johansson", "Selena Gomez", "Shakira", "Stephenie Meyer", "Steve Jobs", "Steven Spielberg", "Taylor Swift", "Tiger Woods", "Tom Cruise", "Tom Hanks", "Tyler Perry", "Uma Thurman", "Whoopi Goldberg", "Will Smith", "Woody Allen",

It's easier to look at the list than to click every time for one random item from it.

Interestingly, the first person Google recommends to me when I type "how old is" is not on the list.

My guess is that the list is a representative sample, and the dynamic nature is to indicate that it's variable. Google will correctly answer that question for anyone who has their own Wikipedia page with a birthdate (Try 'how old is Richard Stallman') so seeing the "full list" is not a useful piece of information
Also: html, css, js, tcp, ip, electricity, and language.
Also DNS, Apache, CloudFlare, Linux, images, Fail2Ban, Ethernet, the server's CPU/Memory/Motherboard, the phone network.

All this for a static list, he could have just faxed us all this list instead like in the good old times.

Fax!?? This is exactly what chisels and stone tablets were made for.
Real hipster used a the service of a professional Griot.

https://en.wikipedia.org/wiki/Griot

> electricity

Since we're going there - bloating your website for no reason whatsoever wastes electricity. Not just for the mobile users who may be annoyed by fast-draining battery; also in general, you're literally wasting coal.

It's worth at least keeping in mind when deciding to include that another JS framework to save yourself 10 minutes of typing.

You honestly worry about how much extra coal your website will consume with an extra JS framework?

I tend to think of CPU time as an almost inexhaustible resource for a website. It needs to be responsive, but the difference between the user's machine being at 5% or 10% CPU doesn't matter.

Somebody needs to. First, consider that every decision like that you make is multiplied by the number of clients you have. If your tiny little JS side makes your clients' CPU use one more watt and you have a million visitors, then boom, one megawatt goes down the drain. Maybe not something that should keep you up at night, but still IMO worth thinking about.

Moreover, your website isn't the center of the world and the most important thing for user. If every developer follows this line of thinking, then the difference between 5% and 10% of user's CPU time is the difference between them having 20 or 10 browser tabs open before the whole computer slows down to a crawl. Bloating your site means making your users' computers less useful.

I know, people should use IPs instead of fancy domain names, DNS is just electricity wasting.
You're right, css and js aren't needed either.
It's ok - it's made with <3
And depending on the toolchain the author chose, it may also be made in less time than it'd take to hand-roll <li> and <ul> tags into a list.
With a decent editor, hand-rolling <li> and <ul> tags ain't too bad. With a good scriptable editor, hand-unrolling the different options is also surprisingly easy.
I agree. In this specific case, assuming the author had to type-out (or paste) the actual contents of the list, then "hand-rolling" it into a HTML list using a decent editor will be less (probably much less) work than plugging in all that JS cruft.

And, it only happens once, instead of wasting a tiny bit of electricity for computing the exact same thing for every visitor.

It's a modern javascript broh