5 ms·
Just curious, but would anyone recommend Javascript?
by pg 19y ago
Just curious, but would anyone recommend Javascript?
- dfranke 19y agoThat's an interesting suggestion. On one hand, you get a decently powerful language with most of the benefits of Scheme and without the scary (non-)syntax. However, I have to go with "no" because Javascript is tightly coupled with so many messy real-world details like DOM and browser incompatibilities. You end up with just as many brackets; they just happen to be a little pointier. It would be a good choice for someone already comfortable with HTML and web administration. Otherwise, you have too much static friction to overcome before you get to Hello World.
- rglullis 19y agoI would. It is high level enough for someone who wants to grasp basic concepts about programming (flow control, basic data structures) and has a really low barrier to entry (a web browser is all you need) which results in lots of online material. And, as the learner makes progress, he can start to go deep into the functional side of the language. It seems to be a nice fit for the case, indeed. Python would be my second best.
- Zak 19y agoMaybe. On the plus side, it's a pretty nice language - somewhere between Python and Ruby on the power continuum, I think. The C-like syntax is more complicated than Python, Ruby or Lisp, but familiarity with C syntax is probably advisable for anyone trying to get an overview of programming in today's world. Implementations and libraries are a drawback. I think the best way to learn a language is to build something interesting using it, and the only thing that's easy to build with Javascript these days is the client-side part of a website. Doing that also requires CSS and HTML, which the OP should probably learn a bit about, but it might be distracting to do that while he's trying to learn the fundamentals of programming. Trying to learn Emacs at the same time I was learning Lisp was distracting for me. I don't think browser incompatibilities are a reason to shun JS; unless you're building something for a website used by the general public, just target Firefox. Use Firebug to learn what's going on with your code and track down problems. Once you know what you're doing, it's more tedious than difficult to get it working on other browsers. If you already know how to make web pages, or really want to learn, JS is probably a good choice. If not, it probably isn't. It's probably best to can figure out what sort of project you'd like to build, and then learn a language well-suited to building it. It's possible to use Javascript for other purposes, but it's not yet easy. In a couple years, that might change - Steve Yegge seems to think it's the "next big language".
- brianmckenzie 19y agoJS is better as a second language, because of DOM issues. It's better for a beginner not to have to worry about those. It is very convenient for beginners because it's built into the browsers, and many people learn it concurrently with something else. You could do a lot worse than JS. For a first language, look at Python/Ruby and choose what you're most comfortable with.
- PindaxDotCom 19y agoIf you're absolutely new to web programming then the first thing you must learn is HTML. Some may think thats a given, but I think it's important to point out. If you can't get your head around HTML, you're not going to be building websites.
- edu 19y agoTricky answer. Javascript is beautiful, but not the DOM, and as have been said he would need to learn at least some HTML. On the other side, using only Javascript with a stand-alone interpreter would be a nice. I would go for Logo. [edit: a couple of spelling mistake]
- gb 19y agoJavascript was the language I learnt with more or less. I think it's quite a good choice, but it is very easy to write "bad" Javascript, especially when it comes things like eval(). It seemed wonderful when I first discovered it, but not until some time later did I discover the kind of mess it can cause. I was also introduced to OO (of sorts) through JS... I perhaps wouldn't recommend this so much, it was incredibly confusing for me at first. I didn't have any real grounding in OO principles before I started though, so perhaps that would have helped.
- bootload 19y agoFunny you ask. I happened to listen to a talk Marc Andreessen did called , "2005: A Web Odyssey" <http://osc.gigavox.com/shows/detail994.html> http://osc.gigavox.com/shows/detail994.html> where Andreessen talks about commodity hardware and how it effects programming language choice. "... programming has moved from being machine dependent and complicated to become a dynamic and easy-to-learn process ..." Andreessen talks about how languages are moving up the ladder from machine languages to "high level, dynamic languages" by looking at increasingly comoditised, powerful hardware. He notes that Java should now be thought of as a system language. JS in browsers was created in '95 to bridge the gap b/w HTML & Java. Java was deemed too complicated for HTML users. The original idea was JS to be server side. But it never took off due to lack of effort by Netscape to create an Open source version and the tool problems. "PHP is to 2005 what Java is to 1995" A lot of the talk he talks about how "PHP is to 2005 what Java is to 1995" The talk was done in 2005. So for Andressen PHP or PHP like languages (Ruby, Python etc) are what he suggests. But right near the end of the talk he talks about Sajax and JPSpan where server side PHP (python,perl) transparently talks to higher level JS code in the browser. You can find more about Sajax and JPSpan following: - Sajax http://www.modernmethod.com/sajax http://www.modernmethod.com/sajax - JPSpan http://sourceforge.net/projects/jpspan http://sourceforge.net/projects/jpspan
- jkush 19y agoThe only reason I wouldn't recommend it is because the vast majority or books / tutorials available don't teach how you can really use it. Douglas Crockford and a handful of others have been beating the drum about Javascript being a functional language, but I don't think it's at critical mass yet. I think most people starting out with Javascript would learn how to do stuff in a browser but not how to "program".
- kirubakaran 19y agopg, would you recommend js?
- pg 19y agoI don't know enough about non-Lisp languages to recommend one. If I knew them well enough to choose one, my pick would be whatever makes it easiest to write simple programs. Building confidence is the most important thing, not conceptual elegance. I wrote most of my first programs in old fashioned Basic. It was a kludge of a language, but it was good for writing the dumb little programs I started with. The worry that people will form bad habits from using ugly languages is overblown.
- SwellJoe 19y agoJavaScript probably fails miserably on the "easiest to write simple programs" count. The development environment is easy to find, obviously...any browser and any plain text editor. But user interaction is hard, and gets all mixed up with nasty DOM and browser incompatibilities in short order. You also have to have additional tools (like Firebug) to get anything resembling useful errors from JavaScript. A good modern learning language probably ought to have an interactive shell. Ruby, Python, Scheme, and Smalltalk are probably all good choices. JavaScript can have an interactive shell in the form of FireBug...but again, it's scary when you get to doing anything that interacts with the user and very few tutorials of JavaScript cover interacting with JavaScript interactively. Having the knobs do something immediately when you twiddle them is almost certain to speed up the learning process. The human mind is pretty good at abstract reasoning: "flipping this light switch causes the light to come on over there". But the more you separate things out temporally and the more variables involved the less they stick: "flipping this light switch starts a timer, which depending on the current state of the light, will cause it to turn on or off in three minutes". Merely being a non-compiled language is still a slower iterative process than direct interaction (which is the primary disqualifying point against Perl as a learning language in my opinion...corrected in Perl 6, of course, but that's still a few months out). The shorter the "try, debug, try again" cycle is the faster one picks things up, I think. I found Ruby very fast to learn, to some degree, for that reason. Python was almost as discoverable, though I found it less intuitive, where "intuitive" is probably defined as "kinda like what I'm used to". PLT Scheme was a pretty cool learning experience, but it became less interesting as soon as I wanted to build something useful with it--so few libraries (of course, as a Perl user, I feel that way about every language other than Perl...CPAN spoils you for all other languages when it comes to "just get it working" prototyping).
- altay 19y agoI just ran across this thread randomly -- far too late -- but, yes, I would. In a <cough> concurrent thread, I gave my thoughts on why I'm glad I learned JS first: http://news.ycombinator.com/item?id=46531 http://news.ycombinator.com/item?id=46531 Functional JS rocks. And the fact that you can examine other peoples' programs with FireBug is huge.