| By Yakov Fain | Article Rating: |
|
| February 8, 2013 06:08 PM EST | Reads: |
2,993 |
Tоday I was participating in a discussion on one Java forum – the question was if Java is an easy or difficult programming language to learn. IMO, Java is not difficult to learn, to teach, and to use. It’s a strongly typed compiled language with tools that help you identify most of the errors before you even run the program.
While participating in this discussion I was writing code in a different programming language called JavaScript, which gave me a chance to illustrate a lot of things the Java developer takes for granted, while there are people who work in a more hostile environment called JavaScript.
I had a working program, and decided to add a JavaScript handler function to illustrate HTML form submission with jQuery for our upcoming book. I’ve been writing this code in Eclipse-based IDE called Aptana. I’ve added this handler for the submit event to a Donation form:
$('#donate-form-container').submit(function(){
var formData = $(this).serialize();
console.log("The Donation form is serialized: " + formData);
returm false;
});
Ran the program – it rendered the Web page, HTML looks fins, but nothing worked. IDE didn’t give any errors. Started a browser debugger – Firebug. Now I’ll going to put a breakpoint in this newly added function and find the problem. How hard could it be? I’ve added just this little fragment to a working program. Easy Peasy.
Oops. Where is my main.js? Nowhere to be found. Only jQuery script is available.
Was my main.js even downloaded? Let’s check the Network tab. Yes, it’s here:
After applying deductive reasoning (as in Sherlock Holmes stories) I figured out that the script has arrived to the browser, which instead of adding it to the DOM, showed a middle finger without explaining why. As any normal person, I started to to find who someone else to blame. May be this Firebug is buggy and just doesn’t want to show my nice script? Tried Chrome with Developer Tools – same story. The script arrived, got the finger and I have nothing to debug.
Well, there is no one else to blame. Let me just re-read my own code. Man, I misspelled the word return and wrote “returm false;” instead, which deserves a capital punishment. Changing m to n did the trick, and now both Chrome and Firefox are happy to add my JavaScript code to DOM.
What’s the moral of this story:
- Java developers should know that they take lots of things for granted and should not complain that their life is difficult!
- The fact that it takes less code to write Hello World program in JavaScript doesn’t mean that it’s an easy programming language. Don’t trust me? Watch this.
Read the original blog entry...
Published February 8, 2013 Reads 2,993
Copyright © 2013 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Yakov Fain
Yakov Fain is a Managing Director of Farata Systems, consulting, training and product company. He has authored several Java books, dozens of technical articles. SYS-CON Books released his latest co-authored book , Rich Internet Applications with Adobe Flex and Java: Secrets of the Masters in Spring 2007. Sun Microsystems has nominated and awarded Yakov with the title Java Champion. He leads the Princeton Java Users Group. He is an Adobe Certified Flex Instructor. Yakov co-athored the O'Reilly book "Enterprise Application Development with Flex". He twits at twitter.com/yfain.
- Cloud People: A Who's Who of Cloud Computing
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Business Solutions, Social Media, and Platform Systems of Engagement Market Shares, Strategies, and Forecasts, Worldwide, 2013 to 2019
- ExtraHop Named a Best of Interop 2013 Finalist for Two Awards: Best Cloud and Virtualization Product and Best Monitoring and Management Product
- Kevin Benedict’s What’s New in HTML5 – Week of May 19, 2013
- Interop Las Vegas Previews News Announcements from over 60 Exhibitors & Sponsors
- BrightScope Releases Top 25 Technology Companies With the Best 401k Plans
- Research and Markets: Cloud Business Solutions, Social Media, and Platform Systems of Engagement
- Mobile Commerce News Weekly – Week of May 5, 2013
- This Week in Cloud, May 9, 2013: U.K. issues cloud-first policy, Dell acquires Enstratius, OpenStack’s growing pains. And more…
- TeamDrive Partners with SmartOffice to Offer First Office Productivity Solution with End-to-End Encryption
- Les plateformes de serveurs de Supermicro® utilisent la technologie NVIDIA GRID™ pour fournir les performances graphiques accélérées aux bureaux virtuels
- Cloud People: A Who's Who of Cloud Computing
- AMD and Adobe Collaborate on Upcoming Version of Adobe Premiere Pro Software to Enable Breakthrough Video Editing Performance Through Open Standards
- New Relic Q1 2013 Blazes Past Growth Targets and Reaches 40,000 Active Customer Accounts
- Cloud Business Solutions, Social Media, and Platform Systems of Engagement Market Shares, Strategies, and Forecasts, Worldwide, 2013 to 2019
- Apple Makes Highly Eccentric Hire
- ExtraHop Named a Best of Interop 2013 Finalist for Two Awards: Best Cloud and Virtualization Product and Best Monitoring and Management Product
- Kevin Benedict’s What’s New in HTML5 – Week of May 19, 2013
- Interop Las Vegas Previews News Announcements from over 60 Exhibitors & Sponsors
- BrightScope Releases Top 25 Technology Companies With the Best 401k Plans
- Adobe Drives Innovation With New Video Workflows at NAB 2013
- Research and Markets: Cloud Business Solutions, Social Media, and Platform Systems of Engagement
- Mobile Commerce News Weekly – Week of May 5, 2013
- Where Are RIA Technologies Headed in 2008?
- Cover Story: How to Increase the Frame Rates of Your Flash Movies
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Your First Adobe Flex Application with a ColdFusion Backend
- Adobe Flex 2: Advanced DataGrid
- How To Create a Photo Slide Show ...
- i-Technology Blog: Death-Knell For "Rich Media? Hardly!
- Personal Branding Checklist
- Adobe Flex Interface Customization - Themes, Styles, Skins
- Adobe/Macromedia - Microsoft, Look Out!
- Has the Technology Bounceback Begun?
- "Real-World Flex" by Adobe's Christophe Coenraets
























