LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-01-2018, 10:52 AM   #1
FlatAssembler
Member
 
Registered: Apr 2018
Posts: 43

Rep: Reputation: Disabled
Why do people say that JavaScript is a bad language?


So, what do you think, why do people say that JavaScript is a terrible language? In what other language can you make a web-app that converts arithmetic expressions to i486-compatible assembly in just 700 lines of code?
http;//flatassembler.000webhostapp.com/compiler.html
I am not a professional programmer, and, right now, JavaScript is the only language I am able to do that in.

Last edited by astrogeek; 11-30-2018 at 01:40 PM. Reason: link moderated
 
Old 04-01-2018, 11:07 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
if javascript can do that other languages will be able to do that too (probably even better).
I never told you JavaScript is terrible and I only think you need to be familiar with other languages, like C, perl, python, ruby ... to know the answer.
 
Old 04-01-2018, 11:53 AM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Cool.

Is source code available for this demo?
 
Old 04-01-2018, 11:56 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Beware of some low level javascript functions used in malicious code (spectre?)
 
1 members found this post helpful.
Old 04-01-2018, 12:42 PM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,864
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
@OP: If you feel like advertising your software, just do that without beating around the bush.

Last edited by NevemTeve; 04-01-2018 at 12:43 PM.
 
Old 04-01-2018, 08:41 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by FlatAssembler View Post
So, what do you think, why do people say that JavaScript is a terrible language?
I don't use Javascript much, but my understanding is that "Javascript the Good Parts" (by Douglas Crockford) mostly explains the thinking behind this.

There is a summary here: https://github.com/iteles/Javascript...od-Parts-notes

Quote:
Originally Posted by dugan View Post
Is source code available for this demo?
Seems to be available with view source; funnily enough, there is a function called "toLisp" in there.
 
Old 04-02-2018, 02:31 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by FlatAssembler View Post
In what other language can you make a web-app that converts arithmetic expressions to i486-compatible assembly in just 700 lines of code?
700 lines of code does not seem exceptionally small for this.

i can think of compiling something in C, calling that & showing the results with PHP... no javascript required at all.
 
Old 04-02-2018, 04:26 AM   #8
FlatAssembler
Member
 
Registered: Apr 2018
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
If you feel like advertising your software, just do that without beating around the bush.
I am not advertising what I've made, I am using it to make a point. I was trying to learn C++ for five years. After five years, the most complicated thing I was able to do was a tetrahedron rotating around its axis and casting a shadow in OpenGL. So pathetic. Then I tried to learn some Java. But it had so many features that appeared to serve no other purpose but to confuse the beginners. I gave up after a few weeks. I thought that maybe I just wasn't born for programming. But then I decided to take up some JavaScript. And, after just three weeks of learning, I was able to make a PacMan game playable on my smartphone. Then, after six months of learning JavaScript, I was able to make that web-app.
Quote:
There is a function called "toLisp" in there.
Yes, that function converts the AST to an S-expression (the way arithmetic expressions are written in LISP). S-expressions are useful in that they are human-readable representations of the parser's output.
Quote:
Beware of some low level javascript functions used in malicious code.
There is nothing low-level there, it's just some (relatively) complicated string manipulation and array manipulation.
 
Old 04-02-2018, 05:47 AM   #9
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082Reputation: 2082
Quote:
Originally Posted by FlatAssembler View Post
I was trying to learn C++ for five years.[...]Then I tried to learn some Java.
Ah, but you can easily find people saying C++ and Java are bad languages too. In fact, you can find that for just about any language.
 
Old 04-02-2018, 07:15 AM   #10
FlatAssembler
Member
 
Registered: Apr 2018
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ntubski View Post
Ah, but you can easily find people saying C++ and Java are bad languages too. In fact, you can find that for just about any language.
And I think I can understand them. But I don't understand people who claim that C++ or Java are better than JavaScript.
In C++, for example, you need to write 150 lines just to get a white triangle on a black background. So discouraging. In Java, although you can easily create a GUI using WYSIWYG tools, to make the GUI apps actually work, you need to, well, deeply understand the internals, and that's also quite a bit discouraging.
In HTML5, when you run your program, you already have the graphic window opened, and adding a button is a one-liner. It's so easy that a WYSIWYG tool would hardly help.
Although the programming languages Java and C++ claim to be portable, it's really hard to make a GUI C++ or Java program to run on both PC and Mac. The GUI Java programs that I've made to run on my Mac failed with some weird error messages when run on a Windows PC. And although C++ has a standard API for accessing files, a CLI program that correctly manipulates files on a Mac usually doesn't work when compiled on a PC.
In JavaScript, if you make a PacMan game responding to the mouse clicks on your Mac, chances are, it will work on your smartphone, by the PacMan responding to the tap-gestures, immediately. And even if the device you try to run your JavaScript program on doesn't support all the features your program tries to use, chances are, some features of your program will still be available. JavaScript programs, unlike Java programs (which don't even try to run on older versions of JVM than the one they were compiled for), usually fail gracefully.
 
