Amazines Free Article Archive - Friday, December 04, 2020
Read about the most recent changes and happenings at
Log into your account or register as a new author. Start submitting your articles right now!
Search our database for articles.
Subscribe to receive articles emailed straight to your email account. You may choose multiple categories.
View our newest articles submitted by our authors.
View our most top rated articles rated by our visitors.
* Please note that this is NOT the ARTICLE manager
Add a new EZINE, or manage your EZINE submission.
Add fresh, free web content to your site such as newest articles, web tools, and quotes with a single piece of code!
Home What's New? Submit/Manage Articles Latest Posts Top Rated Article Search
Subscriptions Manage Ezines
 Article Archive
 Advertising (133435)
 Advice (161176)
 Affiliate Programs (34757)
 Art and Culture (73748)
 Automotive (145650)
 Blogs (75234)
 Boating (9844)
 Books (17221)
 Buddhism (4128)
 Business (1329027)
 Business News (426382)
 Business Opportunities (366354)
 Camping (10967)
 Career (72752)
 Christianity (15849)
 Collecting (11638)
 Communication (115068)
 Computers (241942)
 Construction (38921)
 Consumer (49685)
 Cooking (17068)
 Copywriting (6653)
 Crafts (18205)
 Cuisine (7544)
 Current Affairs (20419)
 Dating (45889)
 EBooks (19696)
 E-Commerce (48224)
 Education (185303)
 Electronics (83507)
 Email (6407)
 Entertainment (159839)
 Environment (28927)
 Ezine (3039)
 Ezine Publishing (5451)
 Ezine Sites (1550)
 Family & Parenting (110929)
 Fashion & Cosmetics (196424)
 Female Entrepreneurs (11847)
 Feng Shui (131)
 Finance & Investment (310448)
 Fitness (106332)
 Food & Beverages (62917)
 Free Web Resources (7940)
 Gambling (30223)
 Gardening (25151)
 Government (10533)
 Health (629687)
 Hinduism (2206)
 Hobbies (44055)
 Home Business (91582)
 Home Improvement (251106)
 Home Repair (46178)
 Humor (4832)
 Import - Export (5453)
 Insurance (45105)
 Interior Design (29585)
 International Property (3485)
 Internet (191008)
 Internet Marketing (146481)
 Investment (22849)
 Islam (1167)
 Judaism (1356)
 Law (80455)
 Link Popularity (4595)
 Manufacturing (20858)
 Marketing (99002)
 MLM (14136)
 Motivation (18221)
 Music (27012)
 New to the Internet (9496)
 Non-Profit Organizations (4048)
 Online Shopping (129631)
 Organizing (7805)
 Party Ideas (11853)
 Pets (38069)
 Poetry (2234)
 Press Release (12683)
 Public Speaking (5635)
 Publishing (7528)
 Quotes (2407)
 Real Estate (126636)
 Recreation & Leisure (95398)
 Relationships (87678)
 Research (16171)
 Sales (80337)
 Science & Technology (110257)
 Search Engines (23488)
 Self Improvement (153227)
 Seniors (6236)
 Sexuality (35949)
 Small Business (49284)
 Software (83015)
 Spiritual (23475)
 Sports (116095)
 Tax (7659)
 Telecommuting (34067)
 Travel & Tourism (307870)
 UK Property Investment (3121)
 Video Games (13428)
 Web Traffic (11748)
 Website Design (56838)
 Website Promotion (36596)
 World News (1000+)
 Writing (35790)
Author Spotlight

I'm Ellisen, nice to meet you! Obviously you're here because you want to know who I am. Wel...more

Pushpa Srivastava is an SEO strategist that helps online business owners figure out how to grow thei...more

Im just a man who likes to be happy and see others happy. Im into home business, sports, family, and...more

Financial analyst and author writing on economy and business. ...more

Avinash Kabra is a young & dynamic Technopreneur, Digital Marketer, Blogger, Foodie and Travel Enthu...more

Why doesn't my code work by Milecia McG

Why doesn't my code work by
Article Posted: 11/12/2018
Article Views: 851
Articles Written: 24
Word Count: 1153
Article Votes: 0
AddThis Social Bookmark Button

Why doesn't my code work

Career,Software,Website Design

After you've been writing code for a while you start to notice things. Maybe you have a picture that's a little too far left or the price you're getting for a shirt isn't right. The one skill you have to have to fix those bugs is the ability to debug code.

It could be something as simple as a missing letter in your variable name or it could be something as complex as the dll missing something. Even though there are a lot of things that could be wrong, odds are that it is something pretty common. I'm going to give you a few steps you can take to debug code efficiently.

  1. Make the error happen again.

    You have to make sure that you can reproduce the error or else you won't be able to fix it. As soon as you notice something is wrong, stop and trace your steps backwards. Figure out exactly what you did to make that error happen and do it again. Now you have a starting point.

  2. Look at the error message.

    Open your browser and look at the developer tools by pushing F12. Look at the console and see if there are any error messages. If there aren't any error messages, then you're going to have to dig deeper. I'll cover that in a different tutorial.

    Now that you know the error message you technically know what's wrong. If you don't understand the message, just Google it. Stack Overflow is a great place to start looking. You might have to read through a few forums, but you'll eventually find an answer that leads you in the right direction.

  3. Start tracing through the call stack.

    Once you have the error, you know what line the error happens on. Put a break point there and start tracing the call stack to the root of the error. The call stack shows you everything that has happened in the code up to the point that it breaks. This will help you fix the real problem is instead of just slapping a band-aid on the place that it broke.

  4. Find where you think it's happening.

    After you've been through the call stack you should have a place in the code that you want to start checking. Take your time and read through your code. That's the only way you'll get to the root of the problem. It might take a while to find the root, but you have to have a good starting place.

  5. Check for syntax errors.

    Start looking for any syntax errors. Check if you missed any semicolons, see if you have any spelling errors, and look for any missing commas, dashes, or any other punctuation. These types of errors are the most simple to make, but they can be the hardest to find. Most developers make the mistake of rushing through the syntax. Take your time and make sure this is right. It'll save you a lot of headache later.

  6. Check for logic errors.

    These are tricky little buggers. They might not show up until your code is already running because of bad data. You could be comparing the wrong values and not even know it. Make sure that all of your variables are the right type for what you're using them for.

    As an example, you might want to discount a price and you need to do a little math to make it work. You don't want to be subtracting strings when you should be subtracting numbers. Finding logic errors takes some patience and a little experience. Just go through your code with a fine tooth comb and you should be able to find these errors.

  7. Check for environment errors.

    In most cases it won't get this deep, but it doesn't hurt to make sure your environment is setup right. Are you connected to the right port? Are your passwords correct? Did you change the way your project handles certain packages? Sometimes updates can change your settings so it's a good idea to look here too.

  8. Run your code after any changes you make.

    Whenever you make a change to your code, always run it to see if the error is gone. It's important to track what your changes do so you know whether they work or not. The worst thing (and most common) is to "fix" your code and not know why it works. Sometimes changes cause more problems too. That's why you need to see what happens every time you tweak something.

  9. Get up and walk away.

    If you haven't figured out the problem by now, get up and leave it. Go walk around for a few minutes. Drink some water or get a snack. When you've been working on a debugging issue too long, you start to lose track of what you're doing. If you've been trying to debug code for over 30 minutes, just leave it and come back a little later.

  10. Repeat 4 - 9 until the code works AND YOU KNOW WHY.

    Debugging code is an iterative process. You'll probably go through this cycle at least twice and that's on the low end. So don't feel bad if you haven't figured it out in 10 minutes. It takes a while to debug code. It actually takes longer to debug code than it takes to write it.

    You also need to understand why your code works after you debug it. If you don't know why your code works, then you'll have a bug later on down the line. Most developers aren't 100% sure why their code works, they're just happy it works. But unless you want to get stuck in an infinite loop of debugging code, then try to get it right the first time.

  11. Go get help.

    If all else fails, get up and go ask someone else to come look at your code. You can do this on Stack Overflow or any other programming forums, but if you are working with other people on a project then go see if they have a few minutes to come look for the bug with you. As a rule of thumb, you should try to debug the code on your own for at least 30 minutes before you go ask for help.

It takes a lot to debug code, but it's the best feeling in the world when it finally works again. No programmer is error-proof. Even people who have been doing this for over 20 years still need to debug their code. You learn how to do it better and faster the more you work at it.

Say man, I have this JavaScript tutorial that people seem to like. I mean, it's already had 238 downloads in the past couple of weeks. Why don't you come check it out today? Click here to get the tutorial

Related Articles - debugging, web development, testing, learning to code, beginners,

Email this Article to a Friend!

Receive Articles like this one direct to your email box!
Subscribe for free today!

 Rate This Article  
Completely useless, should be removed from directory.
Minimal useful information.
Decent and informative.
Great article, very informative and helpful.
A 'Must Read'.


Do you Agree or Disagree? Have a Comment? POST IT!

 Reader Opinions 
Submit your comments and they will be posted here.
Make this comment or to the Author only:
*Your email will NOT be posted. This is for administrative purposes only.
Comments: *Your Comments WILL be posted to the AUTHOR ONLY if you select PRIVATE and to this PUBLIC PAGE if you select PUBLIC, so write accordingly.
Please enter the code in the image:

 Author Login 
Register for Author Account


Advertiser Login


   Limited Time $60 Offer!
   90  Days-1.5 Million Views  


Great Paranormal Romance


Stevert Mckenzie, Travel Enthusiast. ...more

hello everyone l been on the net since 2000 and enjoy my work l work as an affiliate and also have w...more

Author of four books and two screenplays; frequent magazine contributor. I have four other books "in...more

Jason Ng has a huge passion for the health and fitness industry as he strongly believes that having ...more

At LeadGenerators, we specialise in content-led Online Marketing Strategies for our clients in the t...more

I am not a writer nor am I trying to become a writer. I am an average person with average intelligen...more

Demonstrated exceptional leadership in the government and private sector at an executive level. Skil...more

My name is Kingsley Chihozie. Am from the western part of Africa, Nigerian. Am a graduate of Abia St...more

I am an International Corporate Consultant specialising in the bespoke formation of offshore compani...more

Susan Friesen, founder of the award-winning web development and digital marketing firm eVision Media...more

HomeLinksAbout UsContact UsTerms of UsePrivacy PolicyFAQResources
Copyright © 2020, All rights reserved.
Some pages may contain portions of text relating to certain topics obtained from under the GNU FDL license