?

Log in

No account? Create an account
Man, Javascript is still kind of dumb - Greg [entries|archive|friends|userinfo]
Greg

[ website | gregstoll.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| * Homepage * Mobile apps (Windows Phone, Win8, Android, webOS) * Pictures * LJBackup * Same-sex marriage map * iTunesAnalysis * Where's lunch? ]

Man, Javascript is still kind of dumb [Oct. 10th, 2016|10:00 pm]
Greg
[Tags|, , , , ]
[Current Mood |irritatedirritated]

I'm working on rewriting my floating point to hex converter with React. This time I thought I'd do it "right" and use all the nifty Javascript tools that everyone complains about instead of just putting a bunch of inline Javascript/JSX in an HTML file, even though that works well enough. Long term, I'd like to rewrite the marriage map with React and D3.js, so I thought this would be a good dry run.

But, maaaaan:
- I literally had to buy a React+d3.js ebook to figure out how to get all this crap set up. (the book is pretty good, by the by)
- The book recommends starting from a particular git repository. To clone that on my linux machine I had to set up some SSH key stuff, which seemed like overkill. (why do I need to do that for anonymous access?)
- To set it up, it downloads something on the order of 300 packages through npm. I wish I were exaggerating.
- Building it (even without minifying the source!) takes a solid 6 seconds on my desktop machine. This is for a ~100 line javascript file. The non-minified version is more than 2 MB of Javascript! Even the minified one is ~180K, which seems like way too much.
- React now recommends you use ES6 instead of calling React.createClass(), and there are some niceties there. But there also some stupid gotchas, like the fact that you have to call .bind(this) on every method for it to be able to access this, because Javascript is the worst.
- For some reason I'm not able to debug with Firefox's debugging tools. (luckily Edge seems to work well)
- I wasted an hour because the new fancy fetch standard (not supported in some versions of IE so you need a polyfill) has a method called text() that returns the text of the response. Wait, no, it actually returns a promise that has the text of the response. I never realized how much I liked C#'s standard of ending asynchronous methods with "Async" before...

Anyway, I think I'm past all this crap, but I'm starting to remember why Javascript is terrible!
LinkReply