r/programming • • Jul 18 '16

Web programming is getting unnecessarily complicated

http://en.arguman.org/web-programming-is-getting-unnecessarily-complicated
324 Upvotes

258 comments sorted by

View all comments

43

u/freebit Jul 18 '16 edited Jul 18 '16

Many (all?) of the OP's arguments he presents are correct. We seem to be in a really difficult place right now in web development. We seem to have so many competing and orthogonal factors. Here is a brain dump of many issues that weigh heavily on me personally. I have utterly failed at coming up with a solution that feels satisfying to me.

  • It's important to choose a platform, stack, and language that is popular for support, labor availability, and stability.
  • JavaScript, as a language, has so many issues.
  • JavaScript tooling may have as many issues as the language.
  • We can't get away from JavaScript.
  • JavaScript is slow on mobile.
  • JavaScript can do darn near anything you can imagine.
  • Downloading a boatload of JavaScript, parsing it, and then executing it is slow on desktop and even slower on mobile.
  • Java is the most popular language in the world, it's well designed, but its' future is in doubt because Oracle is being ridiculous.
  • PHP seems to be the language serving > 90% of the domains on the web but, everyone slams on it and it seems to be in decline. To be fair, most of the issues from the past are fixed and some minor ones left will be fixed soon. But this does not make up for the industry moving away or avoiding it. I realize the statements in this bullet item seem paradoxical. To be honest, I don't understand the apparent contradictions myself.
  • Neither PHP or Java can be used in the browser because neither of them are JavaScript.
  • JavaScript on the server (Node.js) seems to be in decline or at least plateaued. This makes me sad.
  • We need to be able to test our code, but testing JavaScript across all of the browsers is a monumental headache and possibly not fully practical.
  • Having tests for browser side code and server side code in different language seems daunting and not terribly practical.
  • Having validations on the client side and then duplicated validations, in a different language on the server, seems like an utter disaster of a situation.
  • RoR, Python, Clojure, and friends are not a candidate due to reasons.

22

u/yogthos Jul 18 '16

RoR, Python, Clojure, and friends are not a candidate due to reasons.

I think that once language gains enough critical mass, then it's completely irrelevant whether there's another languages that's more widely used or not. The concerns with using a niche stack are usually the following:

  • is the language stable/fast
  • does the language have a community around it that will provide support, fix bugs, add features
  • are there libraries to do the things I need to do
  • are documentation and community support available
  • is it possible to train new hires to work with the language

If I have a satisfactory answer for each of these categories, then I think the stack is perfectly viable.

My team has been using Clojure on the backend for about 6 years now, and we started using ClojureScript on the front-end last year. We found that Clojure/Script stack has a good story in each of the categories.

While it might remain a niche stack, it's certainly a very competent niche stack that saves us time and money across the board. So, the choice between waiting for the Js stack to become sane and using something that currently works well is really not a hard one in my opinion.

52

u/Timbrelaine Jul 18 '16

The solution is to wait for WebAssembly, and try not to develop a drinking problem in the meantime.

26

u/hotel2oscar Jul 18 '16

cracks open a can of beer

oh wait... don't develop a drinking problem...

fuck it

drinks

8

u/crabmanwakawaka Jul 18 '16

this is probably the best advice i've seen

→ More replies (2)

13

u/TheOtherHobbes Jul 18 '16

The problem is the web was never designed as a standard. It sort of grew randomly, with input from all kinds of people pulling it in all kinds of directions for all kinds of reasons.

Now it's a jack of no trades. Page layout is still ugly and messy, text support mostly works if you don't mind converting font files, markup can't decide if it's a half-finished object-oriented relic or a premonition from an alternative reality where the semantic web really happened, CSS rendering is ugly and messy, animation is kind of random (CSS? js? a framework? a different framework)... and then there's the explosion of opinionated frameworks which try to fix all of the above, but mostly just make things worse because they add another layer of inconsistency and confusion.

Also, node.

And a good handful of culty little cleverlangs that get a lot more PR than use. (Clojure - you.)

Someone should just tear it all up and start again. Make it a VM with one standard media library, define the VM so it can interpret all kinds of languages instead of just one, and leave it to ferment. Make web pages code instead of markup+whatever_the_hell_CSS_is.

Will this happen? Not on the flat web.

