Discuss Scratch

gtoal
Scratcher
1000+ posts

How to write Hello World in Javascript

I don't usually pass on net.lore, but I'll make an exception to my rule today for this, which pretty much sums up my own feelings towards modern development environments…

https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.l70h4ntwh

G
Jonathan50
Scratcher
1000+ posts

How to write Hello World in Javascript

What's net.lore?

uBlock origin is has blocked 170 requests on that page and it's still going up!

Not yet a Knight of the Mu Calculus.
PullJosh
Scratcher
1000+ posts

How to write Hello World in Javascript

Oh yeah. This times 100.

People who feel this way might find some enjoyment in reading hardmath123's excellent post on the subject.
scratchisthebest
Scratcher
1000+ posts

How to write Hello World in Javascript

This is the main reason I still don't know how to write Javascript

Javascript alone already kinda sucks. Browser support is horrible, and it falls into the weird category of “kinda-functional-programming-oh-but-also-we-threw-in-some-object-oriented-features-because-some-people-like-them”

And then to make Javascript suck less people come up with frameworks and precompilers and stuff to make it work better. jQuery is one of the first popular ones I think? And then people decided that jQuery didn't do what they wanted so they made their own framework, and then those became too dated so we need to make a new one, etc.

Don't even get me started on npm, and how programmers prefer to look on NPM before, well, programming. People are so afraid of “oh no! I might reinvent the wheel” that we end up with left-pad. And then NPM packages become too much to handle so people write NPM managers like browserify and stuff.

Let's step back there. A package manager manager. Because you have too many dependencies to realistically handle with the regular package manager, so you get the package manager manager.

Good job.

Normally I'd link the xkcd “Standards” comic, but maybe this one is more appropriate:

Last edited by scratchisthebest (Oct. 3, 2016 23:50:43)


I am a Lava Expert
Jonathan50
Scratcher
1000+ posts

How to write Hello World in Javascript

scratchisthebest wrote:

This is the main reason I still don't know how to write Javascript
What? Just learn JavaScript and then you'll know how to write JavaScript. There is no reason why you can't just write
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>User Activity</title>
</head>
<body>
<ul id="user-activity">
</ul>
<script src="user-activity.js"></script>
</body>
</html>
var userActivityList = document.getElementById('user-activity');

function requestActivity(cb) {
var request = new XMLHttpRequest();
request.onload = function () {
cb(request.responseText);
};
request.open('GET', 'https://example.com/user-activity');
request.send();
}

function displayActivity(activity) {
var lines = activity.split('\n');
for (var index in lines) {
let item = document.createElement('li');
item.innerText = lines[index];
userActivityList.appendChild(item);
}
}

requestActivity(displayActivity);
in 2016.

Not yet a Knight of the Mu Calculus.
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How to write Hello World in Javascript

Confession time, web development doesn't appeal to me the way general programming does. Perhaps I simply lack experience, but I feel like learning HTML/CSS is more about being familiar with elements than learning concepts. To my further discouragement, as the article points out, professionals don't use HTML, instead opting for other tools (for probably good reason). In order to make an adequate website, I need to learn other skills.

Today, I looked into jQuery because I was impressed by the examples given on W3Schools. Because I wanted to know if it was worth learning, I searched up “jQuery bad,” and I encountered an article addressing its criticisms. The author counters the claim that people should learn “vanilla” JS first by saying that "the DOM scary,“ a statement I wholeheartedly agree with, and jQuery could motivate users to learn the DOM.

