This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes jquery and object oriented structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jquery and object oriented structure" Watch "jquery and object oriented structure" New topic
Author

jquery and object oriented structure

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
I want to organize/structure/encapsulate all my jquery javascript code:

I have a file "mypage_version1.js" with the following content (VERSION 1):



How can I organize it better?

Does the file "mypage_version2.js" with the following content (VERSION 2) structures the code better than "VERSION 1"?:



I am in doubt, which version is better (both works).

Version 1 is shorter, but cluttered within the file.

What is best practice?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

Which is clearer? WHich is easier to understand for someone who didn't write the code? WHich will be easier to maintain later on?

Too many people try to over-think things and just make things complicated for no reason.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jquery and object oriented structure
 
Similar Threads
jQuery not working on page
Thought I knew WAR structure: Spring MVC/JQuery (simple) path problem
jQuery tabs UI issue
jQuery ajax on click of href
jQuery UI tabs not loading in the same tab