Hacker News new | ask | show | jobs
by bradscarleton 3554 days ago
As someone who does a ton of Node/JS coding as well as some Python, I am personally offended! Ok, not really, but I think you're wrong :)

I think VB is more similar to Python in the sense that both languages were designed with some sense of simplicity and straight-forwardness in mind.

Both PHP and Javascript are much more complex from a language design standpoint, which makes them more difficult to learn "well" for beginners. Yes, they are both hugely prolific because of the web, and lots of people copy/paste code around not having any clue how it works, so I won't deny your "generations of garbage" comment. But you're assessment is a little too simplistic.

A good engineer can write high quality code in "almost" any programming language. It's the coder, not the language, that determines engineering quality.

4 comments

> Both PHP and Javascript are much more complex from a language design standpoint

Complex in the sense that they were originally thrown together and the results of the program might best be described as "stochastic output", yeah I can agree with that.

> A good engineer can write high quality code in "almost" any programming language. It's the coder, not the language, that determines engineering quality.

Sure, but it sure seems funny that "high quality code" is nearly non-existent in PHP and javascript world ...

> Complex in the sense that they were originally thrown together and the results of the program might best be described as "stochastic output", yeah I can agree with that.

Absolutely, they are complex because of poor initial designs, and actually even more complex now due to all the efforts to maintain backwards compatibility...

> Sure, but it sure seems funny that "high quality code" is nearly non-existent in PHP and javascript world ...

jQuery is an incredibly well engineered library by John Resig. I think that jQuery was one of the big technological leaps forward that led to the proliferation of web applications.

For a long time, people thought that cross browser JS inconsistencies and confusing API standards meant that you couldn't build interactive UI applications in the browser. And now they are ubiquitous.

So I guess it depends on your definition of "high quality code". I don't think quality code is about some arbitrary coding aesthetic. It's about results, and it's about what your code does, and how it creates value.

>> So I guess it depends on your definition of "high quality code". I don't think quality code is about some arbitrary coding aesthetic. It's about results, and it's about what your code does, and how it creates value.

Moving the goal posts so that the definition of 'high quality' is basically code that compiles and runs as long as it 'creates value'? What about when you have to change it later? What about if it has to be really fast?

People who think that Javascript and PHP are crappy languages aren't just comparing these languages to 'arbitrary coding aesthetics'.

> People who think that Javascript and PHP are crappy languages aren't just comparing these languages to 'arbitrary coding aesthetics'.

I'm not defending the design of JS and PHP. I'm saying that if you are a good engineer, then you can produce code that is quality in these languages.

Also, I'm pretty sure Facebook gets "updated" and is "fast" ;)

They're both sequential by default and lack threading, and that's hard to mess up. They're both great languages for easy projects.

PHP code is a breeze to work with using composer, and most packages use namespaces and have great intellisense. But good luck doing anything concurrently.

NodeJS is fast, and boy can it handle a lot of tasks at once using the event loop! But I can't for the life of me figure out modules or get good intellisense.

There's plenty of high quality code in each. I'd just never write a complex app in either.

Intellisense can be difficult with JavaScript inside an IDE. I've had some luck with WebStorm and their typescript stubs though.
>> A good engineer can write high quality code in "almost" any programming language. It's the coder, not the language, that determines engineering quality.

That's just a platitude, and it's wrong.

Languages with better features allow engineers at varying levels of experience to write better code than they otherwise might.

JS almost forces you to write garbage.

> JS almost forces you to write garbage.

There are ways to work around this...

First, ES6 brings a lot of enhancements to JS. However, it also makes JS even more complex and unwieldy because now you have all of these new and old language features co-existing.

If you use a tool like ESLint, you can limit yourself to a subset of the whole ES6 standard that I think is a decent programming language.

There's also other ways to go at it, by using a language that compiles to JS like TypeScript, however maybe that would be considered cheating in the context of this argument.

I think they differ in that PHP is copypasta and Javascript is an infinite dependency tree of third party libraries that the developer has no idea (or care) of their inner workings.
VB is also an incredibly complex language, especially the pre-.NET versions.

It didn't even have a regular syntax for the sake of backwards compatibility. For example, Line was a method on Form (kinda eh, but okay); but you couldn't actually invoke it as you'd normally invoke a method. It had to look like the LINE statement did in BASIC circa 70s:

  form.Line (1, 1) - (100, 100), vbRed
Note that parentheses here are not some kind of tuple syntax. Instead, they're a part of the special Line syntax, as well as the dash between. On the other hand, vbRed is just a named constant.

But wait, it gets better. Say, you want to draw a filled rectangle. Well, a rectangle is also defined by two points, so BASIC has historically used the LINE statement for that as well, and VB follows suit:

  form.Line (1, 1) - (100, 100), vbRed, BF
Unlike vbRed, BF here is not a variable name - it's more special syntax. "B" stands for "block", and "F" stands for "fill" (so you can do "B" without "F").

Note that you can have a variable named BF. And if you do something like, say:

  form.Line (1, 1) - (100, 100), BF
That is legal, and uses the value of that variable as the color of the line (instead of drawing a rectangle, as you might have expected). And it'll probably work, too, regardless of the type of "BF", because VB tries incredibly hard to implicitly convert something to something else when types don't match.

Note that all of this is part of the language syntax, not the library. The actual function just takes a bunch of arguments, same as any other; but the language then piles all this useless syntactic syrup on top of that.

This is just one tiny corner of the language, and not even the most headache-inducing one - you hit it once, you read the manual, and mostly that's that. But then there's stuff like default properties and the Let/Set distinction:

   Let x = y
   Set x = y
In VB, these two statements are both assignments, but what they assign to is different. And you actually have to know and understand the difference, because there isn't just one assignment syntax that does the right thing for everything - some types only work with Let, and some types must be assigned with Set to get what you want.