Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 09-05-2008, 07:35 PM Learning JS
Defies a Status

Posts: 2,071
Name: carl
Location: UK
Trades: 0
Hi

I have posted on other coding secions about learing stuff and since joining this forum have learnt CSS and HTML whilst not an expert I can write both.

I have been reading up on PHP and been learning however I have read that people suggest learning JS first as its a little easier to get to grips with.

I initially dismissed this as I thought it was a 'poor' substitute but I have been questioning my reasoning and done lots of reading about what JS is and how its used and think I should learn JS before delving any deaper into PHP as it will both help with doing "fancy web stuff" and give me a more solid grounding for php so with that in mind can anyone suggest a good book?

The reason I am asking (I know there are tons of resources available on the web) but from what I have read most give bad examples and demostrate poor practice. I will obviously be reading up on w3c website but I prefer learning from books - old fashioned that way I guess .

Any suggestions are very welcome as are comments on my thoughts above regarding JS.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by bakerc; 09-05-2008 at 07:40 PM..
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
 
Register now for full access!
Old 09-06-2008, 12:18 PM Re: Learning JS
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
JavaScript has somewhat of a quirky nature to it, and I don't agree that it is necessarily easier than learning PHP. It is, however, more universal than PHP, since it can be run anywhere that there is a browser, which is pretty much on every computer in the world. This makes JavaScript the most widely spread programming language in the world.

The one thing that is pretty easy to learn about JavaScript is the way it is used as references to objects in the browser.

If you are looking for a solid foundation from which to study PHP, JavaScript simply isn't going to give it to you. There are many differences between the languages, such as the scoping of variables, and the rules regarding how functions are formed. There are similar structures, however, such as the "C-style" brackets that enclose controls statements (if, for, switch, else, etc.) I would say that the procedural ability of PHP is much stronger, as there are more functions for dealing with arrays, objects, etc than in JS. For its objects, JavaScript uses something known as "prototypal inheritance", which is unique to it, while being much different than classical systems. Prototypal inheritance is great for referencing browser objects, however.

JavaScript is so expressive, that you will be able to use many of its concepts intuitively, without really using it as a programming language at all. I've even had a programmer tell me that he didn't consider JavaScript to be a programming language at all. Although I disagree, his statement had some merit to it. JS belongs in a category by itself.

OK, now that I have written almost a whole essay on the subject, let me say that there are not very many good books on JavaScript. The reason there are so many bad books is that the standard for JavaScript has not been very well defined, and when it has been defined (as ECMA script), often the standard has been a hindrance rather than a help.

The book that has been a standard throughout the years is this one:
javascript: The Definitive Guide
This is probably the best all-around book about the subject, though it doesn't cover some advanced subjects. It is probably better to learn the advanced subjects online or with a book that is just about JavaScript as an object-oriented language, such as the one by Douglas Crockford or the upcoming book by John Resig.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 09-06-2008 at 01:49 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 09-06-2008, 02:26 PM Re: Learning JS
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
I learned PHP first and then went on to learn JavaScript. I actually found PHP much, much easier to learn. JavaScript has been a little frustrating because of the browser inconsistencies, but in the end, I think I've become a better overall programmer after learning to write object-oriented JavaScript code. However, I think I would have found it harder to learn JavaScript if I didn't already know PHP. All that said, it's really up to you on which you want to learn first. I would really base it on what you need to do with your sites rather than on which is easier to learn.

In addition to the resources Abel provided, I'd also recommend Douglas Crockford's video series on JavaScript, which can be found at the YUI theater. His videos might be a little hard for someone just starting out, however. There is a serious lack of good JavaScript resources on the web. There are a few, but they can be hard to find. Here are a few I've found:
  • W3Schools - You'll get to pick up some basic knowledge from their site.
  • Tizag - Some more tutorials
  • Quirksmode - This will probably be more of a reference site than a tutorial site for you. However, I've found it very useful.
  • Mozilla's Developer Center - Again, another reference site. Keep in mind when reading their docs, though, that Internet Explorer may interpret some things differently. Quirksmode is a good way to check.
One tool you'll find absolutely invaluable in writing JavaScript is Firebug, an add-on for Firefox. You can use it to help work out the bugs in your code.

