473,698 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamically generating html vs using html scaffolding?

Are there any guidelines people use that help them decide when it is
better to dynamically generate all html elements using javascript
versus actually writing some html and using it as scaffolding?
I have been using the extjs framework ( I haven't see this library
critiqued much on this forum - unlike prototype, jquery and dojo which
the regulars here tend to eviscerate - unless i've missed some
threads, which is quite possible) and it allows both mechanisms for
all its widgets and layouts. But i'm not sure what the pros and cons
are to either approach. Obviously if you don't have access to the
html page then your options are limited.

Anyway, I was planning on posting this within the extjs forums (and I
still might if it doesn't spark much of a response here), but then
thought that this was more of a general javascript/style question and
so have posted this here.

Would really appreciate your thoughts.

Thanks,
Faisal Vali, MD, MSc
Loyola Radiation Oncology
Chicago, IL
Jun 27 '08 #1
11 2728
SAM
Faisal Vali a écrit :
Are there any guidelines people use that help them decide when it is
better to dynamically generate all html elements using javascript
versus actually writing some html and using it as scaffolding?
The only way is to code :
- all in html,
eventually with css,
exceptionally with few images
- adding JS for some non really useful dynamism, not more
I have been using the extjs framework ( I haven't see this library
and what is this marvelous extjs ?
where does it leave ?

ie : seen that
<http://www.extendersam ples.qsh.eu/>
-886 KB (1252 KB uncompressed) just for a table :-(
or ... what is supposed to be a impla example of a kind of plugin :
http://www.siteartwork.de/livegrid_demo/
--1154 KB :-( :-( (just to sort a table ?)
critiqued much on this forum - unlike prototype, jquery and dojo
Perhaps because it is less well known or used ?
Would really appreciate your thoughts.
As I start from principle that a page must be displayed and readable
without JS ... :-(

--
sm
Jun 27 '08 #2
SAM wrote:
Faisal Vali a écrit :
>Are there any guidelines people use that help them decide when it is
better to dynamically generate all html elements using javascript
versus actually writing some html and using it as scaffolding?

The only way is to code :
- all in html,
eventually with css,
exceptionally with few images
- adding JS for some non really useful dynamism, not more
Perhaps not the *only* way to code, but certainly a sensible set of
principles to begin with.

>I have been using the extjs framework ( I haven't see this library

and what is this marvelous extjs ?
where does it leave ?

ie : seen that
<http://www.extendersam ples.qsh.eu/>
-886 KB (1252 KB uncompressed) just for a table :-(
You know, I have to admit that I thought you were being disingenuous at
first when I read this. I went to the site and saw 962KB (as reported by
Firebug).

I thought: well it must be mainly in the graphics... not so:

HTML: 22KB
CSS: 207KB
JS: 705KB
Images: 15KB
XHR: 15KB

Jinkies!
or ... what is supposed to be a impla example of a kind of plugin :
http://www.siteartwork.de/livegrid_demo/
--1154 KB :-( :-( (just to sort a table ?)
And, if I may: Yowser!

Jun 27 '08 #3
Dan Rumney wrote:
SAM wrote:
>Faisal Vali a écrit :
>>Are there any guidelines people use that help them decide when it is
better to dynamically generate all html elements using javascript
versus actually writing some html and using it as scaffolding?
The only way is to code :
- all in html,
eventually with css,
exceptionally with few images
- adding JS for some non really useful dynamism, not more

Perhaps not the *only* way to code, but certainly a sensible set of
principles to begin with.
I second that.
>ie : seen that
<http://www.extendersam ples.qsh.eu/>
-886 KB (1252 KB uncompressed) just for a table :-(
There is no TABLE element, it is composed of DIV elements.
[...] I went to the site and saw 962KB (as reported by
Firebug).

I thought: well it must be mainly in the graphics... not so:

HTML: 22KB
CSS: 207KB
JS: 705KB
Images: 15KB
XHR: 15KB

Jinkies!
>or ... what is supposed to be a impla example of a kind of plugin :
http://www.siteartwork.de/livegrid_demo/
--1154 KB :-( :-( (just to sort a table ?)

And, if I may: Yowser!
However, as for the scripts the footprint could have been considerably
smaller if a competent person would have written it (or the code generating
it). For example, the code in the ExtJs example includes

function Sys$WebForms$En dRequestEventAr gs$get_dataItem s() {
// ...
if (arguments.leng th !== 0) throw Error.parameter Count();
return this._dataItems ;
}

[...]

Sys.WebForms.En dRequestEventAr gs.prototype = {
get_dataItems: Sys$WebForms$En dRequestEventAr gs$get_dataItem s,
get_error: Sys$WebForms$En dRequestEventAr gs$get_error,
get_errorHandle d: Sys$WebForms$En dRequestEventAr gs$get_errorHan dled,
set_errorHandle d: Sys$WebForms$En dRequestEventAr gs$set_errorHan dled,
get_response: Sys$WebForms$En dRequestEventAr gs$get_response
}

With `Sys$WebForms$E ndRequestEventA rgs$get_dataIte ms' aso. being references
to previously declared local functions. A function expression would have
gotten rid of this bloat and could have probably been used without regret,
being supported since JavaScript 1.3 (NN3), JScript 3.0 (IE 4), ECMAScript
Ed. 3. Especially for an application which uses Object initializers and
`throw', without fallback each, which are supported only since JavaScript
1.3/1.4, JScript 3.0/5.5 (IE 5.5), ECMAScript Ed. 3:

Sys.WebForms.En dRequestEventAr gs.prototype = {
get_dataItems: function() {
// ...
if (arguments.leng th !== 0) throw Error.parameter Count();
return this._dataItems ;
}

...
};

See also <http://PointedEars.de/es-matrix>.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Jun 27 '08 #4
Thomas 'PointedEars' Lahn wrote:
However, as for the scripts the footprint could have been considerably
smaller if a competent person would have written it (or the code generating
it). For example, the code in the ExtJs example includes

[...]
Sys.WebForms.En dRequestEventAr gs.prototype = {
get_dataItems: Sys$WebForms$En dRequestEventAr gs$get_dataItem s,
get_error: Sys$WebForms$En dRequestEventAr gs$get_error,
get_errorHandle d: Sys$WebForms$En dRequestEventAr gs$get_errorHan dled,
set_errorHandle d: Sys$WebForms$En dRequestEventAr gs$set_errorHan dled,
get_response: Sys$WebForms$En dRequestEventAr gs$get_response
}

With `Sys$WebForms$E ndRequestEventA rgs$get_dataIte ms' aso. being references
to previously declared local functions. A function expression would have
gotten rid of this bloat and could have probably been used without regret,
being supported since JavaScript 1.3 (NN3), JScript 3.0 (IE 4), [...]
^^^[1] ^^^^[2]

[1] Netscape Navigator _4.06+_ (see the ES Matrix)
[2] ... *and* other UAs based on Trident I (MSHTML.dll v4.0.x)
<http://en.wikipedia.or g/wiki/Trident_%28layo ut_engine%29>
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Jun 27 '08 #5
While I second that JS *normally* should only be used sparce, non
obtrusive, etc and all, I really think there is a place for a
comprehensive framework like ExtJS and others. It is, IMHO, a fairly
extensive framework that allows making responsive, webbased
*programs*.
What I mean, is that one should not rely on JS for frontend
*websites*, but 'ajaxified' websites go beyond HTML and become more or
less *programs*. I wouldn't mind using these tools on an intranet.
Heck, I'm currently building one. I know my target users, and am in
control of their OS and Browser. It is even build using standard HTML/
CSS/JS, so *any* other programmer that comes after me, can work on it
and I can be pretty sure of the 'future-proofness' of it.
ExtJS just gives me the controls and widgets, that I can use to build
a webbased administration program, that works fast and it costs me
just weeks instead of months, using something like C++/Java.
The problem is: know where to use JS and where not. Things like Google
Maps and Google Docs are extremely helpfull tools. Should these be
done in just HTML?! No ofcourse not, it just wouldn't even be possible
to do so! But http://www.google.com obviously should not ;-)

Websites / DOM based programs that run in a browser: 2 different
things!

Just my 2 cents.

P.
Jun 27 '08 #6
VK
On Jun 15, 7:02 pm, Peter <peter.schille. ..@gmail.comwro te:
Websites / DOM based programs that run in a browser: 2 different
things!
Absolutely. By rephrasing it in the "commercial lingo": Web 1.0 and
Web 2.0 are two different things.

Web 1.0 one started and remains as information represented in a
particular format (HTML markup) delivered to a viewer able to render
such format (browser). In the context of Web 1.0 styling and scripting
are additional tools intended to facilitate the process of perceiving
and navigating withing the delivered information. At the same time
they are not required to use the delivered information.

Web 2.0 is a client-side interface to handle different information.
This interface is programmed using Javascript and DOM and usable over
capable framework application (browser). Other words Web 2.0 content
and a browser are in the same relations as Javascript and HTML page or
Java applet and JVM. This interface is not intended and doesn't have
to operate without a capable framework application, in the same way as
Java applet is not intended nor has to run without JVM installed.

Web 1.0 and Web 2.0 are _not_ in XOR relation. The one doesn't exclude
other nor one has to replace other (though it will most probably
happen in some amount of time).

It is just not appropriate to mechanically apply the same set of
demands to two completely different concepts - but many old thinkers
are still trying to do it, and not in this NG only.

Jun 27 '08 #7
Peter wrote:
While I second that JS *normally* should only be used sparce, non
obtrusive, etc and all, I really think there is a place for a
comprehensive framework like ExtJS and others. It is, IMHO, a fairly
extensive framework that allows making responsive, webbased
*programs*.

What I mean, is that one should not rely on JS for frontend
*websites*, but 'ajaxified' websites go beyond HTML and become more or
less *programs*. I wouldn't mind using these tools on an intranet.
Whatever your curious way of emphasizing words, you seem to have missed the
point of this subthread and specifically of my posting entirely (to which
you posted a followup, after all), which was how to write code so that it
does not require this much of data to be downloaded and still does what it
is supposed to do.

This includes, but is not limited to, client-side script code. Because all
code and data (e.g. images) used client-side always needs to be downloaded
to the equivalent of a cache beforehand, whether it is with a Web
application running on the Internet or one running in an intranet (I presume
you meant Local Area Network instead which is not the same thing) or on the
local host.

Obviously, the more data needs to be transferred, stored, and interpreted,
the slower and more unresponsive the Web application will be (even with
XHR). For a LAN with a rather limited data rate as compared to its supposed
number of users this also means: the greater the overall network load will
be, therefore the slower the overall network response will be. For the
local host this also means: the more system resources are consumed by the
Web application and the user agent it must run in, and the more unresponsive
other applications will become.

You really don't want to support that. Which does not mean in any way that
dynamic technologies like XHR (which some call by the misnomer "AJAX")
should not be used. But they should be used wisely, to *reduce* the total
amount of data to be transferred. That label certainly cannot be attached
to an application that requires an about one MiB download to do what could
have been done with only a tiny fraction of that. And it is almost certain
that it could have been done easily, as I have showed.

Please take heed of <http://jibbering.com/faq/#FAQ2_3next time.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #8
Whatever your curious way of emphasizing words,
Just wanted to make a difference between *websites* and *programs*

you seem to have missed the
point of this subthread and specifically of my posting entirely (to which
you posted a followup, after all), which was how to write code so that it
does not require this much of data to be downloaded and still does what it
is supposed to do.
No, I did not. I think many people define download size as html + js +
css. They completely forget that most of the traffic is caused by
images and other media. I personally think that any framework used for
*programs* is small enough to be 'bundled' with them.
(I presume you meant Local Area Network instead which is not the same thing) or on the
local host.
No, an intranet is a *collection of LAN's*, with local (non internet)
domain names, which from a users point of view acts like a small
'internet'.
Obviously, the more data needs to be transferred, stored, and interpreted,
the slower and more unresponsive the Web application will be (even with
XHR). For a LAN with a rather limited data rate as compared to its supposed
number of users this also means: the greater the overall network load will
be, therefore the slower the overall network response will be.
To have a client-side framework downloaded *once* (have it cached for
next visits) is a trivial non-issue in my opinion. Again: images are
way bigger.
For the local host this also means: the more system resources are consumed by the
Web application and the user agent it must run in, and the more unresponsive
other applications will become.
I wonder if you've ever used a framework like ExtJS/DoJo e.o., because
it definitely is *not* unresponsive, slow or anything like that. It is
a convenient way to quickly build 'web 2.0' a.k.a. AJAX programs. From
my point of view, these frameworks can really offer a great commercial
value for businesses and organisations that all of a sudden can
'update' their programs without having a network administrator doing
all sorts of tests and roll-outs. They can extend their intranets to
the internet.
After all: lots of programs that are used by businesses and
organisations do simple things that can really easily be ported to web
2.0 apps. But the need for a good and consistent UI raises the need
for a framework.
Are you going to build everything these frameworks offer (sortable-
live grids/tree's/form validation/resizable frames/etc) from scratch,
just to squeeze out a few kB's?

Jun 27 '08 #9
On Mon, 16 Jun 2008 at 08:19:24, in comp.lang.javas cript, Peter wrote:

<snip>
>No, I did not. I think many people define download size as html + js +
css. They completely forget that most of the traffic is caused by
images and other media. I personally think that any framework used for
*programs* is small enough to be 'bundled' with them.
Using a 200kB .js file to display a 1kB news article is madness. Even on
an intranet it would be madness.

If you look in your browser's cache you'll see that framework .js files
are over 100kB. Image files are rarely over 30kB except when they are
the main point of the page.
<snip>
>To have a client-side framework downloaded *once* (have it cached for
next visits) is a trivial non-issue in my opinion. Again: images are
way bigger.
<snip>

You can say this about an intranet application that is used many times a
day at each desk.

For general web sites it's very dubious. When nothing useful is
displayed after 10 seconds people can use the back button and go to the
next link in the search results. Anyone selling consumer goods needs to
remember this : you're only two clicks away from a rival shop.

Also you have to remember that cache entries expire, caches are cleared,
and people don't re-visit web sites that annoy them.

John
--
John Harris
Jun 27 '08 #10

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

Similar topics

13
4644
by: Tim Henderson | last post by:
Hi I want to dynamically generate a graph in python that would be displayable on a web page. What would be the best way to do this? The reason I want to do this, is because I am making a program to convert data from scientic probes into web pages. I have been able to do every thing except the graph generation. Your help would be much appriciated
6
2186
by: poisondart | last post by:
Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this mechanism. I've seen it on certain websites that will generate a file under certain parameters (through forms) that will dissapear (i.e. delete itself) after a specified amount of time. These files usually have some phony string for their filenames...like...
27
13048
by: ted benedict | last post by:
hi everybody, i hope this is the right place to discuss this weird behaviour. i am getting dynamically generated text or xml from the server side using xmlhttprequest. if the server side data is STATIC, i can have whatever size of data i want. but if the data (xml or text) is generated dynamically using php, then there seems to be a size limit! xmlhttprequest's responseText is truncated, and the xml therefore not well fromed. in border...
18
3967
by: blueapricot416 | last post by:
I am on a team designing the front end of an Intranet application. The backend guys will be using JSP and AJAX-like functionality to make server requests that must dynamically change elements on a page. What is the best way to create and populate tables, which will exist in floating DIVs (with drag and drop capability)? It only has to work with IE6. I know of two ways:
2
1190
by: mamin | last post by:
Hi, I need to create html file dynamically from C# code. I need to place there some javascript code. This js code I'm keeping in fukctions.js file. Now, I'm generating HTML code, for example: string htmlContent ="<html><body></body></html>"; ...... saveHtmlFile(htmlContent);
2
2591
by: aric.bills | last post by:
Hello all, I'm a novice Javascript programmer, and I'm having browser compatability issues regarding dynamic generation of tables. The following content generates "hello" in Firefox 1.5, but just a blank page in IE 6. Can anybody tell me what I should change to make IE happy? Even better, is there any kind of tutorial out there on dynamically generating tables? Many thanks,
2
1459
by: | last post by:
I have some sensitive data encrypted in a database. I need to allow the authorized people to produce a report (obviously, unencrypted) that they can send to the appropriate partners. Can I set it up so they can download a .csv of the data without actually producing the csv and saving it on the server side? I suppose the best description would be that on the client side, there's a link on a web page that looks like it links to the csv, but...
1
1896
by: jeffejohnson | last post by:
I'm looking to see if anyone has experienced this... I've got a dropdown that I'm populating dynamically and the items include HTML special characters (like &Ocirc;). If I load them from an existing JavaScript array I don't have any problems, but I'm generating the arrays dynamically, then populating my dropdown dynamically with the onload event. I've tried setting multiple encodings in the meta tag with no success.
9
1871
by: Dahak | last post by:
I'm trying to generate dynamic functions to use as separate callbacks for an AJAX API call. The API doesn't seem to allow for the inclusion of any parameters in the callback, so I can't associate the call with the handling routine (for reference purposes, I'm calling the Google Language Translation API). As a work-around, I thought I'd dynamically generate a unique callback function for each API call. Right now, I'm stuck hobbling...
0
8668
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.