But my guess is the web will go VR/AR in a year or three and we'll see it happen because of that - evolving in parallel to the flat web, which will go the way of plaintext after a decade or two.

3

u/dv_ Jul 19 '16

Oh absolutely. It is for example evident when you compare the ugly HTML/CSS/JS mess with something like Qt5's QML, which can achieve the same UI with much smaller and far more readable code.

18

u/mrjking Jul 18 '16

JavaScript on the server (Node.js) seems to be in decline or at least plateaued. This makes me sad.

https://www.google.com/trends/explore#q=nodejs

Seems to be doing just fine.

Having validations on the client side and then duplicated validations, in a different language on the server, seems like an utter disaster of a situation.

There will always be a difference in validation between front end and back end. Your back end will hit the database and check if a user is already registered, front end can't do that. It's easier to skip most but the simplest front end checks, and just rely on the backend to do it. All front end validation can be bypassed if somebody really wants to. But I do agree, creating rules and having them in one place is the easiest to maintain.

→ More replies (16)

15

u/tdammers Jul 18 '16

What you describe has been dubbed "The JavaScript Problem". In a nutshell:

  • JavaScript is not great
  • JavaScript is inevitable in the browser, and it's not going anywhere
  • The alternatives are all just as bad

Other than that:

Java is the most popular language in the world, it's well designed, but its' future is in doubt because Oracle is being ridiculous.

Java's design is not very good at all. It's popular due to momentum, a brilliant runtime (the JVM, unlike Java itself, is an engineering masterpiece), and by virtue of the cross-platform alternatives with similar momentum being a lot worse - PHP is just fucked up through-and-through, using it for anything worth anything is kind of reckless; C++ is fine in principle, but waaaaaay too complex a beast to use for anything that doesn't require the level of control it gives you which is practically everything; C# is too tied into the Microsoft ecosystem.

PHP seems to be the language serving > 90% of the domains on the web but, everyone slams on it and it seems to be in decline. To be fair, most of the issues from the past are fixed and some minor ones left will be fixed soon. But this does not make up for the industry moving away or avoiding it. I realize the statements in this bullet item seem paradoxical. To be honest, I don't understand the apparent contradictions myself.

No; the core problem with PHP is still alive and kicking, and it's not going to be fixed anytime soon. Individual symptoms have been ironed out, but that's just it - PHP only ever patches up symptoms. It's not a contradiction; PHP is and has always been the budget option, and has been coasting on being the only option that didn't cost an arm and a leg in the 1990s.

Neither PHP or Java can be used in the browser because neither of them are JavaScript.

PHP is not better than JavaScript by any metric, and being designed as a DSL for a particular server-side web page scripting paradigm, it is positively unsuitable for other domains (not in the "it can't be done" sense, but in the "why on Earth would you even try" sense).

Java can be compiled to JavaScript, as can a dozen or so other general-purpose languages. The question is whether Java's strengths are worth much for browser scripting, and whether its highly opinionated paradigm is a good fit - my hunch is that the answers are "not a lot" and "not very".

JavaScript on the server (Node.js) seems to be in decline or at least plateaued. This makes me sad.

Frankly, I'm surprised it got this far. JavaScript is a nice little language, and far exceeded the original expectations, but it has a few flaws that are crucial for server-side programming, especially when more stuff is at stake than a garage startup and some venture capital. Node.js has its place, but I believe it is now close to saturating its niche.

Having tests for browser side code and server side code in different language seems daunting and not terribly practical.

Having validations on the client side and then duplicated validations, in a different language on the server, seems like an utter disaster of a situation.

There's a bit of a bias in these statements, namely the implicit assumption that you develop the client and the server in a tightly coupled tandem setup; for a small, fast-moving startup type project, this is probably a good idea, because everyone is going to be doing everything anyway, and reducing the minimum required skill set (and thus head count and bus factor risk) to get the thing off the ground is very valuable; unsurprisingly, this is the kind of project for which Node is immensely popular, and it does quite well in this role. But as soon as things stabilize a bit, and you need to scale your operation to more people than what's practical as one development team (I'd say 3 programmers plus up to 3 non-programming roles is about the limit), you're going to need well-defined interfaces and decoupled sub-projects anyway; at that point, the benefit of being able to reuse code between client and server becomes marginal, and the benefit of using the most suitable technology for either part becomes more important.

4

u/jocull Jul 19 '16

What do you think Node's critical flaws are on the server? Why do you think large corporations such as WalMart are using it to survive Black Friday loads? https://mobile.twitter.com/eranhammer/status/406300408647139328

Asking because I am genuinely curious, not trolling :)