A direction that I'd really recommend that you consider is using a JavaScript framework. Many of the top JavaScript frameworks out there have already worked out most of the cross-browser issues that you'll run into. They'll also have provide shortcuts for a lot of the common tasks you'll find yourself doing. You don't necessarily need to learn JavaScript before learning a framework, either, though it definitely helps. There are so many JavaScript frameworks out there that it might be hard to choose. To help you narrow it down, the top ones that I've found seem to be Prototype (with Scriptaculous), YUI, JQuery, Dojo, and MooTools. I don't know a whole lot about Prototype or Dojo, but they are both quite popular (ditto the rest I mentioned). YUI is made by Yahoo and has some excellent documentation and examples. The two that I'm the highest on are JQuery and MooTools. JQuery has a lot of documentation, a lot of plugins, and a very good community. I personally use MooTools, but the community is scattered and so is the documentation. However, I like the code better.

Which framework you choose is up to you and any of the above will work very well, but if you end up choosing MooTools, here are a few resources for you:
  • My MooTools Tutorial - A basic tutorial that should get your feet wet. I wrote it for beginners who don't know JavaScript but want to learn MooTools. It was written for MooTools 1.1, but I think most of it should apply to MooTools 1.2 as well.
  • 30 Days of MooTools - A set of 30 tutorials introducing the library with good examples for each tutorial. They're still writing them at the moment, but I think they're on day 19 today, so you'll be able to do some reading.
  • The Mootorial - Written by Aaron Newton, a developer for the MooTools project. (He also has a book that you can purchase.)
  • The Official MooTools Google Group - You can try asking for help on it, but your chances of getting a reply that helps are probably 50/50. It's unmoderated, unfortunately, so there's a lot of spam that pops up too.
  • The unofficial MooTools forum - I'd recommend this one over the official group. You'll probably get more help, even though it's smaller.
  • The old MooTools forum - It's read-only, but it can be useful at times. The 'Your Scripts' section will point out a lot of useful scripts.
  • AjaxRain - A lot of MooTools scripts are listed here as well
  • Clientside Library - A useful set of scripts for MooTools
  • Moo.rd - An extension library for MooTools
I also have a few extensions that I'm going to be releasing in a couple weeks, but my site is going to get redesigned first. Still, check my blog or signature for an update.

I hope these resources help you out.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by VirtuosiMedia; 09-06-2008 at 02:28 PM..
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 09-06-2008, 04:10 PM Re: Learning JS
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Internet Explorer may interpret some things differently
Masterpiece of understatement there I think

I can't add anything to the above posts apart from:
One thing to note is that javascript is a "soft" language, meaning that you can override built in methods with your own function.

example:
When I'm debugging a script I often want to see a continuous stream of returned data, bit like a debug.print(value) works in compilers.
So I override the alert() function like so:
Code:
<body>
<div id="msg"></div>

<script type="text/javascript">
e = document.getElementById("msg")

function alert(message) {
	e.innerHTML += message + "<br>";
}

alert("Message 1");	
alert("Message 2");	
alert("Message 3");	

</script>
so now when I call alert(message) it puts the data into a div called "msg" rather than having a modal dialog stopping script execution each time it sends a message out.

You can even send it to a popup window giving you an "immediate" viewer.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-06-2008, 06:01 PM Re: Learning JS
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Masterpiece of understatement there I think
It was a little more graceful than some of the other things I wanted to say about Internet Explorer.

Good tip on changing the default alert action. I use it to debug as well, but have found the popup modal very annoying. I'll try using your method from now on.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 09-06-2008, 06:09 PM Re: Learning JS
Defies a Status

Posts: 2,071
Name: carl
Location: UK
Trades: 0
Thaks guys, lots to consider. Some very good suggestions and information from everyone.

Just one last question about Ajax, from what I have read this is Javascript with a more comprehensive set of standards and is focused more towards working more with server side scripts (is this correst?) which, from what I have read makes it more cross browser friendly - would you agree?

You guys (all three of ya) help people out so much, including me the system wont let me give any TP until I spread it about more - virtual TP everyone

Decision made - will learn php /mysql first (as I want to build a CMS / Database driven site) and Javascript as I need it as it doesn't sound like it will give any sort of steppnig stone for php - JS reminds me a little of VB which I used to play with in the good ole days of the Amiga (anyone remember those!).
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by bakerc; 09-06-2008 at 06:19 PM..
bakerc is offline
Reply With Quote
View Public Profile Visit bakerc's homepage!
 
Old 09-06-2008, 06:48 PM Re: Learning JS
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
AJAX is just a means for JavaScript to send and receive information to and from a server. The information received can be used to update the page without a refresh, using normal insertion techniques. This can be handy for a number of reasons, such as passing off portions of script logic to the server, or simply loading portions of HTML on demand based on user input.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Learning JS
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29176 seconds with 12 queries