473,241 Members | 1,487 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

Javascript MVC example(s) wanted

I am after opend source small, middle or large example programs thay use MVC
pattern coded Javascript.

Many thanks in advance,

Aaron

Jul 22 '08 #1
4 3742
On Jul 22, 8:27 am, "Aaron Gray" <ang.use...@gmail.comwrote:
I am after opend source small, middle or large example programs thay use MVC
pattern coded Javascript.
The traditional Smalltalk MVC does translate to JavaScript reasonably
easily. Whether or not a naive translation is a good idea is a big
question. I don't think it is.

Having a Data Access Layer (DAL) to encapsulate all the
XMLHttpRequests is a good idea. This layer is the only layer that
knows anything about HTTP or any other types of communication. This
layer can do some processing on the returned data from the server to
comply with the DALs stated API.

Having a Model layer is a good idea. This is the only layer that talks
with the DAL. The model layer knows business logic and implements the
observer pattern.

The part of MVC that causes me pause in the browser is the VC
distinction. I don't really think they are very clearly separated. The
main issue is how the strategy pattern part of MVC will be
implemented. Because JavaScript objects are dynamic, you can replace
property function-values of an object. This is something you cannot do
in Java for example. I don't know about Smalltalk. So in JavaScript
instead of replacing a reference in the view layer to a controller
object, you can just replace a particular function of the view object
itself. Also I don't find I take advantage of the strategy pattern
part of MVC frequently.
I usually design a program as

DOM
===========================
Widget |
------------| bootstrap.js
Model |
---------------------------
DAL
===========================
Server
The bootstrap.js file starts the feature testing, calls the Model to
populate itself, calls the widgets to start themselves and sends
references where the widget should insert itself in the DOM and
references to models the widget should observe.

It isn't so important that the layers do what the the traditional
"MVC" says they should. What is important is that each layer does what
its documentation says it does. For a very simple little widget the
three JavaScript layers could all be combined into one object.

Colin Moock's "Essential ActionScript 2.0" has a good discussion of
MVC. The best one I have read. The code is not in JavaScript, of
course, and he is very keen on classes but it is an indication of how
programmers will likely start writing code with ECMAScript 4. I won't.
The site of all those interface definitions. Ugg. You can download
that code from his site. Chapter 18 and some chapters around it will
likely be your interest.

"MVC" doesn't seem to be a big thing in browser scripting. That could
mean it isn't very useful or comes in such a different shape it is not
called "MVC". I think that usually MVC is just too heavy for the
requirements in the browser.

Peter
Jul 22 '08 #2
On Jul 22, 11:27*am, "Aaron Gray" <ang.use...@gmail.comwrote:
I am after opend source small, middle or large example programs thay use MVC
pattern coded Javascript.

Many thanks in advance,

Aaron
TIBCO, http://www.tibco.com/devnet/gi/getting_started.jsp, has an MVC
javascript framework (free). Check it out. While I agree for the most
part with Peter Michaux's comments, there are certain problems in
maintaining a large site with many coders that an MVC javascript
framework solves. Features get added to pages that sometimes cause
three or four different inputs to update or read from the same data
object. If the original page is written using MVC, this is quite
maintainable. Else it becomes a labyrinth, a Rube Goldberg machine
that is extremely painful to trace.

So, a very light MVC javascript framework can be written that can't be
written in other languages due to the javascript features Peter
mentioned (recursion helps too). TIBCO has an interface builder and
it's framework is not lightweight but may help you in writing your
own.

Bob
Jul 23 '08 #3
"beegee" <bg*****@gmail.comwrote in message
news:7b**********************************@z66g2000 hsc.googlegroups.com...
>On Jul 22, 11:27 am, "Aaron Gray" <ang.use...@gmail.comwrote:
>I am after opend source small, middle or large example programs thay use
MVC
pattern coded Javascript.
>TIBCO, http://www.tibco.com/devnet/gi/getting_started.jsp, has an MVC
javascript framework (free). Check it out. While I agree for the most
Not quite what I was looking for.

Thanks anyway,

Aaron
Jul 25 '08 #4
On Jul 22, 11:27 am, "Aaron Gray" <ang.use...@gmail.comwrote:
I am after opend source small, middle or large example programs thay use MVC
pattern coded Javascript.
Jemplate, a javascript implementation of perl's Template::Toolkit:

http://search.cpan.org/~rkrimen/Jemp...ib/Jemplate.pm

It is very flexible and can be used in many more ways than the page
above indicates.

trwww
Jul 29 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Andrea | last post by:
Hi everyone, I am in the process of learning javascript and have a question on location.href. Does javascript always require the <script language = "javascript"> (or script...
6
by: Alex Rast | last post by:
First of all, this is not a programming question. I'm a user, not programming in JavaScript. I'm not, however, a novice user or even a power user - I certainly know programming intimately as well...
21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
10
by: John Passaniti | last post by:
(Note: This is not the same message I posted a week or so ago. The problem that prevented my previous attempt to work was a silly error in the template system I was using. This is a problem...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
12
by: pantagruel | last post by:
Hi, I'm thinking of making a WScript based JavaScript library, I can think of some specific non-browser specific scripting examples that should probably make it in, like Crockford's little...
4
by: Joe Hrbek | last post by:
Could someone help me translate to something that would close to it in python? The anonymous functions are giving me problems. var dataListener = { data : "", onStartRequest: function(request,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.