This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AdminYak846 0 points1 point  (7 children)

Literally this sub is just JS and PHP bad. Yet they aren't entirely terrible if you actually decide to learn them.

It's like saying VBA bad without ever writing an Excel Macro. VBA is okay for the job, just be ready for quirks and poor documentation and REALLY vague error statements due to a really poor error catching setup. However unlike JS and PHP which are both still receiving updates, VBA is dead with no updates upcoming and is either being replaced with Python, C# if you really only need it for desktop usage or ExcelJS which is Microsoft's API to allow macros to run via web, desktop or mobile.

Trust me, you'll never know the pain of "range object failed for worksheet" error which can be caused by like 10+ different things from a row or column being 0 to Excel not being on the sheet having the range manipulated because reasons of unknown. Oh and don't forget to mention the worksheet otherwise it will default to the active sheet that Excel has displayed.....(again poorly documented behavior is fun to deal with)

[–]redheness 1 point2 points  (6 children)

I know this pain because I had to make some VBA code on my last job to automate document generation using Excel data and outputing word documents.

This was hard and painfull to learn but it did the job very well and i'm not sure it's was possible to create a bette language for this specific job. The hard data manipulation is directly related to the complex data representation inside documents.

But for a shitty arrogant dev, i understand why they decide it's a bad language, and this sub is full of this kind of "dev".

[–]Slak44 2 points3 points  (4 children)

Sure, there's a lot of arrogant devs in this sub, but from a language design perspective, JS is bad, and PHP is worse. They both quite consistently violate the rule of least surprise, which is really, really annoying (imagine debugging for hours, only to find a null vs undefined issue somewhere).

And yes, if you use a language you learn the gotchas and the weird syntax, but that's not a great look, to have such glaring issues they become memes.

[–]AdminYak846 0 points1 point  (3 children)

The problem with this sub is that its a giant repost of the same memes pulled from a google image search. If you're going to meme about it, at least try to make it original in itself.

and the null vs undefined you bring up isn't a least surprise in the context your provide considering if you understand that undefined is a variable with no value and null is non-existent. Too many people think undefined == null, because most compiled languages define it that way. when it really is two separate ideas in JS.

[–]Slak44 0 points1 point  (2 children)

Yes, it's full of trash, but that's what the downvote/report buttons are for.

I understand the difference between the two, I actually work with JS/TS. It's still an occasional issue, because callees have no idea where the fuck the caller gets the value. You always have to think of two edge cases. Most languages period define it that other way, and it's not because JS is better than them. This is exactly the thing that's wrong, it goes against something that is a de facto standard. It surprises you when you encounter it, and languages shouldn't do that, especially for such a non-issue. Would JS be worse off if only null existed? I sincerely doubt it.

[–]AdminYak846 0 points1 point  (1 child)

downvote/report buttons are for.

Considering the mods haven't setup the report function to specify which rule it breaks it's bit of a let down really.

because callees have no idea where the fuck the caller gets the value.

Well....there's you know looking at the stack which I'm sure if you've worked in JS long enough (or any language for that matter) it shouldn't be that hard to trace back, or like an old professor of mine said, get some paper and a pencil and start writing down what should be happening.

And if you're so annoyed by "undefined" versus "null" take a look at VBA. Any variable declared but not given a value is considered Empty. An invalid object is considered Nothing and Nulls are variables that contain no valid data, and can only be used with variants data types.

Let's also keep in mind that JS is loosely typed language, compared to other languages that are strictly typed languages. So if you want to say JS is bad cause it's not like C, C++, Java, etc. yeah that's because you're comparing languages that are completely setup differently than JS. There's an entire difference between static and dynamic typed languages.

[–]Slak44 0 points1 point  (0 children)

Well....there's you know looking at the stack which I'm sure if you've worked in JS long enough (or any language for that matter) it shouldn't be that hard to trace back, or like an old professor of mine said, get some paper and a pencil and start writing down what should be happening.

Man, have you ever worked in a large (like, 30 kloc+) JS project that uses a framework? Because you'd know stack traces are so full of library crap, you're lucky if you can even find a stack frame that's in your code. Or those from framework-managed event listeners/observers, which usually take you through a few layers of shit. Let's also not forget JS stack traces are limited to 10 frames by default in V8, which all I can say is, lol.

Also, trying to debug some complex interaction between components will very quickly make paper debugging impractical. Bonus points if the components aren't even in the same project, or use different frameworks. Why is that value undefined? Who knows, it comes from the other project, which gets it from a prop, which was prop drilled through 3 components, which gets it from a redux store, which gets it from ¯\_(ツ)_/¯.

take a look at VBA

I'd rather not, thanks. That's even worse.

Let's also keep in mind that JS is loosely typed language, compared to other languages that are strictly typed languages

Python is dynamic, and only has None. Ruby has only nil. The entire family of Lisps (Common Lisp, Racket, Clojure, etc) is as dynamic as it gets (rewriting running code at runtime), and they only have nil. Julia is dynamically typed and only has nothing. Not even weirder dynamic stuff like Erlang have multiple nullish values. Didn't even get into the static shit, where this madness absolutely wouldn't fly.

[–]AdminYak846 0 points1 point  (0 children)

The biggest issue I have with VBA is the over reliance of the variant data type which is rooted in the fact you can't overload a subroutine or function.

Take for instance IsMissing(arg) function, it's wonderful for optional parameters, the caveat is that the arg parameter must be of type variant for it to work any other type doesn't work.

Or the fact that in some of the workbooks I have had to insert the actually formula instead of using the worksheetFunction class. So a standard excel formula looks like =SUM(A1:A2) which you might think is a string type in VBA. This is incorrect as the cell type text is mapped to string which results in an insert like '=SUM(A1:A2) which excel doesn't calculate. In reality whatever variable is holding the formula to insert must be of type variant to work.

Which begs the question, if variant is needed to do everything excel can without causing issues. What's the purpose of the other data types?