4

u/sandaz13 Jul 19 '16

I interviewed a Wal-Mart dev for a job a few years ago, and we talked about that a bit. His response was that Wal-Mart adopting Node was for infrastructure reduction (read: cheaper), pure and simple. Without maintaining/ managing threads, you can handle way more requests per server, which means less servers needed for peak volume.

→ More replies (3)
→ More replies (2)

4

u/dv_ Jul 19 '16

C++ is fine in principle, but waaaaaay too complex a beast to use for anything that doesn't require the level of control it gives you which is practically everything

You do not have to use all of C++. Pick a subset and stick to it. Especially with C++14 and the upcoming C++17, that subset can be quite succinct and functional (or at least functional-ish). Plus, RAII is such an amazing killer feature, no wonder Rust picked it as one of its fundamentals.

10

u/tdammers Jul 19 '16

The problem is that not everyone picks the same subset, so unless you only ever work on your own stuff, you need at least superficial knowledge of all of it. This is especially problematic with an ecosystem like web dev, that is extremely diverse already and lacks unifying principles.

That's not to say it's a bad language overall; it's not. Just not a great candidate for the web.

→ More replies (2)
→ More replies (6)

11

u/[deleted] Jul 18 '16 edited Jul 18 '16

but its' future is in doubt because Oracle is being ridiculous

You're exaggerating. There's zero chance that Java is going anywhere anytime soon. The only thing negatively affected by Oracle has been Java EE development and they've already reconsidered and will be presenting their proposals for the next version of Java EE at JavaOne in September.

Oracle could probably drop Java EE entirely and it wouldn't have a huge impact on the popularity of Java. Especially since the previous versions have numerous open source implementations and there are plenty of popular alternatives.

7

u/Timbrelaine Jul 18 '16 edited Jul 19 '16

I don't know why you're getting downvoted. There are people still making a good living writing Cobol and Fortran, and companies haven't become any more eager to port their code (and devs) to new languages since. This seems pretty uncontroversial.

4

u/sandaz13 Jul 19 '16

Agreed, Java will be gone 40 years after COBOL is gone. If you think there aren't still production business applications written in Assembler, you're kidding yourself.

5

u/joonazan Jul 18 '16

It's important to choose a platform, stack, and language that is popular for support, labor availability, and stability.

I disagree. There are very high quality libraries with relatively few users, but not for JS. I'd suspect the lack of a solid standard library. It causes even the most respected libraries to have horrible dependencies.

9

u/[deleted] Jul 18 '16
  • We can get away from javascript
  • All turing complete languages can do anything
  • Reasons can be fixed

10

u/minno Jul 18 '16

All hail webassembly!

5

u/stesch Jul 18 '16

AFAIK you can't access the DOM from WebAsm.

4

u/minno Jul 18 '16

I'm pretty sure they're planning it, it's just not in the current test implementations.

5

u/_zenith Jul 18 '16

Yep. It would be utter madness to try and introduce a JS replacement that couldn't access the DOM

6

u/[deleted] Jul 18 '16

WebAssembly's own FAQ states that they're not trying to replace Javascript:

WebAssembly is designed to be a complement to, not replacement of, JavaScript.

That seems like a mistake to me. I'm worried if or when it eventually starts replacing JS that it won't have been designed for it (like accessing the DOM, for example) and we'll wind up with another mess.

4

u/_zenith Jul 19 '16

Yep fully agreed. It feels a bit like they said that so JS proponents don't fight it tooth and nail. It possibly felt like a pragmatic choice at the time of their writing it.

I fully expect that they will transition away from this... Or WebAssembly will die (because why even bother then)

→ More replies (2)

5

u/tdammers Jul 18 '16

All turing complete languages can do anything

By that logic, we should all be coding in Brainfuck or INTERCAL. Programming language choice has never really been about Turing Completeness, because it's actually quite difficult to design a language that is accidentally Turing incomplete - it is a lot more common to design a language that should be Turing incomplete and have it come out Turing complete by accident: CSS3, most modern SQL flavors, C++ templates, and PostScript, are famous examples.

→ More replies (1)
→ More replies (2)
→ More replies (9)