This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.
@humrochagf replied to The Programming Language That Changed My Life! with their own associations with different languages:
Awesome post, I had contact with Prolog at my Computer Science course, I struggled a lot with it. Maybe it's time to go back to it with this book that you recommend to give it another try.
For me every programming language that I experienced changed my life in some aspect.
- C made me care a lot to resource management.
- Assembly to understand even more how things work barebone. And also to be graceful for the existence of compilers and interpreters π
- Java to understand the classic design patterns
- Python to discover my passion for coding, the community, open-source, and to make me express myself with code better.
- JavaScript and TypeScript helped me so much to understand events and how async work
- Shell was the gateway to server task automation
- Now elm developing my passion for functional programming
Each language exposed me to different ways of seeing things βΊ
The Is this a β¬1.000,00 worth Node script? is a truly fun read. @antontsvil talks about the importance of making sure you're truly following the requirements:
This is a tragic cautionary tale that's all too familiar. You THINK you know what the client wants, and then when you put all your heart and soul to build the perfect product you realize you completely misunderstood the requirements! The lesson is to remember to understand the problem completely before trying to solve it π
@andrewbrown had a great answer lined up in this discussion thread: If your manager told you to spend the next two weeks working on any "fun and fulfilling" project at work, what would you do?. I, for one, am looking forward to seeing this eventually become a reality:
I would finish up my AWS Star Trek Karaoke app where you can input a karaoke soundtrack and it would clip together video photage to make star trek character sing.
So I can make things like this:
It would cost $500 USD on AWS to transcribe the entire seasons of TNG but I have the credits to do so.
</div>
Is JavaScript the most confusing programming language? Well, @curtisfenner has some additional thoughts and examples:
I think it's dishonest and counterproductive to pretend that all languages are equal. TypeScript is in fact born out of the problematic reality that writing JavaScript on large teams is more expensive than it needs to be.
JavaScript is very confusing, to the extent that "confusing" is the opposite of "easy to predict" and "understanding it is not complex".
For a tiny selection of the confusing complexity of JavaScript:
{var x = 1; {var x = 2;} console.log(x)}
is 2
but {let x = 1; {let x = 2;} console.log(x)}
makes 1
.
doThing(arg, (x) => { this.receive(x); });
will generally work when doThing(arg, function(x) { this.receive(x); });
will generally not.
[1, 2, 3, 10, 20, 30].sort()
is [1, 10, 2, 20, 3, 30]
.
["x", "y", "z", "a", "b", "c"].sort((a, b) => a - b)
doesn't change the order.
"slice" in []
but for (let p in []) {console.log(p);}
prints nothing.
"ππ".length
is 4
but Array.from("ππ").length
is 2
{[{}]: 10}["[object Object]"]
is 10
even though that obviously doesn't make sense
(a => a).length
is 1
, and Array.from((a, b) => a + b)
is [undefined, undefined]
.
arr.push
, arr.pop
, arr.splice
don't return the array, but modify it; arr.sort
and arr.reverse
modify and return the array; arr.concat
, arr.slice
, arr.map
don't modify the array.
0 == "0"
and 0 == ""
but "" != "0"
.
Certainly all of these have (relatively straightforward) explanations. However, each of these represents a piece of "trivia" that you have to know in order to actually understand JavaScript code in the wild; they are each some of the many hurdles that a programmer has to (repeatedly) overcome in order to not be confused by JavaScript. This is also, obviously, only a selection of a few prominent examples of JavaScript-generated confusion; knowing these does not mean you won't be confused by JavaScript.
Still, JavaScript is definitely not the most confusing language. And I agree, it is getting a lot better (especially as co-existing tools like the TypeScript compiler make writing plain-old-JavaScript easier). (Unfortunately, as the above list somewhat illustrates, this also makes JavaScript more complex as "legacy" features coexist alongside "modern" features with subtly different behaviors).
As someone who tries to keep up with programming language theory, I am afraid of complacency with programming tools. Where we are today is obviously nowhere near the "apex" of programming tools (after all, programming languages themselves are only about 60 years old at this point) which means there should be lots to improve upon. Recognizing we have come far is important, but it is also very important to not ignore areas that we can still improve.
(The above is not unique to JavaScript, though I do think JavaScript is one the more-confusion-inducing end of the spectrum. C is probably the contender for the language most are often called "good enough" despite well-identified areas were it deserves improvement).
In response to Apple wants to remove scripting languages from macOS @codemouse92 jumps in with some thoughts about the term itself and Apple's potential motivations:
"Scripting language" has always struck me as a weasel word. It lacks a formal definition, but is applied liberally to any language which a developer deems "not a real programming language" (whilst turning up their nose in bourgeois disgust.)
If they mean "interpreted language," that's something specific, but it would also mean dropping Java.
And...legacy? Since when is Python "legacy"? It's one of the most popular application development languages today, fer cryin' out loud. (On that note, Ruby and Perl aren't even remotely "legacy" either.)
I have a theory what's going on, though...I think Apple is just trying to "encourage" (force) developers to use their in-house languages, and build more Apple-only software. It's the whole walled-garden game again.
But then, I started boycotting Apple products four years ago, when they started explicitly blocking Linux from being able to communicate with iDevices. (And yes, tech support confirmed this.) Dirty pool is just their game.
Apple lovers: come to Linux! There's freedom on this side of the garden hedge. ;)
See you next week for more great comments β
Top comments (5)
Congrats to @humrochagf , @antontsvil , @andrewbrown , @curtisfenner , and @codemouse92 for making the list this week!
Yay! That was unexpected. :)
Awesome π
I'm loving dev.to community, thanks for the great work :)
It seems like people really want me to finish that Star Trek Karaoke app.
A "Scripting language" is a language that does not require prior compilation to be executed (can be ran from source files).