Live data from Hacker News

Ask HN: JavaScript as a first language?

news.ycombinator.com

11–15 of 15 posts

Re: Ask HN: JavaScript as a first language?

#11
post #9

I would recommend . . . I would start with this progression . . . HTML->CSS->Javascript then PHP/MySQL then once you have a handle on creating a simple web app with PHP/MySQL look at either Rails/Ruby or Laravel/PHP . . . it's tough to understand all the magic going on in Rails/Laravel till you've created a basic app from scratch Login/Logout/CRUD etc . . . Railscasts.com and Laracasts.com are great tools for learnin…

In principle I aggree with saluki - I'd just add a little explanation:

JavaScript lets you control HTML elements, so it would be rather hard to begin with just JavaScript. Styles in CSS are currently indispensable when writing any HTML unless you want to rely on crude default formatting. That's why it's HTML -> CSS -> JS and not the other way around.

Moreover you have to understand that JavaScript is a client-side scripting language, that is to say that your scripts will be downloaded and executed solely and entirely on your computer. You will not have any way to open, read and write to files (except for cookies), because your script "lives" only inside the browser.

If you want your code not to be seen by a visitor of your website, or if you want the code to be executed before the page is downloaded and displayed in a browser, you need a server-side scipts like PHP or ASP so that for example the visitor has only access to the parts of the website you want him/her to read, or display content depending on the user login and password.

Later you will see that for storing and manipulating larger amounts of data you'll need a data base server, which makes sorting and managing information much easier and faster than if you'd accessed files directly from your servers' hard drive.

PHP and MySQL are for free and therefore they are recommendable for beginners - alternatives are Microsoft's .Net + MS SQL and many many other, which are arguably more robust for commercial, enterprise level applications.

Node.js is however a more modern way of doing things on-line, PHP belongs to the 2000s.

jQuery is good once you realise why plain javascript s*cks a great deal ;)

Staring your journey with online tools such as JS is ok, but it may be difficult to later jump into more... how should I put it... "serious?" languages - once you want to build your own standalone application software that runs outside a browser (not only because you have to use a compiler, but also because you have to pay attention to more details and plan ahead). For instance it's not impossible, but it seems that, switching from strong typed languages like C to weak typed is easier than the other way around.

Please do never underestimate or neglect learning about design patterns, data structures and algorithms no matter what language you're using or intend to learn.

Re: Ask HN: JavaScript as a first language?

#12
post #8

JavaScript is not even a good second or third language. Of course it is easy to cut and paste code and hack things. But when it doesn't work right you will go crazy trying to work out why. To be good with JavaScript you need a rather substantial and solid grasp of CS fundamentals and how they are implemented in languages that are stricter about what they will accept and how. In JavaScript there are too many situation…

What you're saying is pretty accurate and I agree. But the problems you enumerate are ironically the best parts about learning JavaScript at the same time. Failing silently - it's nice to have 'incorrect' programs still do stuff when learning. Who wants to spend hours tracking problems they cannot even comprehend? Figuring out the DOM - tricky indeed. But it's at least superficially familiar to everyone. Browsers hav…

As for DOM I agree. DOM provides a rather rich collection of widgets with which to create "interesting" output which with most other languages requires a GUI framework with its own learning curve. The DOM learning process which worked for me was to :

Write a simple page in HTML, then open it in Dev Tools and understand the structure, etc.

Then re-create it using document.createElement(), etc.

I've re-read parts of David Flanagan's "Javascript the Definitive Guide" many times before I became proficient with many essential concepts in JS. I recommend the book (yes in hardcopy) as a valuable adjunct to Mozilla's docs.

Re: Ask HN: JavaScript as a first language?

#13
post #6

Look at "hello world" in Javascript and Python. Then look at "ask user for their name and display "Hello user's name"" in Python and Javascript. https://wiki.python.org/moin/SimplePrograms name = raw_input('What is your name?\n') print 'Hi, %s.' % name http://www.utexas.edu/learn/javascript/example1.html var who = window.prompt("What is your name"); document.write("Hello " + who); The complication in the Javascript e…

Thanks for the examples, it clearly demonstrates that JS on its own can't even provide minimal I/O. That is by design, in the ECMA 262 standard, it specifies the need for additional objects to provide the I/O. The core language is for scripting the "extension objects".

Re: Ask HN: JavaScript as a first language?

#14
post #3

Not JavaScript – Prototypal inheritance is interesting and powerful. However, overall JavaScript does not afford good programming practices and does not cleanly expose important re-usable programming concepts. Between the good parts of JavaScript, there are nasty surprises. I think python is a good first language for a few reasons. 1. Overall the syntax is clean, concise, and readable in the sense that the actual cod…

FTFY: "sudo" code ==> pseudo-code

Re: Ask HN: JavaScript as a first language?

#15
post #3

Not JavaScript – Prototypal inheritance is interesting and powerful. However, overall JavaScript does not afford good programming practices and does not cleanly expose important re-usable programming concepts. Between the good parts of JavaScript, there are nasty surprises. I think python is a good first language for a few reasons. 1. Overall the syntax is clean, concise, and readable in the sense that the actual cod…

FTFY: "sudo" code ==> pseudo-code

Thanks
Post reply on HN