How do you structure your JavaScript code? Do you employ architectural patterns such as MVC, or do you utilize other methodologies?
I’ve been developing a side project for a while, and as it evolves, I’ve realized my webpage has transformed into a complex application. Currently, I am using jQuery, but the growing complexity of logic necessitates a reusable structure or, to put it another way, a cohesive ‘architecture.’ My initial design resembles ‘MVC’:
- The ‘model’ represents a JSON object that is enhanced with additional functions.
- The view is managed through the DOM coupled with classes for modifications.
- The controller serves as the central hub for event management and for initiating changes in the view or model.
I’m eager to learn how others have developed more extensive JavaScript applications. I want insights focused solely on the combination of JavaScript and typical web services, rather than frameworks like GWT or other server-centric methods.
As a side note, I previously mentioned that JavaScript isn’t purely object-oriented or functional. This may have caused some misunderstanding. To clarify, given JavaScript’s distinctive nature and my experience with strongly-typed languages, I prefer to avoid strictly imposing paradigms that originated in significantly different programming languages.