Ask HN: Is web programming a series of hacks on hacks?
822 pointsLately I've been doing some web development on a fairly long-lived and large code-base, but I'm finding it MUCH harder to wrap my head around than application development ever was. I think my difficulty is that the whole environment feels so... HACKISH... everything is a horrible hack on top of a horrible hack. (yes, I'm familiar with the history, been using the Internet since before the web) I'm not even talking about the fact that everything has to be stateless, in fact I develop desktop apps as stateless even driven UIs as well, but just the fact that it really feels like there's no consistent way to do anything, there are 1000 different frameworks, all with their own way of doing the most basic tasks, and my experience is that they all ... well... suck.
Am I missing something? Is it me resisting change? Is web programming really that bad? Is it really just that I need a new mental paradigm?
Can you recommend any good resources to help me orient my mind to this new way of thinking?
Comments (661) 164 threads
Earlier commentsbut really, its less "hacks on hacks" and more "unneeded abstractions on unneeded abstractions".
The inefficiency of modern web-stacks continues to absolutely astound me.
When people tout the 'efficiency' of language A against the equivalent C as being "less than 2x"...
jeez... that means you're throwing away double the power that you need to. That means you've got double the number of air-conditioners cooling your server-room. double the power bill, etc...
WebKit is great, but any attempt to reform the competing browser shitshow reminds me of that xkcd comic about competing standards: https://xkcd.com/927/
(former web developer -- get out while you have your sanity)
[0] https://www.w3.org/TR/CSS22/cascade.html#cascading-order (amusingly, they omitted the last and strongest "user agent !important" from the list). [1] https://bugs.chromium.org/p/chromium/issues/detail?id=347016
(before someone says "flexbox", remember it's still in "working draft" stage)
1. HTML. Don't view the source of websites and web apps to understand HTML. Read a good book or tutorial. HTML Dog is a good one.
2. CSS. Likewise.
3. JavaScript. Definitely don't try to learn JavaScript by viewing source either. Instead, maybe HTML Dog. There's also Douglas Crockford's _JavaScript: The Good Parts_ and David Flanagan's masterpiece, _JavaScript: The Definitive Guide_. I don't know how I would have ever understood JavaScript if I had not taken the months to read Flanagan's book cover to cover.
That takes care of the client side. For the server side, it should come much more easily. Basically you have a database, like I'm sure you're used to. Then you need a web server, like Apache or Nginx, and some kind of glue language like Python or PHP. Many people put a lot of code here. But I like to keep it pretty thin: like the database and the browser just talking to each other. Even so, just running this side of the affair can be a full-time job in itself.
I recommend at some point familiarizing yourself with the HTTP protocol in general: all the headers, request methods, etc. Basically once you can use Telnet to imitate a browser requesting a page, you'll feel more comfortable with how simple it really is.
The thing about web frontend development is that it suffered from the browser wars and having to appeal to amateur developers. Amateur developers love "Worse is Better"[1]. Basically sacrifice all consistency in favor of simplicity and getting started quickly. "Worse is Better" makes things simple to the point of making ugly hacks for certain situations that don't fit that extreme focus on simplicity.
The browser wars made everything horribly inconsistent. Microsoft's strategy was to make the most broken non-standard code possible automatically work and everyone had to emulate that.
The most clean frontend development I've worked with was Angular with ScalaJS. Typescript in Angular 2 should be really clean. The underlying web browser stuff will never be cleaned up since it has to be backwards compatible.
[1] https://en.wikipedia.org/wiki/Worse_is_better
Edit: Replaced the JWZ URL with wikipedia. Apparently JWZ has some anti-hacker news redirect code on his site.
At the moment, I really don't know what to do. Looking at the way people build applications nowadays (does somebody NOT use node.js and npm at some point?) with layers upon layers of languages, frameworks, 4 different module management systems, with READMEs that read like "install the dependancies using "gem install A B C; pip install E F G; npm install X Y Z; go install U V W; cargo install P Q R; then proceed with curl https://github/myshit/install.sh | bash" is really tiring.
Ghaaaaa!
Scala also has much better, more mature tooling and IDE support.
The build system is also amazing, not the mess cobbled together in JavaScript that is changing every second week.
In addition to that you have stable, existing and mature libraries which work on multiple platforms, achieving _real_ cross platform support. (Not this "if you make JavaScript run outside of the browser..." nonsense.)
Plus, the quality of libraries is so much higher because they aren't written by JS kids with a maximum attention span of 5 minutes.
All comments shown.
Couldn't load more comments. Check your connection and try again.