Old 04-02-2018, 07:33 AM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Shrug ... Programming languages are just the tools of my trade, and I don't pick favorites.
 
Old 04-02-2018, 07:39 AM   #12
FlatAssembler
Member
 
Registered: Apr 2018
Posts: 43

Original Poster
Rep: Reputation: Disabled
It would be a good thing if they were just tools. A hammer is just a tool. So, how long does it take to learn how to use a hammer?
 
Old 04-02-2018, 07:49 AM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by FlatAssembler View Post
It would be a good thing if they were just tools. A hammer is just a tool. So, how long does it take to learn how to use a hammer?
Well, backhoes are "tools" too. And in my neighbor's hands – he's been working with them for thirty years or so – they perform a graceful and fluid dance. (For his and my amusement, he let me sit in the operator's seat one time ... in a great big open area. Yeah, you can imagine. ...) Having worked with programming tools for a comparable amount of time, I can pick up any language or tool ... even one that I've never encountered before ... and quickly be productive with it. I've never "picked favorites" as I tried to pick the best tool for the job. And of course, I'm not bragging or anything – my experience is routine.

Although, talking about JavaScript, I'll freely admit that I thought Flash would be the winner. I never thought that source code would be freely running on the client machine. I see many things that, say, Google is doing with "compiled JavaScript" and wonder to myself ... "but, why?"

But I thought the same thing when I learned that Android runs Java. And in due time I've written Android apps in Java, albeit with a clothespin fitted firmly over my nose. I now watch what Apple is doing with Swift – finally, they seemed to have accepted the fact that "Objective-C sucks" – and I think they're on to something good.

Last edited by sundialsvcs; 04-02-2018 at 07:51 AM.
 
Old 04-02-2018, 08:16 AM   #14
FlatAssembler
Member
 
Registered: Apr 2018
Posts: 43

Original Poster
Rep: Reputation: Disabled
Quote:
Although, talking about JavaScript, I'll freely admit that I thought Flash would be the winner.
Well, ActionScript (the programming language internally used in Flash) has the same syntax for string manipulation, array manipulation and similar things as JavaScript, right? Had I done my web-app in ActionScript, it would have taken just as many lines of code to write the algorithm, but I couldn't do the I/O as simply as I can do it in JavaScript.
 
Old 04-02-2018, 09:19 AM   #15
Mill J
Senior Member
 
Registered: Feb 2017
Location: @127.0.0.1
Distribution: Mint, Void, MX, Haiku, PMOS, Plasma Mobile, and many others
Posts: 1,258
Blog Entries: 2

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
@FlatAssembler All the stuff you mentioned is high-level stuff for script-kiddies , Can you imagine building a kernel with JavaScript? Sorry but JavaScript sucks for some things, for one you have to run a HUGE(compared to c) interpretation engine(browser, etc) whereas c runs very low-level and fast.

And your wise-crack about the hammer....ever try pulling nails with a ball-peen, shingle or welding hammer? Ever try pounding in a 7in pole-barn spike with a farrier hammer? I have used all the hammers mentioned(+aLotMore) And I can tell you one hammer doesn't do it all and yet all are necessary.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I get people to use Linux? I'm bad at converting people over. Mr. Hill Linux - Newbie 50 07-11-2020 10:41 AM
LXer: Hello, Kotlin: Another programming language for JVM and JavaScript LXer Syndicated Linux News 0 02-17-2016 11:41 PM
LXer: JavaScript becoming default language for GNOME apps LXer Syndicated Linux News 0 02-04-2013 05:18 PM
Why do people use SMS language on this forum? jlinkels General 38 03-10-2008 04:29 PM
What does it take to create a client side scripting language like JavaScript? tuxfood Linux - General 1 10-04-2005 11:49 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration