How do I debug with Pyglet?

Is JavaScript hard to debug?

  • I am a java developer but started developing  for the front end. I have started using a framework called extjs and it seems to be swallowing lot of errors. One such instance is using type instead of xtype for referring to an existing defined store. I spent two hours to debug the code. The compiler didn't give any errors neither did the console on the Chrome browser. Hence the question.

  • Answer:

    Without debugging tools (Chrome's developer tool) it would be a nightmare for me to debug a js application. JavaScript debugging is little bit harder at initial stages of learning but it won't matter much as you become more experienced on the inner working of framework and js. In your case, it is not that error is swallowed, the error will be thrown later. Actually you passed a wrong configuration for creating a store object and extjs would assign an undefined object in place of a valid store to the view object. The error will be thrown later when you try to access the undefined store's property as "Cannot find the property of an undefined…...line no....", with complete stack trace except during an anonymous function call. Framework didn't throw any error because, unlike java, here objects are not statically typed and error will be thrown at runtime which cannot be determined easily. But anyhow with debugging tools present in chrome and Firefox you can monitor for any console errors being logged as and when you interact with UI or widget objects. Interacting with objects and widgets directly via chrome console is very easy too. Also extjs has a steep learning curve and you need little patience.

Venkatesh Duraiarasan at Quora Visit the source

Was this solution helpful to you?

Other answers

I'll say something about the Developer Tools in Internet Explorer 11. http://msdn.microsoft.com/en-US/library/ie/dn255007 For minified scripts that you want to debug, just pretty print it. You can use source mapping now for debugging minified scripts, or scripts dynamically generated from another language. //# sourceMappingURL=myfile.min.js.map If you are sure that library code - for example, jQuery - is correct, you can just skip debugging it by marking it as library code.

Jingqi Xie

No, JavaScript is not hard to debug. You can do a step-by-step, line-by-line,  even conditional debugging, profiling and much much more with the help of current browser debugging capability. https://developers.google.com/chrome-developer-tools/docs/javascript-debugging and http://getfirebug.com/javascript will give you a hint of these capabilities. What you are facing is an abstraction problem. If you are using a JavaScript library/framework, it is most likely to hide the low level controls from you. This will become even worse if that part of the code (library) is minified, making it really hard for browser debuggers to help you point to the exact error location. You can try using their development mode source code, if possible. That will reduce some pain.

Kumar Bhot

yes but you can relieve the burden quite a bit if you:1) Truly understand JS async2) Understand fundamental JS well and are decent at JS. This comes with time and practice and coding3) know how to use Google Chrome Dev tools well and how to use the terminal in it to look at items in the DOM, etc.4) You test drive your code and have tests that can cover you and tell you a starting point at times where the problem lies or what the problem is.5) Use a tool such as WebStorm which has awesome debug capability for JS: You can use webstorm for debugging not only for in-browser as you can with Chrome Tools but when you are not debugging in the browser, lets say back-end code or like above in tests, Webstorm lets you debug your code through its own debugger so you can use its debugger tool for browser and non-browser related code.Even if you have fancy IDE tools, you’re decent at JS, etc. You need to understand async, not only for basic JS like promises but also if your’e going to be a Node.js dev, you better know async well. That is..the JS event loop, etc.:

Dave Schinkel

Debugging JS is OK. Debugging Ext JS framework is a nightmare. You will spend much more time fighting the framework and reading its source code than writing code. On the other hand, it does a lot of things for you. Don't treat the framework like a black box: read its code. It's easier that way, trust me. ;-)

Jan Prichystal

Seemingly meaningless and not very helpful compiler messages can drive you crazy. One of the most common of these is "undefined is not a function". Because of these you can easily endup having myriads of breakpoints while debugging. Always use unminified version of everything while developing.

Kiripolszky Károly

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.