Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript and CSS Development with jQuery
|
BOOK: Beginning JavaScript and CSS Development with jQuery
This is the forum to discuss the Wrox book Beginning JavaScript and CSS Development with jQuery by Richard York; ISBN: 9780470227794
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript and CSS Development with jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2009, 08:10 PM
Authorized User
Points: 133, Level: 2
Points: 133, Level: 2 Points: 133, Level: 2 Points: 133, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default javascript variable and file name rules in you sample codes

I am going to make jquery my javascript framework. So if I can, I want to get everything in good practice from day 1. And this book should be my reference by hands etc. Very good one.

Here are some questions

First, I noticed that in download codes, these javascript file names are with empty space and with upper case. I know it is from the book examples. But would that be better to use _ to replace empty space and make them all lower cases just like in real life projects?

Second, I notices that you name your javascript variables starting with dollar sign $, I didn't think about that before, and not saw many other programmers use this, but I think it is a good practice, specially for us php programmers. I am thinking about use that too in my javascript programming. Any other opinions you heard against using $ sign in the javascript variables?
 
Old July 6th, 2009, 11:34 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

The naming conventions used for files in the book are the ones I like to use in my live projects. So, if you don't like spaces or capitalization, use whatever makes sense to you. As for whether it's good practice, well, that's subjective to your own personal opinion.

As for using dollar signs in your JavaScript variables, some people like dollar signs in JavaScript variables, some don't. There isn't really any technical advantage either way.

I've heard that some people have gravitated toward using dollar signs to name global variables, and not using a dollar sign for variables created in local scope (i.e., within a function or class method). I think that probably makes more sense. But, like I said in the book, my own habits came from PHP.

I'm sorry for the late reply, BTW, I noticed your post, but forgot to reply.





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the license for the shopping cart sample codes? blackhorse66 BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 8 November 12th, 2009 05:16 PM
Unable to download sample codes Beginning ASP Data ckm2003 Wrox Book Feedback 1 November 2nd, 2007 07:56 AM
Need some more sample codes t.m.sundaram Visual Basic 2005 Basics 0 July 16th, 2006 08:16 AM
beginning php4 sample codes viksapar Beginning PHP 1 September 16th, 2003 05:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.