Also, the article's comparison between functional programming and object-oriented programming makes me wonder if FP is just a trend. However, I honestly don't understand the OOP hate. I personally consider OOP to be for data structure equivalent what functions are for combinations. OOP is useful, and even if FP is replaced by the next hot paradigm, it, too, would still have uses. (Note that when I mean ”OOP," I mean C++'s style.)
Jonathan50
Scratcher
1000+ posts

How to write Hello World in Javascript

Chibi-Matoran wrote:

To my further discouragement, as the article points out, professionals don't use HTML, instead opting for other tools (for probably good reason). In order to make an adequate website, I need to learn other skills.
I'm pretty sure that was a joke, even if most websites' HTML today is just
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
  </head>
  <body>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
  </body>
</html>

Last edited by Jonathan50 (Oct. 4, 2016 01:26:38)


Not yet a Knight of the Mu Calculus.
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How to write Hello World in Javascript

Jonathan50 wrote:

Chibi-Matoran wrote:

To my further discouragement, as the article points out, professionals don't use HTML, instead opting for other tools (for probably good reason). In order to make an adequate website, I need to learn other skills.
I'm pretty sure that was a joke, even if most websites' HTML today is just
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
    <link rel="stylesheet" href="...">
  </head>
  <body>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
    <script src="..."></script>
  </body>
</html>
That's what puts me off.
comp09
Scratcher
1000+ posts

How to write Hello World in Javascript

Well, take a look at ImageShare…which uses JavaScript for (almost) all the things. speaking of which, now that I have a sort of solid base, I should rip out the Scratch integration and make a proper image host that doesn't suck

If you already have a boilerplate for the tooling necessary to use React, it's actually pretty pleasant, and it creates really snappy pages too! React is very easy to understand in code, because each component (ideally) is pure, meaning that it will produce the same output for the same input. This makes server-side rendering relatively easy! If done correctly (*cough* scratch-www *cough*), it can be very performant too.

But for simpler, smaller scale projects that don't require such interactivity (and a state management mess), I use good old jQuery and Bootstrap, and maybe Handlebars for templates so I don't get jQuery-spaghettified. See Scratch in Real Time.

My point is that each framework/library has its upsides and downsides, and you don't need React for everything.

Last edited by comp09 (Oct. 4, 2016 02:09:26)



Visit the website of Andrew Sun!


MegaApuTurkUltra
Scratcher
1000+ posts

How to write Hello World in Javascript

Speaking for frameworks like React and Angular, they actually solve a legitimate problem with “vanilla” JS and HTML.

Try taking one of the Angular demos that are like 5 lines of code and reimplementing it in vanilla JS. Now try to make a full blown webapp in vanilla JS. Seriously. Now compare it to an Angular app, where the code is ostensibly neater, more concise, and more modular (as the library basically encourages you to do it that way). I don't see a problem.

Nobody's forcing to use any libraries (especially not for “hello world”), but it's really not a good idea to reinvent the wheel with things like this.

I'll also put it in that async/await is great and does all things

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
IcyCoder
Scratcher
1000+ posts

How to write Hello World in Javascript

lol that article is the bomb I laughed so hard reading it

Because JS is the future (echos) future future futur futu fut fu f
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How to write Hello World in Javascript

The satire criticizes the fast changes in trends and the need to use a large amount of tools to get work done. What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
MegaApuTurkUltra
Scratcher
1000+ posts

How to write Hello World in Javascript

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development
Depends on your project. Do you have to maintain and display a complex state? Angular or React. Do you need to visualize data? D3. Do you want to use async/await now? Traceur or Babel. Do you just need a simple way to interact with DOM? jQuery. Do you just want some basic JS utilities? Underscore, etc etc

Chibi-Matoran wrote:

how long do you think they will be popular?
Not long, regardless

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
PullJosh
Scratcher
1000+ posts

How to write Hello World in Javascript

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How to write Hello World in Javascript

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Thank you!
MegaApuTurkUltra
Scratcher
1000+ posts

How to write Hello World in Javascript

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Unfortunately that mindset doesn't work in the real world. Try doing any substantial project and you'll see.

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

How to write Hello World in Javascript

MegaApuTurkUltra wrote:

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Unfortunately that mindset doesn't work in the real world. Try doing any substantial project and you'll see.
Should I learn the DOM before learning libraries?
coro-scratch
Scratcher
3 posts

How to write Hello World in Javascript

Chibi-Matoran wrote:

MegaApuTurkUltra wrote:

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Unfortunately that mindset doesn't work in the real world. Try doing any substantial project and you'll see.
Should I learn the DOM before learning libraries?
YES
IcyCoder
Scratcher
1000+ posts

How to write Hello World in Javascript

Chibi-Matoran wrote:

MegaApuTurkUltra wrote:

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Unfortunately that mindset doesn't work in the real world. Try doing any substantial project and you'll see.
Should I learn the DOM before learning libraries?
Short answer: not really

You do not have to these libraries make you use DOM in different way then with vanilla JS so learning regular DOM is just a waste of time. Nut it is helpful sometime to know if you find a problem in your code.

Because JS is the future (echos) future future futur futu fut fu f
IcyCoder
Scratcher
1000+ posts

How to write Hello World in Javascript

PullJosh wrote:

Chibi-Matoran wrote:

What tools/libraries/frameworks do you consider to be absolutely necessary for web development, and how long do you think they will be popular?
None of them. Just write your HTML & CSS, and if you need some extra functionality toss in a couple lines of vanilla js.

(This is especially true if you're just starting to learn about web development. If you start using libraries and frameworks right off the bat, you'll have a really difficult time later trying to understand just plain 'ol vanilla JS.)
Wrong. If you want to be hired in web development you have to know how to use these libraries because it is a standers in that company. Plus I read that people that know frameworks like angularjs get payed more and get more job opportunities. But when it comes to personal projects choose whatever you want to choose.

Because JS is the future (echos) future future futur futu fut fu f

Powered by DjangoBB