Book Section
-----
TY JavaScript 3rd Ed.
Teach Yourself JS 1.5
Teach Yourself DHTML
Teach Yourself JS 1.3
LLWW: JavaScript

General Section
-----
Discussion Forum
Articles / Tips
JavaScript Links
About the Author
Privacy Policy
Contact Me



Other Sites
-----
Website Workshop
JavaScript Weblog

JavaScript Workshop Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Hints: On how to figure out that program code

 
Post new topic   Reply to topic    JSWorkshop Forum Index -> Articles
View previous topic :: View next topic  
Author Message
phil karras
Senior Member
Senior Member


Joined: 15 Jul 2002
Posts: 1750
Location: MD

PostPosted: Fri Aug 23, 2002 12:36 pm    Post subject: Hints: On how to figure out that program code Reply with quote

A good way to figure out just what something is doing in a program is to change it or break it on purpose and see what happens.

Try commenting a statement out to see what happens, if you comment out something like an obj= statement you'll find other things screaming at you because they need that obj and that will lead you to where, how, & why it is needed.

If you still don't understand just comment out one of those lines that uses the obj see what happens.

If you don't understand why any particular variable is being used then again, comment out its use and see how that changes the program.

You'll be pleasantly surprised at how much you can learn about a program by breaking it and tracing down the error messages you then get.
_________________
Phil K
Circle Software Consulting
Test website: http://cs.yrex.com/
Guidelines for Posting: http://jsworkshop.com/posting.html
IHBAAA = It Has Been Asked And Answered
KISS: http://jsworkshop.com/bb/viewtopic.php?t=508
Back to top
View user's profile Send private message Visit poster's website
mgm
Site Admin
Site Admin


Joined: 13 Jul 2002
Posts: 304
Location: Salt Lake City, UT

PostPosted: Sun Aug 25, 2002 2:59 am    Post subject: Reply with quote

This is a great idea and is one of the ways I learned many programming languages. One tip: start by "breaking" a small example, not a big one. It's hard to tell what's going on when you start to mess with a huge menu script, but if you start with one of the smaller examples from the book it should be obvious what's happening.

Also, don't assume this stuff is obvious to more 'advanced' JavaScript users. I can explain what every line does in my own scripts, but give me someone else's huge DHTML menu script and it will take me a while to figure out exactly what it's doing - and I'll use this same "breaking" technique to find out.

Don't be afraid to ask for help and post your "broken" scripts. (But not to this thread, use the JavaScript forum.)
_________________
Michael Moncur
Owner and Moderator, The JavaScript Workshop
Read the guidelines before posting: http://jsworkshop.com/posting.html
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    JSWorkshop Forum Index -> Articles All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
(c) 1997-2002 Starling Technologies and Michael Moncur. Portions (c) Sams Publishing.