Welcome to Gaia! ::


Dapper Gaian

1,225 Points
  • Dressed Up 200
  • Happy Birthday! 100
  • Gaian 50
But C wouldn't give two shits either, only your result could possibly be different than the one you expect wink
WWLink
But C wouldn't give two shits either, only your result could possibly be different than the one you expect wink
It is a hundred times easier to find such a problem in a C program than it is to find the same problem in a Matlab or R program, because in C you know exactly what type anything has.

Everyday Cat

The20
Am i the only one who seldom remembers the address of a place, just how to get there?
Nope.
Sometimes I don't even remember that much. I know only where in town it is located.
Lanackse-Kanvae
No mention for the fact that JS is dynamically typed so that your variables could be pretty much any type and switch at the drop of a hat?
It's not really relevant.

There are problems with its weak typing: Like how + works with objects, arrays, strings, and numbers (not that it works, but how it does so.) But dynamic typing simply isn't an issue, I've come to realize.
Lanackse-Kanvae
Most people are used to statically typed languages like Java and C (at least I'm pretty sure C is like that) and that difference can confuse people.
And most people prefer static typing. Which is reasonable. But static typing isn't necessary to make a well-written, stable, reliable, and large program.

However, I've found that strong typing is necessary for good programs. JavaScript has some strongly-typed tools to keep dynamic typing on a leash - you just have to use them.
Lanackse-Kanvae
An example of this is when taking 2 inputs from dialogue boxes and want to subtract one from the other.

Java would automatically type the input as a String so if you wanted to do some maths with the inputs, you'd have to put it through a parseInt command.

JS wouldn't give two shits and just do the maths.
Which, I agree, is bad. But this isn't because JS is dynamically typed. It's because JS is weakly typed.

Static typing means that the language requires you to specify - or that it deduces - the type of a variable, and the type of that variable cannot change at runtime.
Dynamic typing means that the language does not bind type information with the variable, and allows the variable to hold different data types at runtime.

Strong typing means that conversions from one type to another are not automatic.
Weak typing means that conversions are implicit and automatic.

For example:
C is statically typed, but weak. You must declare a variable to be an int, but whatever you try to assign to that variable, the language will do its best to make an int out of it.
C++ (well, C++11 specifically) is statically typed and strong. When you declare a variable, it must have a specified type; in a few cases, it can deduce the types of variables or functions, etc. But when you assign to that variable, C++11 requires there to be a valid conversion for weak types, or that you specify a conversion for strong types, and it gives you the tools to make types as strong or weak as you like.
Java is statically typed and strong. It requires types are specified, but no conversions between types are available.
PHP is dynamically typed and extremely weak: It doesn't care what you give it, it'll try to make a string out of it at some point, to hell with logic.
JavaScript is dynamically typed and somewhat weak: It keeps track of the types you use, and makes conversions only when you use math operators. It has some very wat moments.

It's okay to be dynamic, so long as it's not too weak.

Benevolent Borg

14,400 Points
  • Perfect Attendance 400
  • Millionaire 200
  • Invisibility 100
psychic stalker

They pop up on Hacker News and the JavaScript subreddit all the time. Most of them are hosted on Github.com and code.google.com, and a lot of them exist only because someone felt like doing it today.

ah, alright thank you.


psychic stalker

It's newer. Scala is only 10 years old, and was designed on and for the Java Virtual Machine. Scala and Clojure are actually quickly supplanting the Java Programming Language almost everywhere in new projects. There are even a lot of new projects being created to make Scala or Clojure versions of popular Java packages, specifically because both languages put Java completely to shame on its own turf.

(To be clear, though, Scala and Clojure are generally slower than Java right now. It's changing fast, but when I say they're better, I mean in that they offer better abstractions and better syntactical and semantic tools within the language than Java can possibly bring to the table.)

so would scala & clojure work better with java or would it just be better for them to replace it or something of that nature?
Shade7510
psychic stalker

They pop up on Hacker News and the JavaScript subreddit all the time. Most of them are hosted on Github.com and code.google.com, and a lot of them exist only because someone felt like doing it today.

ah, alright thank you.
Also, Douglas Crockford. Set aside 4 or 5 hours and watch Crockford on JavaScript Volume 1 and Chapter 2 and Act III. It'll give you a good part of the history of all of this and why JavaScript is what it is and why it's awesome in its own way.
Shade7510
psychic stalker

It's newer. Scala is only 10 years old, and was designed on and for the Java Virtual Machine. Scala and Clojure are actually quickly supplanting the Java Programming Language almost everywhere in new projects. There are even a lot of new projects being created to make Scala or Clojure versions of popular Java packages, specifically because both languages put Java completely to shame on its own turf.

(To be clear, though, Scala and Clojure are generally slower than Java right now. It's changing fast, but when I say they're better, I mean in that they offer better abstractions and better syntactical and semantic tools within the language than Java can possibly bring to the table.)

so would scala & clojure work better with java or would it just be better for them to replace it or something of that nature?
They do work with Java, but the reason they exist is because the Java Programming Language is a pile of stupid and should be made to go away at the earliest opportunity.

(I'm being pedantic because it's important: The Java Programming Language, which is stupid and bad and evil, should never be confused with the Java Virtual Machine, which is not stupid, not as bad, and not evil.)

Hallowed Lunatic

13,050 Points
  • Dressed Up 200
  • Forum Regular 100
  • Elocutionist 200
psychic stalker
Lanackse-Kanvae
No mention for the fact that JS is dynamically typed so that your variables could be pretty much any type and switch at the drop of a hat?
It's not really relevant.

There are problems with its weak typing: Like how + works with objects, arrays, strings, and numbers (not that it works, but how it does so.) But dynamic typing simply isn't an issue, I've come to realize.
Lanackse-Kanvae
Most people are used to statically typed languages like Java and C (at least I'm pretty sure C is like that) and that difference can confuse people.
And most people prefer static typing. Which is reasonable. But static typing isn't necessary to make a well-written, stable, reliable, and large program.

However, I've found that strong typing is necessary for good programs. JavaScript has some strongly-typed tools to keep dynamic typing on a leash - you just have to use them.
Lanackse-Kanvae
An example of this is when taking 2 inputs from dialogue boxes and want to subtract one from the other.

Java would automatically type the input as a String so if you wanted to do some maths with the inputs, you'd have to put it through a parseInt command.

JS wouldn't give two shits and just do the maths.
Which, I agree, is bad. But this isn't because JS is dynamically typed. It's because JS is weakly typed.

Static typing means that the language requires you to specify - or that it deduces - the type of a variable, and the type of that variable cannot change at runtime.
Dynamic typing means that the language does not bind type information with the variable, and allows the variable to hold different data types at runtime.

Strong typing means that conversions from one type to another are not automatic.
Weak typing means that conversions are implicit and automatic.

For example:
C is statically typed, but weak. You must declare a variable to be an int, but whatever you try to assign to that variable, the language will do its best to make an int out of it.
C++ (well, C++11 specifically) is statically typed and strong. When you declare a variable, it must have a specified type; in a few cases, it can deduce the types of variables or functions, etc. But when you assign to that variable, C++11 requires there to be a valid conversion for weak types, or that you specify a conversion for strong types, and it gives you the tools to make types as strong or weak as you like.
Java is statically typed and strong. It requires types are specified, but no conversions between types are available.
PHP is dynamically typed and extremely weak: It doesn't care what you give it, it'll try to make a string out of it at some point, to hell with logic.
JavaScript is dynamically typed and somewhat weak: It keeps track of the types you use, and makes conversions only when you use math operators. It has some very wat moments.

It's okay to be dynamic, so long as it's not too weak.


Yeah they never really seem to cover strong typing tools that in any module that covers JS. I can still see why people coming into it can get confused by how it works, especially if coming from other languages.

I've seen people absolutely freak out with Javascript in ways that no other language has done.

Everyday Cat

I'm so happy ;w;

It took me over three hours but I got something really simple and stupid to work all by myself... in jQuery. Strangely, I think I seem to be understanding it better than plain JavaScript. Is that normal?

I know it's so dumb as to be humiliating but how often is it that I get something to work exactly as intended without bothering anyone else about it? So here I shall post Scriptkitten's first successful script! (^o^)/

Although, I had to use an older version of jQuery since my code only worked every other time I refreshed the page. Weird...
Scriptkitten
It took me over three hours but I got something really simple and stupid to work all by myself... in jQuery. Strangely, I think I seem to be understanding it better than plain JavaScript. Is that normal?
Yes. It's part of the reason JQuery exists at all: It hides a lot of the stupidity in the DOM.

Everyday Cat

psychic stalker
Scriptkitten
It took me over three hours but I got something really simple and stupid to work all by myself... in jQuery. Strangely, I think I seem to be understanding it better than plain JavaScript. Is that normal?
Yes. It's part of the reason JQuery exists at all: It hides a lot of the stupidity in the DOM.
It may be because I'm still trying to shake the "libraries are for the lazy and inexperienced!"-mentality from my early code-fiddling days... but this almost feels like cheating. I don't know JavaScript, have since given up on ever learning it, so instead I'm using a seemingly simplified version of it? ._.;

Even so I'm only doing this in hopes of being good enough to play with gameQuery. It doesn't use <canvas> and that makes me happy... Never could get even that stupid text clock to work.

Although gameQuery doesn't appear to have support for the mobile-gyroscope-sensor thing I wanted to use. It can't possibly be too hard to make it work anyway... can you even mix regular JavaScript and *Query code in the same document never mind, that's a dumb question. JavaScript == jQuery. I knew that. ._.;;
Scriptkitten
psychic stalker
Scriptkitten
It took me over three hours but I got something really simple and stupid to work all by myself... in jQuery. Strangely, I think I seem to be understanding it better than plain JavaScript. Is that normal?
Yes. It's part of the reason JQuery exists at all: It hides a lot of the stupidity in the DOM.
It may be because I'm still trying to shake the "libraries are for the lazy and inexperienced!"-mentality from my early code-fiddling days... but this almost feels like cheating. I don't know JavaScript, have since given up on ever learning it, so instead I'm using a seemingly simplified version of it? ._.;
No.

You're making a mistake that a lot of people do when they first encounter [removed] You're confusing the language (JavaScript) and the API (the DOM). When you interact with the document or with the window or with anything that has to do with the page, you're working with the DOM.

JavaScript, by itself, is just a language with functions and object prototypes.

The DOM is how JavaScript interacts with the page it's on.

JQuery exists to give you something that's a lot nicer than the DOM. The DOM is stupid and backwards and broken and complicated and confusing and stupid. JQuery makes that go away so you get a much nicer way to think about the DOM.

Your reaction is common and normal.
Scriptkitten
Even so I'm only doing this in hopes of being good enough to play with gameQuery. It doesn't use <canvas> and that makes me happy... Never could get even that stupid text clock to work.
I think that's partly because you have a notion of persistence that is incompatible with how the canvas works.
Scriptkitten
Although gameQuery doesn't appear to have support for the mobile-gyroscope-sensor thing I wanted to use. It can't possibly be too hard to make it work anyway... can you even mix regular JavaScript and *Query code in the same document?
JQuery is JavaScript. GameQuery is JavaScript. They are written in JavaScript, for JavaScript. They are interfaces, not languages.

Benevolent Borg

14,400 Points
  • Perfect Attendance 400
  • Millionaire 200
  • Invisibility 100
psychic stalker
Also, Douglas Crockford. Set aside 4 or 5 hours and watch Crockford on JavaScript Volume 1 and Chapter 2 and Act III. It'll give you a good part of the history of all of this and why JavaScript is what it is and why it's awesome in its own way.

ah alright thank you.


psychic stalker

They do work with Java, but the reason they exist is because the Java Programming Language is a pile of stupid and should be made to go away at the earliest opportunity.

(I'm being pedantic because it's important: The Java Programming Language, which is stupid and bad and evil, should never be confused with the Java Virtual Machine, which is not stupid, not as bad, and not evil.)

so to make sure i understood that right. Javascript is bad and Java is good(or at least not near as bad).
Shade7510
so to make sure i understood that right. Javascript is bad and Java is good(or at least not near as bad).
I suppose I should have made something clear from the beginning:

Java is to JavaScript as a Car is to a Carpet.

Java is two things:
  1. There is the Java Programming Language. It is the thing people write when they make a Java program. It is a language like C#. C++ is a language. So are Scala and Clojure. So is JavaScript and so are Lisp and Scheme and Self and SmallTalk and C and Prolog and Erlang and Haskell and... a hundred others. They are languages with grammar, vocabulary, syntax, and semantics. They are languages in exactly the same sense as English is a language.

  2. There is the Java Virtual Machine. This is a piece of software that acts like a computer. It's a virtual computer that uses an instruction set completely unlike Intel or AMD CPUs. Java programs get compiled to run on the Java Virtual Machine. It's exactly the same thing as how C# gets compiled to run on the .NET Common Language Infrastructure. It's also exactly like how C++ gets compiled to x86 so it can run on any Intel or AMD CPU. The only difference is that a Java program can (in principle) be compiled once and run on any Java Virtual Machine, no matter what computer it's on. (It doesn't, but that's beside the point.)

Clojure is a dialect of the Lisp programming language, which runs on the Java VM.
Scala is another language which runs on the Java VM.
Jython is a dialect of Python that runs on the Java VM. (Actually, there are a whole bunch of languages with J in their name that run on the Java VM. None of them have anything to do with Java, but are actually compatible with Java.)

JavaScript is completely different and separate from Java. JavaScript used to be called LiveScript. Its current official name is ECMAScript. The name "JavaScript" was used by Netscape to ride on the Sun corporation's new Java technology. Please do not confuse them.

JavaScript is a good language that happens to have some very bad parts.

The Java Programming Language is a bad language full of really stupid s**t that Sun tried several times to fix, and which Oracle (who bought Sun and now "controls" Java) is now ******** up at every opportunity.
Scriptkitten
psychic stalker
Scriptkitten
It took me over three hours but I got something really simple and stupid to work all by myself... in jQuery. Strangely, I think I seem to be understanding it better than plain JavaScript. Is that normal?
Yes. It's part of the reason JQuery exists at all: It hides a lot of the stupidity in the DOM.
It may be because I'm still trying to shake the "libraries are for the lazy and inexperienced!"-mentality from my early code-fiddling days... but this almost feels like cheating. I don't know JavaScript, have since given up on ever learning it, so instead I'm using a seemingly simplified version of it? ._.;
That's like saying using C is cheating when you could use assembler instead.
Understanding what's going on underneath the hood is good but not a prerequisite. We didn't invent tools because we are lazy (ok, maybe we invented some tools because we're lazy) but because they allow us to work faster, more efficient and achieve things easily that are almost impossible without them.
I mean, you don't view using an excavator as cheating when you could use a shovel instead, do you?

Hallowed Lunatic

13,050 Points
  • Dressed Up 200
  • Forum Regular 100
  • Elocutionist 200
psychic stalker

The Java Programming Language is a bad language full of really stupid s**t that Sun tried several times to fix, and which Oracle (who bought Sun and now "controls" Java) is now ******** up at every opportunity.


Would explain why everyone's taking Java when I'm seeing more C/C++/C# jobs on the market. I'm not a fan of the .NET thing but I am enjoying Web Technologies and kicking it's butt three ways to Wackaday apart from the App Inventor but that's because it's a block based thing and I HATEHATEHATE those.

@kitten: Libraries are there to help you do certain tasks without human interference and thus make your code more efficient. They also help with another principle of programming: Code reuse.

Edit: I only took Java because there was ******** all else interesting at level 2 offered on that degree. I'm still getting a Pass2, which is the equivalent of a B.

Quick Reply

Submit
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum